Skip to content

Commit

Permalink
Add manifest.json generation to Packer
Browse files Browse the repository at this point in the history
Signed-off-by: peterdeme <[email protected]>
  • Loading branch information
peterdeme committed Oct 24, 2023
1 parent 04f3a61 commit f52637d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build_aws_scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/checkout@main

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
uses: actions/checkout@main

- name: Configure GovCloud AWS credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.GOVCLOUD_AWS_REGION }}
role-to-assume: ${{ secrets.GOVCLOUD_AWS_ROLE_ARN }}
Expand All @@ -95,3 +95,10 @@ jobs:
PKR_VAR_ami_name_prefix: spacelift-${{ needs.timestamp.outputs.timestamp }}
PKR_VAR_source_ami_architecture: ${{ matrix.arch }}
PKR_VAR_instance_type: ${{ matrix.arch == 'x86_64' && 't3.micro' || 't4g.micro' }}

- name: Upload manifest
uses: actions/upload-artifact@v3
with:
path: manifest_aws.json
name: manifest_aws.json
retention-days: 5
9 changes: 8 additions & 1 deletion .github/workflows/build_gcp_azure_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/checkout@main

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
Expand Down Expand Up @@ -102,3 +102,10 @@ jobs:
gcloud compute images add-iam-policy-binding ${PKR_VAR_image_base_name}-us-${PKR_VAR_suffix} --member='allAuthenticatedUsers' --role='roles/compute.imageUser'
gcloud compute images add-iam-policy-binding ${PKR_VAR_image_base_name}-eu-${PKR_VAR_suffix} --member='allAuthenticatedUsers' --role='roles/compute.imageUser'
gcloud compute images add-iam-policy-binding ${PKR_VAR_image_base_name}-asia-${PKR_VAR_suffix} --member='allAuthenticatedUsers' --role='roles/compute.imageUser'
- name: Upload manifest
uses: actions/upload-artifact@v3
with:
path: manifest_${{ matrix.cloud }}.json
name: manifest_${{ matrix.cloud }}.json
retention-days: 5
4 changes: 4 additions & 0 deletions aws.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,8 @@ build {
tag_value = "Spacelift AMI"
keep_releases = 180
}

post-processor "manifest" {
output = "manifest_aws.json"
}
}
4 changes: 4 additions & 0 deletions azure.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,8 @@ build {
]
inline_shebang = "/bin/sh -x"
}

post-processor "manifest" {
output = "manifest_azure.json"
}
}
4 changes: 4 additions & 0 deletions gcp.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,8 @@ build {
"shared/scripts/apt-install-jq.sh",
]
}

post-processor "manifest" {
output = "manifest_gcp.json"
}
}

0 comments on commit f52637d

Please sign in to comment.