v0.7.0, updated Nomad and Consul versions, added Java runtime install… #18
This file contains 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] | |
paths-ignore: ['**/README.md','**/CHANGELOG.md', 'terraform/*'] | |
env: | |
PRODUCT_VERSION: "1.9.4" # or: "latest" | |
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@v3 | |
- name: 'Authenticate to Google Cloud' | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
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 ./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-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@v3 | |
- name: 'Authenticate to Google Cloud' | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
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@v3 | |
- name: 'Authenticate to Google Cloud' | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
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@v3 | |
- name: 'Authenticate to Google Cloud' | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
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@v3 | |
- name: 'Authenticate to Google Cloud' | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
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" |