test iap use #30
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Packer Build | |
| on: | |
| push: | |
| branches: [main, dev] | |
| paths-ignore: ['**/README.md','**/CHANGELOG.md', 'terraform/*'] | |
| env: | |
| PRODUCT_VERSION: "1.11.2" # or: "latest" | |
| #HCP_ORGANIZATION_ID: '${{ secrets.HCP_ORGANIZATION_ID }}' | |
| #HCP_PROJECT_ID: '${{ secrets.HCP_PROJECT_ID }}' | |
| #HCP_CLIENT_ID: '${{ secrets.HCP_CLIENT_ID }}' | |
| #HCP_CLIENT_SECRET: '${{ secrets.HCP_CLIENT_SECRET }}' | |
| jobs: | |
| packer-docker-base: | |
| name: Build Docker BASE | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./base-docker | |
| # https://github.com/google-github-actions/setup-gcloud | |
| # https://docs.github.com/en/actions/security-guides/automatic-token-authentication | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Authenticate to Google Cloud' | |
| id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
| service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
| - name: 'Set up Google Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| version: 'latest' | |
| project_id: '${{ vars.GCP_PROJECT_ID }}' | |
| install_components: 'beta' # optional: install additional components | |
| - name: Setup `packer` | |
| uses: hashicorp/setup-packer@main | |
| id: setup | |
| with: | |
| version: ${{ env.PRODUCT_VERSION }} | |
| - name: Run `packer init` | |
| id: init | |
| run: "packer init ./base_docker.pkr.hcl" | |
| - name: Run `packer validate` | |
| id: validate | |
| run: "packer validate -syntax-only -evaluate-datasources ./base_docker.pkr.hcl" | |
| - name: Run `packer build` | |
| id: build | |
| run: "packer build -force -var 'project_id=${{ vars.GCP_PROJECT_ID }}' -var-file=variables.pkrvars.hcl ./base_docker.pkr.hcl" | |
| packer-vault-base: | |
| name: Build Vault BASE | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./hashistack | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Authenticate to Google Cloud' | |
| id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
| service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
| - name: Setup `packer` | |
| uses: hashicorp/setup-packer@main | |
| id: setup | |
| with: | |
| version: ${{ env.PRODUCT_VERSION }} | |
| - name: Run `packer init` | |
| id: init | |
| run: "packer init ./vault_base.pkr.hcl" | |
| - name: Run `packer validate` | |
| id: validate | |
| run: "packer validate -syntax-only -evaluate-datasources ./vault_base.pkr.hcl" | |
| - name: Run `packer build` | |
| id: build | |
| run: "packer build -force -var 'project_id=${{ vars.GCP_PROJECT_ID }}' -var-file=variables_vault_base.pkrvars.hcl -var-file=variables.pkrvars.hcl ./vault_base.pkr.hcl" | |
| packer-consul-base: | |
| name: Build Consul BASE | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./hashistack | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Authenticate to Google Cloud' | |
| id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
| service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
| - name: Setup `packer` | |
| uses: hashicorp/setup-packer@main | |
| id: setup | |
| with: | |
| version: ${{ env.PRODUCT_VERSION }} | |
| - name: Run `packer init` | |
| id: init | |
| run: "packer init ./consul_base.pkr.hcl" | |
| - name: Run `packer validate` | |
| id: validate | |
| run: "packer validate -syntax-only -evaluate-datasources ./consul_base.pkr.hcl" | |
| - name: Run `packer build` | |
| id: build | |
| run: "packer build -force -var 'project_id=${{ vars.GCP_PROJECT_ID }}' -var-file=variables_consul_base.pkrvars.hcl -var-file=variables.pkrvars.hcl ./consul_base.pkr.hcl" | |
| packer-consul-server: | |
| name: Build Consul SERVER | |
| needs: packer-consul-base | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./hashistack | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Authenticate to Google Cloud' | |
| id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
| service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
| - name: Setup `packer` | |
| uses: hashicorp/setup-packer@main | |
| id: setup | |
| with: | |
| version: ${{ env.PRODUCT_VERSION }} | |
| - name: Run `packer init` | |
| id: init | |
| run: "packer init ./consul_server.pkr.hcl" | |
| - name: Run `packer validate` | |
| id: validate | |
| run: "packer validate -syntax-only -evaluate-datasources ./consul_server.pkr.hcl" | |
| - name: Run `packer build` | |
| id: build | |
| run: "packer build -force -var 'project_id=${{ vars.GCP_PROJECT_ID }}' -var-file=variables_consul_server.pkrvars.hcl -var-file=variables.pkrvars.hcl ./consul_server.pkr.hcl" | |
| packer-nomad-client: | |
| name: Build Nomad WORKER | |
| needs: packer-docker-base | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./hashistack | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Authenticate to Google Cloud' | |
| id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
| service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
| - name: Setup `packer` | |
| uses: hashicorp/setup-packer@main | |
| id: setup | |
| with: | |
| version: ${{ env.PRODUCT_VERSION }} | |
| - name: Run `packer init` | |
| id: init | |
| run: "packer init ./nomad_client.pkr.hcl" | |
| - name: Run `packer validate` | |
| id: validate | |
| run: "packer validate -syntax-only -evaluate-datasources ./nomad_client.pkr.hcl" | |
| - name: Run `packer build` | |
| id: build | |
| run: "packer build -force -var 'project_id=${{ vars.GCP_PROJECT_ID }}' -var-file=variables_nomad_client.pkrvars.hcl -var-file=variables.pkrvars.hcl ./nomad_client.pkr.hcl" | |
| packer-nomad-server: | |
| name: Build Nomad SERVER | |
| needs: packer-consul-base | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./hashistack | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Authenticate to Google Cloud' | |
| id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
| service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
| - name: Setup `packer` | |
| uses: hashicorp/setup-packer@main | |
| id: setup | |
| with: | |
| version: ${{ env.PRODUCT_VERSION }} | |
| - name: Run `packer init` | |
| id: init | |
| run: "packer init ./nomad_server.pkr.hcl" | |
| - name: Run `packer validate` | |
| id: validate | |
| run: "packer validate -syntax-only -evaluate-datasources ./nomad_server.pkr.hcl" | |
| - name: Run `packer build` | |
| id: build | |
| run: "packer build -force -var 'project_id=${{ vars.GCP_PROJECT_ID }}' -var-file=variables_nomad_server.pkrvars.hcl -var-file=variables.pkrvars.hcl ./nomad_server.pkr.hcl" |