Only publish release AMIs

This commit is contained in:
Malte Poll 2022-11-09 11:49:04 +01:00 committed by Malte Poll
parent a96f07dbdd
commit e9fecec0bc
3 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,9 @@ outputs:
awsImageName:
description: "AWS image name"
value: ${{ steps.aws.outputs.imageName }}
awsPublish:
description: "Should AWS AMI be published"
value: ${{ steps.aws.outputs.publish }}
azureResourceGroupName:
description: "Azure resource group name"
value: ${{ steps.azure.outputs.resourceGroupName }}
@ -144,11 +147,14 @@ runs:
if [ "${imageType}" = release ]
then
echo "imageName=constellation-${imageVersion}" >> $GITHUB_OUTPUT
echo "publish=true" >> $GITHUB_OUTPUT
elif [ "${imageType}" = debug ]
then
echo "imageName=constellation-debug-${semver}-${timestamp}" >> $GITHUB_OUTPUT
echo "publish=false" >> $GITHUB_OUTPUT
else
echo "imageName=constellation-${branchName}-${timestamp}" >> $GITHUB_OUTPUT
echo "publish=false" >> $GITHUB_OUTPUT
fi
# gallery name may include alphanumeric characters, dots and underscores. Must end and begin with an alphanumeric character

View File

@ -336,6 +336,7 @@ jobs:
AWS_IMAGE_PATH: ${{ steps.vars.outputs.awsImagePath }}
AWS_REGION: ${{ steps.vars.outputs.awsRegion }}
AWS_REPLICATION_REGIONS: ${{ steps.vars.outputs.awsReplicationRegions }}
AWS_PUBLISH: ${{ steps.vars.outputs.awsPublish }}
- name: Upload GCP image
shell: bash

View File

@ -87,6 +87,9 @@ tag_ami_with_backing_snapshot() {
make_ami_public() {
local ami_id=$1
local region=$2
if [ "${AWS_PUBLISH-}" != "true" ]; then
return
fi
aws ec2 modify-image-attribute \
--region "${region}" \
--image-id "${ami_id}" \