Skip to content

Commit

Permalink
create 3rd and 4th attempts not refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
taylormonacelli committed Jan 20, 2025
1 parent b23f5a8 commit e19cd31
Showing 1 changed file with 80 additions and 4 deletions.
84 changes: 80 additions & 4 deletions .github/workflows/packer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Packer First Attempt
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: "true"
- name: Setup `packer`
Expand Down Expand Up @@ -46,11 +46,85 @@ jobs:
name: Packer Second Attempt
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: "true"
- name: Setup `packer`
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232 # v3.1.0
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232
id: setup
with:
version: ${{ env.PRODUCT_VERSION }}
- name: Run `packer init`
id: init
run: packer init .
- name: Run `packer fmt`
id: fmt
run: packer fmt -check .
- name: Run `packer validate`
id: validate
run: packer validate -syntax-only .
- name: Run `packer build`
id: build
run: packer build -force -var-file=variables.json aws-ubuntu.pkr.hcl
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }}
AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Cleanup Packer Resources
if: failure() || cancelled()
run: |
pkill packer
packer-third-attempt:
needs: packer-second-attempt
if: failure()
runs-on: ubuntu-latest
name: Packer Third Attempt
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: "true"
- name: Setup `packer`
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232
id: setup
with:
version: ${{ env.PRODUCT_VERSION }}
- name: Run `packer init`
id: init
run: packer init .
- name: Run `packer fmt`
id: fmt
run: packer fmt -check .
- name: Run `packer validate`
id: validate
run: packer validate -syntax-only .
- name: Run `packer build`
id: build
run: packer build -force -var-file=variables.json aws-ubuntu.pkr.hcl
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }}
AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Cleanup Packer Resources
if: failure() || cancelled()
run: |
pkill packer
packer-fourth-attempt:
needs: packer-third-attempt
if: failure()
runs-on: ubuntu-latest
name: Packer Fourth Attempt
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: "true"
- name: Setup `packer`
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232
id: setup
with:
version: ${{ env.PRODUCT_VERSION }}
Expand Down Expand Up @@ -81,9 +155,11 @@ jobs:
needs:
- packer-first-attempt
- packer-second-attempt
- packer-third-attempt
- packer-fourth-attempt
if: |
always() &&
(needs.packer-first-attempt.result == 'success' || needs.packer-second-attempt.result == 'success')
(needs.packer-first-attempt.result == 'success' || needs.packer-second-attempt.result == 'success' || needs.packer-third-attempt.result == 'success' || needs.packer-fourth-attempt.result == 'success')
runs-on: ubuntu-latest
steps:
- run: echo "All tests passed!"

0 comments on commit e19cd31

Please sign in to comment.