From a7e6d13fe98c4a3df56b95836b7f2a69b930538c Mon Sep 17 00:00:00 2001 From: peterdeme Date: Tue, 24 Oct 2023 11:46:05 +0200 Subject: [PATCH] Add `manifest.json` generation to Packer Signed-off-by: peterdeme --- .github/workflows/build_aws_scheduled.yml | 5 +++++ .github/workflows/build_gcp_azure_manual.yml | 7 ++++++- aws.pkr.hcl | 4 ++++ azure.pkr.hcl | 4 ++++ gcp.pkr.hcl | 4 ++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_aws_scheduled.yml b/.github/workflows/build_aws_scheduled.yml index 76d8049..e1eb3ef 100644 --- a/.github/workflows/build_aws_scheduled.yml +++ b/.github/workflows/build_aws_scheduled.yml @@ -95,3 +95,8 @@ 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 diff --git a/.github/workflows/build_gcp_azure_manual.yml b/.github/workflows/build_gcp_azure_manual.yml index 9cd55a2..803b353 100644 --- a/.github/workflows/build_gcp_azure_manual.yml +++ b/.github/workflows/build_gcp_azure_manual.yml @@ -101,4 +101,9 @@ jobs: run: | 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' + 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 diff --git a/aws.pkr.hcl b/aws.pkr.hcl index 33e40c4..b006444 100644 --- a/aws.pkr.hcl +++ b/aws.pkr.hcl @@ -159,4 +159,8 @@ build { tag_value = "Spacelift AMI" keep_releases = 180 } + + post-processor "manifest" { + output = "manifest_aws.json" + } } diff --git a/azure.pkr.hcl b/azure.pkr.hcl index 4ba831f..34f6b89 100644 --- a/azure.pkr.hcl +++ b/azure.pkr.hcl @@ -150,4 +150,8 @@ build { ] inline_shebang = "/bin/sh -x" } + + post-processor "manifest" { + output = "manifest_azure.json" + } } diff --git a/gcp.pkr.hcl b/gcp.pkr.hcl index 4ee4778..422cb6d 100644 --- a/gcp.pkr.hcl +++ b/gcp.pkr.hcl @@ -80,4 +80,8 @@ build { "shared/scripts/apt-install-jq.sh", ] } + + post-processor "manifest" { + output = "manifest_gcp.json" + } }