2022-08-03 10:01:36 -04:00
|
|
|
name: Build and Upload CoreOS image
|
2022-03-22 11:03:15 -04:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2022-08-03 10:01:36 -04:00
|
|
|
coreOSConfigBranch:
|
2022-08-05 09:16:00 -04:00
|
|
|
description: "Branch of CoreOS config repo to build from"
|
|
|
|
default: "constellation"
|
2022-08-03 10:01:36 -04:00
|
|
|
required: false
|
|
|
|
debug:
|
2022-08-05 09:16:00 -04:00
|
|
|
description: "Build debug image"
|
2022-08-03 10:01:36 -04:00
|
|
|
type: boolean
|
|
|
|
default: false
|
2022-08-30 09:54:35 -04:00
|
|
|
required: false
|
2022-03-22 11:03:15 -04:00
|
|
|
|
|
|
|
jobs:
|
2022-08-04 03:24:21 -04:00
|
|
|
build-coreos-image:
|
2022-08-05 09:16:00 -04:00
|
|
|
name: "Build CoreOS using customized COSA"
|
2022-03-22 11:03:15 -04:00
|
|
|
runs-on: [self-hosted, linux, nested-virt]
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
|
|
|
env:
|
|
|
|
SHELL: /bin/bash
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-07-20 04:48:01 -04:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
2022-03-22 11:03:15 -04:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
token: ${{ secrets.CI_GITHUB_REPOSITORY }}
|
|
|
|
|
2022-08-03 10:01:36 -04:00
|
|
|
- name: Build bootstrapper
|
|
|
|
if: ${{ inputs.debug == false }}
|
|
|
|
uses: ./.github/actions/build_bootstrapper
|
|
|
|
with:
|
|
|
|
outputPath: ${{ github.workspace }}/build/bootstrapper
|
|
|
|
|
|
|
|
- name: Build debugd
|
|
|
|
if: ${{ inputs.debug == true }}
|
|
|
|
uses: ./.github/actions/build_debugd
|
|
|
|
with:
|
|
|
|
outputPath: ${{ github.workspace }}/build/bootstrapper
|
|
|
|
|
|
|
|
- name: Build disk-mapper
|
|
|
|
uses: ./.github/actions/build_disk_mapper
|
|
|
|
with:
|
|
|
|
outputPath: ${{ github.workspace }}/build/disk-mapper
|
2022-08-05 09:16:00 -04:00
|
|
|
|
2022-08-03 10:01:36 -04:00
|
|
|
- name: Determine version
|
|
|
|
id: version
|
|
|
|
uses: ./.github/actions/pseudo_version
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
- name: Log in to the Container registry
|
2022-07-21 03:45:54 -04:00
|
|
|
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
|
2022-03-22 11:03:15 -04:00
|
|
|
with:
|
2022-08-03 10:01:36 -04:00
|
|
|
registry: ghcr.io
|
2022-03-22 11:03:15 -04:00
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2022-08-03 10:01:36 -04:00
|
|
|
- name: Install Azure CLI
|
|
|
|
shell: bash
|
2022-03-22 11:03:15 -04:00
|
|
|
run: |
|
2022-07-07 05:37:40 -04:00
|
|
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
2022-03-22 11:03:15 -04:00
|
|
|
wget -q https://aka.ms/downloadazcopy-v10-linux -O azcopy.tar.gz
|
|
|
|
tar --strip-components 1 -xf azcopy.tar.gz
|
|
|
|
rm azcopy.tar.gz
|
|
|
|
echo "$(pwd)" >> $GITHUB_PATH
|
|
|
|
|
2022-07-20 04:48:01 -04:00
|
|
|
- name: Login to Azure
|
|
|
|
uses: azure/login@24848bc889cfc0a8313c2b3e378ac0d625b9bc16
|
2022-03-22 11:03:15 -04:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
|
|
|
|
2022-08-03 10:01:36 -04:00
|
|
|
- name: Store GH token to be mounted by cosa
|
|
|
|
shell: bash
|
2022-03-22 11:03:15 -04:00
|
|
|
run: echo "machine github.com login api password ${{ secrets.CI_GITHUB_REPOSITORY }}" > /tmp/.netrc
|
|
|
|
|
2022-08-03 10:01:36 -04:00
|
|
|
# Make sure to set valid names for GCP and Azure
|
|
|
|
# Azure
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# GCP
|
|
|
|
# image family and image name may include lowercase alphanumeric characters and dashes. Must not end or begin with a dash
|
|
|
|
- name: Configure input variables
|
|
|
|
shell: bash
|
2022-03-22 11:03:15 -04:00
|
|
|
run: |
|
2022-08-03 10:01:36 -04:00
|
|
|
timestamp=${{ steps.version.outputs.timestamp }}
|
|
|
|
semver=${{ steps.version.outputs.semanticVersion }}
|
2022-08-19 09:55:44 -04:00
|
|
|
releaseVersion=${{ steps.version.outputs.releaseVersion }}
|
2022-08-03 10:01:36 -04:00
|
|
|
pseudover=${{ steps.version.outputs.pseudoVersion }}
|
|
|
|
echo "azureImageName=constellation-${pseudover//./-}" >> $GITHUB_ENV
|
2022-08-04 03:24:21 -04:00
|
|
|
if [ "${{ startsWith(github.ref, 'refs/heads/release/') && (inputs.debug == false) }}" = true ]
|
2022-08-03 10:01:36 -04:00
|
|
|
then
|
2022-08-19 09:55:44 -04:00
|
|
|
echo "gcpImageName=constellation-${releaseVersion//./-}" >> $GITHUB_ENV
|
2022-08-03 10:01:36 -04:00
|
|
|
echo "gcpImageFamily=constellation" >> $GITHUB_ENV
|
|
|
|
echo "azureGalleryName=Constellation" >> $GITHUB_ENV
|
|
|
|
echo "azureImageDefinition=constellation" >> $GITHUB_ENV
|
2022-08-19 09:55:44 -04:00
|
|
|
echo "azureImageVersion=${releaseVersion:1}" >> $GITHUB_ENV
|
2022-08-04 03:24:21 -04:00
|
|
|
elif [ "${{ ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/heads/release/')) && (inputs.debug == true) }}" = true ]
|
2022-08-03 10:01:36 -04:00
|
|
|
then
|
2022-08-05 09:16:00 -04:00
|
|
|
echo "gcpImageName=constellation-${{ steps.version.outputs.timestamp }}" >> $GITHUB_ENV
|
2022-08-03 10:01:36 -04:00
|
|
|
echo "gcpImageFamily=constellation-debug-${semver//./-}" >> $GITHUB_ENV
|
|
|
|
echo "azureGalleryName=Constellation_Debug" >> $GITHUB_ENV
|
|
|
|
echo "azureImageDefinition=${semver}" >> $GITHUB_ENV
|
|
|
|
echo "azureImageVersion=${timestamp:0:4}.${timestamp:4:4}.${timestamp:8}" >> $GITHUB_ENV
|
|
|
|
else
|
2022-08-04 03:24:21 -04:00
|
|
|
echo "gcpImageName=constellation-${{ steps.version.outputs.timestamp }}" >> $GITHUB_ENV
|
|
|
|
echo "gcpImageFamily=constellation-${{ steps.version.outputs.branchName }}" >> $GITHUB_ENV
|
2022-08-03 10:01:36 -04:00
|
|
|
echo "azureGalleryName=Constellation_Testing" >> $GITHUB_ENV
|
|
|
|
echo "azureImageDefinition=${{ steps.version.outputs.branchName }}" >> $GITHUB_ENV
|
|
|
|
echo "azureImageVersion=${timestamp:0:4}.${timestamp:4:4}.${timestamp:8}" >> $GITHUB_ENV
|
|
|
|
fi
|
2022-03-22 11:03:15 -04:00
|
|
|
|
2022-08-03 10:01:36 -04:00
|
|
|
- name: Build and Upload
|
|
|
|
id: build-and-upload
|
|
|
|
shell: bash {0}
|
|
|
|
run: |
|
2022-08-02 11:14:13 -04:00
|
|
|
make cosa-image
|
2022-08-03 10:01:36 -04:00
|
|
|
make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc \
|
|
|
|
COSA_INIT_BRANCH="${{ inputs.coreOSConfigBranch }}" \
|
|
|
|
GCP_IMAGE_NAME="${{ env.gcpImageName }}" GCP_IMAGE_FAMILY="${{ env.gcpImageFamily }}" \
|
|
|
|
AZURE_IMAGE_DEFINITION="${{ env.azureImageDefinition }}" AZURE_IMAGE_VERSION="${{ env.azureImageVersion }}" AZURE_GALLERY_NAME="${{ env.azureGalleryName }}" AZURE_IMAGE_NAME="${{ env.azureImageName }}"\
|
|
|
|
image-gcp image-azure upload-gcp upload-azure
|
|
|
|
working-directory: ${{ github.workspace }}/image
|