2022-11-04 11:48:52 -04:00
|
|
|
name: Determine OS image upload variables
|
|
|
|
description: "Determine parameters used for image upload to various CSPs."
|
|
|
|
inputs:
|
|
|
|
csp:
|
|
|
|
description: "Cloud Service Provider"
|
|
|
|
required: true
|
|
|
|
uploadVariant:
|
|
|
|
description: "Upload variant"
|
|
|
|
required: true
|
|
|
|
basePath:
|
|
|
|
description: "Base path to the image build directory"
|
|
|
|
required: true
|
|
|
|
imageVersion:
|
|
|
|
description: "Semantic version including patch e.g. v<major>.<minor>.<patch> (only used for releases)"
|
|
|
|
required: false
|
|
|
|
imageType:
|
|
|
|
description: "Type of image to build"
|
|
|
|
required: true
|
|
|
|
debug:
|
|
|
|
description: "Build debug image"
|
|
|
|
required: false
|
|
|
|
default: "false"
|
|
|
|
outputs:
|
|
|
|
awsRegion:
|
|
|
|
description: "Primary AWS region"
|
|
|
|
value: ${{ steps.aws.outputs.region }}
|
|
|
|
awsReplicationRegions:
|
|
|
|
description: "AWS regions to replicate the image to"
|
|
|
|
value: ${{ steps.aws.outputs.replicationRegions }}
|
|
|
|
awsBucket:
|
|
|
|
description: "AWS S3 bucket to upload the image to"
|
|
|
|
value: ${{ steps.aws.outputs.bucket }}
|
|
|
|
awsEfivarsPath:
|
|
|
|
description: "AWS efivars path"
|
|
|
|
value: ${{ steps.aws.outputs.efivarsPath }}
|
|
|
|
awsImagePath:
|
|
|
|
description: "AWS image path"
|
|
|
|
value: ${{ steps.aws.outputs.imagePath }}
|
2022-11-16 09:45:10 -05:00
|
|
|
awsJsonOutput:
|
|
|
|
description: "AWS ami json output path"
|
|
|
|
value: ${{ steps.aws.outputs.jsonOutput }}
|
2022-11-04 11:48:52 -04:00
|
|
|
awsImageFilename:
|
|
|
|
description: "AWS raw image filename"
|
|
|
|
value: ${{ steps.aws.outputs.imageFilename }}
|
|
|
|
awsImageName:
|
|
|
|
description: "AWS image name"
|
|
|
|
value: ${{ steps.aws.outputs.imageName }}
|
2022-11-09 05:49:04 -05:00
|
|
|
awsPublish:
|
|
|
|
description: "Should AWS AMI be published"
|
|
|
|
value: ${{ steps.aws.outputs.publish }}
|
2022-11-04 11:48:52 -04:00
|
|
|
azureResourceGroupName:
|
|
|
|
description: "Azure resource group name"
|
|
|
|
value: ${{ steps.azure.outputs.resourceGroupName }}
|
|
|
|
azureRegion:
|
|
|
|
description: "Primary Azure region"
|
|
|
|
value: ${{ steps.azure.outputs.region }}
|
|
|
|
azureReplicationRegions:
|
|
|
|
description: "Azure regions to replicate the image to"
|
|
|
|
value: ${{ steps.azure.outputs.replicationRegions }}
|
|
|
|
azureVmgsRegion:
|
|
|
|
description: "Azure VMGS region (AWS S3 bucket region where VMGS blob is stored)"
|
|
|
|
value: ${{ steps.azure.outputs.vmgsRegion }}
|
|
|
|
azureSku:
|
|
|
|
description: "Azure SIG SKU"
|
|
|
|
value: ${{ steps.azure.outputs.sku }}
|
|
|
|
azurePublisher:
|
|
|
|
description: "Azure SIG publisher"
|
|
|
|
value: ${{ steps.azure.outputs.publisher }}
|
|
|
|
azureRawImagePath:
|
|
|
|
description: "Azure raw image path"
|
|
|
|
value: ${{ steps.azure.outputs.rawImagePath }}
|
|
|
|
azureImagePath:
|
|
|
|
description: "Azure image path"
|
|
|
|
value: ${{ steps.azure.outputs.imagePath }}
|
2022-11-16 09:45:10 -05:00
|
|
|
azureJsonOutput:
|
|
|
|
description: "Azure image json output path"
|
|
|
|
value: ${{ steps.azure.outputs.jsonOutput }}
|
2022-11-04 11:48:52 -04:00
|
|
|
azureSecurityType:
|
|
|
|
description: "Azure security type"
|
|
|
|
value: ${{ steps.azure.outputs.securityType }}
|
|
|
|
azureDiskName:
|
|
|
|
description: "Azure disk name"
|
|
|
|
value: ${{ steps.azure.outputs.diskName }}
|
|
|
|
azureImageDefinition:
|
|
|
|
description: "Azure image definition"
|
|
|
|
value: ${{ steps.azure.outputs.imageDefinition }}
|
2022-11-07 07:22:54 -05:00
|
|
|
azureImageOffer:
|
|
|
|
description: "Azure image offer"
|
|
|
|
value: ${{ steps.azure.outputs.imageOffer }}
|
2022-11-04 11:48:52 -04:00
|
|
|
azureImageVersion:
|
|
|
|
description: "Azure image version"
|
|
|
|
value: ${{ steps.azure.outputs.imageVersion }}
|
|
|
|
azureGalleryName:
|
|
|
|
description: "Azure gallery name"
|
|
|
|
value: ${{ steps.azure.outputs.galleryName }}
|
|
|
|
azureVmgsPath:
|
|
|
|
description: "Azure VMGS path"
|
|
|
|
value: ${{ steps.azure.outputs.vmgsPath }}
|
|
|
|
gcpProject:
|
|
|
|
description: "GCP project"
|
|
|
|
value: ${{ steps.gcp.outputs.project }}
|
|
|
|
gcpBucket:
|
|
|
|
description: "GCP bucket"
|
|
|
|
value: ${{ steps.gcp.outputs.bucket }}
|
|
|
|
gcpRegion:
|
|
|
|
description: "GCP region"
|
|
|
|
value: ${{ steps.gcp.outputs.region }}
|
|
|
|
gcpRawImagePath:
|
|
|
|
description: "GCP raw image path"
|
|
|
|
value: ${{ steps.gcp.outputs.rawImagePath }}
|
|
|
|
gcpImagePath:
|
|
|
|
description: "GCP image path"
|
|
|
|
value: ${{ steps.gcp.outputs.imagePath }}
|
2022-11-16 09:45:10 -05:00
|
|
|
gcpJsonOutput:
|
|
|
|
description: "GCP image json output path"
|
|
|
|
value: ${{ steps.gcp.outputs.jsonOutput }}
|
2022-11-04 11:48:52 -04:00
|
|
|
gcpImageName:
|
|
|
|
description: "GCP image name"
|
|
|
|
value: ${{ steps.gcp.outputs.imageName }}
|
|
|
|
gcpImageFilename:
|
|
|
|
description: "GCP image filename"
|
|
|
|
value: ${{ steps.gcp.outputs.imageFilename }}
|
|
|
|
gcpImageFamily:
|
|
|
|
description: "GCP image family"
|
|
|
|
value: ${{ steps.gcp.outputs.imageFamily }}
|
2022-11-16 09:45:10 -05:00
|
|
|
qemuJsonOutput:
|
|
|
|
description: "QEMU image json output path"
|
|
|
|
value: ${{ steps.qemu.outputs.jsonOutput }}
|
|
|
|
qemuBucket:
|
|
|
|
description: "QEMU S3 bucket"
|
|
|
|
value: ${{ steps.qemu.outputs.bucket }}
|
|
|
|
qemuBaseUrl:
|
|
|
|
description: "QEMU raw image base URL"
|
|
|
|
value: ${{ steps.qemu.outputs.baseUrl }}
|
|
|
|
qemuImagePath:
|
|
|
|
description: "QEMU image path"
|
|
|
|
value: ${{ steps.qemu.outputs.imagePath }}
|
2022-11-04 11:48:52 -04:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Determine version
|
|
|
|
id: version
|
|
|
|
uses: ./.github/actions/pseudo_version
|
|
|
|
|
|
|
|
- name: Configure AWS input variables
|
|
|
|
id: aws
|
|
|
|
if: ${{ inputs.csp == 'aws' }}
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
basePath: ${{ inputs.basePath }}
|
|
|
|
imageVersion: ${{ inputs.imageVersion }}
|
|
|
|
imageType: ${{ inputs.imageType }}
|
|
|
|
timestamp: ${{ steps.version.outputs.timestamp }}
|
|
|
|
semver: ${{ steps.version.outputs.semanticVersion }}
|
|
|
|
branchName: ${{ steps.version.outputs.branchName }}
|
|
|
|
run: |
|
|
|
|
echo "region=eu-central-1" >> $GITHUB_OUTPUT
|
|
|
|
echo "replicationRegions=us-east-2 ap-south-1" >> $GITHUB_OUTPUT
|
|
|
|
echo "bucket=constellation-images" >> $GITHUB_OUTPUT
|
2022-11-17 06:12:00 -05:00
|
|
|
echo "efivarsPath=${basePath}/mkosi.output.aws/fedora~37/efivars.bin" >> $GITHUB_OUTPUT
|
|
|
|
echo "imagePath=${basePath}/mkosi.output.aws/fedora~37/image.raw" >> $GITHUB_OUTPUT
|
|
|
|
echo "jsonOutput=${basePath}/mkosi.output.aws/fedora~37/image-upload.json" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
echo "imageFilename=image-$(date +%s).raw" >> $GITHUB_OUTPUT
|
|
|
|
if [ "${imageType}" = release ]
|
|
|
|
then
|
|
|
|
echo "imageName=constellation-${imageVersion}" >> $GITHUB_OUTPUT
|
2022-11-09 05:49:04 -05:00
|
|
|
echo "publish=true" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
elif [ "${imageType}" = debug ]
|
|
|
|
then
|
|
|
|
echo "imageName=constellation-debug-${semver}-${timestamp}" >> $GITHUB_OUTPUT
|
2022-11-09 05:49:04 -05:00
|
|
|
echo "publish=false" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
else
|
|
|
|
echo "imageName=constellation-${branchName}-${timestamp}" >> $GITHUB_OUTPUT
|
2022-11-09 05:49:04 -05:00
|
|
|
echo "publish=false" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# gallery name may include alphanumeric characters, dots and underscores. Must end and begin with an alphanumeric character
|
|
|
|
# image definition may include alphanumeric characters, dots, dashes and underscores. Must end and begin with an alphanumeric character
|
|
|
|
# image version has to be semantic version in the form <uint>.<uint>.<uint> . uint may not be larger than 2,147,483,647
|
|
|
|
- name: Configure Azure input variables
|
|
|
|
id: azure
|
|
|
|
if: ${{ inputs.csp == 'azure' }}
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
basePath: ${{ inputs.basePath }}
|
|
|
|
imageVersion: ${{ inputs.imageVersion }}
|
|
|
|
imageType: ${{ inputs.imageType }}
|
|
|
|
timestamp: ${{ steps.version.outputs.timestamp }}
|
|
|
|
semver: ${{ steps.version.outputs.semanticVersion }}
|
|
|
|
pseudover: ${{ steps.version.outputs.pseudoVersion }}
|
|
|
|
branchName: ${{ steps.version.outputs.branchName }}
|
2022-11-16 09:45:10 -05:00
|
|
|
uploadVariant: ${{ inputs.uploadVariant }}
|
2022-11-04 11:48:52 -04:00
|
|
|
run: |
|
|
|
|
echo "resourceGroupName=constellation-images" >> $GITHUB_OUTPUT
|
|
|
|
echo "region=northeurope" >> $GITHUB_OUTPUT
|
|
|
|
echo "vmgsRegion=eu-central-1" >> $GITHUB_OUTPUT
|
|
|
|
echo "replicationRegions=northeurope eastus westeurope westus" >> $GITHUB_OUTPUT
|
|
|
|
echo "sku=constellation" >> $GITHUB_OUTPUT
|
|
|
|
echo "publisher=edgelesssys" >> $GITHUB_OUTPUT
|
2022-11-17 06:12:00 -05:00
|
|
|
echo "rawImagePath=${basePath}/mkosi.output.azure/fedora~37/image.raw" >> $GITHUB_OUTPUT
|
|
|
|
echo "imagePath=${basePath}/mkosi.output.azure/fedora~37/image.vhd" >> $GITHUB_OUTPUT
|
|
|
|
echo "jsonOutput=${basePath}/mkosi.output.azure/fedora~37/image-upload${uploadVariant}.json" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
# TODO: set default security type to "ConfidentialVM" once replication is possible
|
|
|
|
securityType=${{ inputs.uploadVariant }}
|
|
|
|
if [ -z "${securityType}" ]; then
|
|
|
|
securityType=ConfidentialVMSupported
|
|
|
|
fi
|
|
|
|
echo "securityType=${securityType}" >> $GITHUB_OUTPUT
|
|
|
|
echo "diskName=constellation-${pseudover//./-}-${securityType,,}" >> $GITHUB_OUTPUT
|
|
|
|
if [ "${imageType}" = release ]
|
|
|
|
then
|
|
|
|
echo "imageDefinition=constellation" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageOffer=constellation" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageVersion=${imageVersion:1}" >> $GITHUB_OUTPUT
|
|
|
|
galleryName=Constellation
|
|
|
|
elif [ "${imageType}" = debug ]
|
|
|
|
then
|
|
|
|
echo "imageDefinition=${semver}" >> $GITHUB_OUTPUT
|
2022-11-10 03:12:38 -05:00
|
|
|
echo "imageOffer=${semver}" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
echo "imageVersion=${timestamp:0:4}.${timestamp:4:4}.${timestamp:8}" >> $GITHUB_OUTPUT
|
|
|
|
galleryName=Constellation_Debug
|
|
|
|
else
|
|
|
|
echo "imageDefinition=${branchName}" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageOffer=${branchName}" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageVersion=${timestamp:0:4}.${timestamp:4:4}.${timestamp:8}" >> $GITHUB_OUTPUT
|
|
|
|
galleryName=Constellation_Testing
|
|
|
|
fi
|
|
|
|
# TODO: enable VMGS upload for ConfidentialVM images once replication is possible
|
|
|
|
if [ "${securityType}" == "ConfidentialVMSupported" ]; then
|
|
|
|
echo "galleryName=${galleryName}_CVM" >> $GITHUB_OUTPUT
|
|
|
|
echo "vmgsPath=" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "galleryName=${galleryName}" >> $GITHUB_OUTPUT
|
|
|
|
echo "vmgsPath=${basePath}/pki/${securityType}.vmgs" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
|
|
|
|
|
|
|
# image family and image name may include lowercase alphanumeric characters and dashes.
|
|
|
|
# Must not end or begin with a dash
|
|
|
|
- name: Configure GCP input variables
|
|
|
|
id: gcp
|
|
|
|
if: ${{ inputs.csp == 'gcp' }}
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
basePath: ${{ inputs.basePath }}
|
|
|
|
imageVersion: ${{ inputs.imageVersion }}
|
|
|
|
imageType: ${{ inputs.imageType }}
|
|
|
|
timestamp: ${{ steps.version.outputs.timestamp }}
|
|
|
|
semver: ${{ steps.version.outputs.semanticVersion }}
|
|
|
|
branchName: ${{ steps.version.outputs.branchName }}
|
|
|
|
run: |
|
|
|
|
echo "project=constellation-images" >> $GITHUB_OUTPUT
|
|
|
|
echo "bucket=constellation-images" >> $GITHUB_OUTPUT
|
|
|
|
echo "region=europe-west3" >> $GITHUB_OUTPUT
|
2022-11-17 06:12:00 -05:00
|
|
|
echo "rawImagePath=${basePath}/mkosi.output.gcp/fedora~37/image.raw" >> $GITHUB_OUTPUT
|
|
|
|
echo "imagePath=${basePath}/mkosi.output.gcp/fedora~37/image.tar.gz" >> $GITHUB_OUTPUT
|
|
|
|
echo "jsonOutput=${basePath}/mkosi.output.gcp/fedora~37/image-upload.json" >> $GITHUB_OUTPUT
|
2022-11-04 11:48:52 -04:00
|
|
|
if [ "${imageType}" = release ]
|
|
|
|
then
|
|
|
|
echo "imageName=constellation-${imageVersion//./-}" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageFilename=constellation-${imageVersion//./-}.tar.gz" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageFamily=constellation" >> $GITHUB_OUTPUT
|
|
|
|
elif [ "${imageType}" = debug ]
|
|
|
|
then
|
|
|
|
echo "imageName=constellation-${timestamp}" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageFilename=constellation-${timestamp}.tar.gz" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageFamily=constellation-debug-${semver//./-}" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "imageName=constellation-${timestamp}" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageFilename=constellation-${timestamp}.tar.gz" >> $GITHUB_OUTPUT
|
|
|
|
echo "imageFamily=constellation-${branchName}" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
2022-11-16 09:45:10 -05:00
|
|
|
|
|
|
|
- name: Configure QEMU input variables
|
|
|
|
id: qemu
|
|
|
|
if: ${{ inputs.csp == 'qemu' }}
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
basePath: ${{ inputs.basePath }}
|
|
|
|
run: |
|
2022-11-17 10:14:38 -05:00
|
|
|
echo "bucket=cdn-constellation-backend" >> $GITHUB_OUTPUT
|
2022-11-16 09:45:10 -05:00
|
|
|
echo "baseUrl=https://cdn.confidential.cloud" >> $GITHUB_OUTPUT
|
2022-11-17 06:12:00 -05:00
|
|
|
echo "imagePath=${basePath}/mkosi.output.qemu/fedora~37/image.raw" >> $GITHUB_OUTPUT
|
|
|
|
echo "jsonOutput=${basePath}/mkosi.output.qemu/fedora~37/image-upload.json" >> $GITHUB_OUTPUT
|