2022-03-22 11:03:15 -04:00
|
|
|
name: Build and Upload CoreOS
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
2022-07-07 08:48:04 -04:00
|
|
|
AZ_CLI_VERSION: 2.37.0
|
2022-03-22 11:03:15 -04:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2022-06-29 09:26:29 -04:00
|
|
|
bootstrapper-name:
|
|
|
|
description: bootstrapper name
|
2022-03-22 11:03:15 -04:00
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
2022-06-29 09:26:29 -04:00
|
|
|
bootstrapper-name:
|
2022-03-22 11:03:15 -04:00
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
secrets:
|
|
|
|
CI_GITHUB_REPOSITORY:
|
|
|
|
required: true
|
|
|
|
AWS_ACCESS_KEY_ID:
|
|
|
|
required: true
|
|
|
|
AWS_SECRET_ACCESS_KEY:
|
|
|
|
required: true
|
|
|
|
AWS_DEFAULT_REGION:
|
|
|
|
required: true
|
|
|
|
BUCKET_NAME:
|
|
|
|
required: true
|
|
|
|
PUBLIC_BUCKET_NAME:
|
|
|
|
required: true
|
|
|
|
AZURE_CREDENTIALS:
|
|
|
|
required: true
|
|
|
|
|
|
|
|
jobs:
|
2022-07-20 04:48:01 -04:00
|
|
|
build-coreos:
|
2022-03-22 11:03:15 -04:00
|
|
|
name: "Build CoreOS using customized COSA"
|
|
|
|
runs-on: [self-hosted, linux, nested-virt]
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
env:
|
2022-04-19 06:12:34 -04:00
|
|
|
working-directory: ${{ github.workspace }}/image
|
2022-03-22 11:03:15 -04:00
|
|
|
SHELL: /bin/bash
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
id: 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 }}
|
|
|
|
|
|
|
|
- name: Log in to the Container registry
|
|
|
|
id: docker-login
|
2022-07-21 03:45:54 -04:00
|
|
|
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
|
2022-03-22 11:03:15 -04:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: "Install azure CLI"
|
|
|
|
run: |
|
2022-07-07 05:37:40 -04:00
|
|
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
2022-07-07 08:56:01 -04:00
|
|
|
sudo apt-get install -y --allow-downgrades "azure-cli=${AZ_CLI_VERSION}-1~$(lsb_release -sc)"
|
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-04-07 09:40:51 -04:00
|
|
|
- name: Setup Go environment
|
2022-07-20 04:48:01 -04:00
|
|
|
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a
|
2022-04-07 09:40:51 -04:00
|
|
|
with:
|
|
|
|
go-version: "1.18"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt-get update && sudo apt-get install -y pkg-config libcryptsetup12 libcryptsetup-dev
|
|
|
|
|
|
|
|
- name: "Compile disk-mapper"
|
|
|
|
run: |
|
|
|
|
mkdir -p ${{ github.workspace }}/build
|
|
|
|
GOCACHE=/home/github-actions-runner-user/.cache/go-build GOPATH=/home/github-actions-runner-user/go GOPRIVATE=github.com/edgelesssys GOMODCACHE=/home/github-actions-runner-user/.cache/go-mod go build -o ${{ github.workspace }}/build/disk-mapper -ldflags "-s -w"
|
|
|
|
working-directory: ${{ github.workspace }}/state/cmd
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
- name: "Store GH token to be mounted by cosa"
|
|
|
|
run: echo "machine github.com login api password ${{ secrets.CI_GITHUB_REPOSITORY }}" > /tmp/.netrc
|
|
|
|
|
|
|
|
- name: "Set image timestamp"
|
|
|
|
run: |
|
|
|
|
TIMESTAMP=$(date +%s)
|
|
|
|
echo "TIMESTAMP=${TIMESTAMP}" >> $GITHUB_ENV
|
|
|
|
echo "IMAGE_TIMESTAMP=constellation-coreos-${TIMESTAMP}" >> $GITHUB_ENV
|
|
|
|
echo "IMAGE_VERSION=0.0.${TIMESTAMP}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: "Build and Upload"
|
|
|
|
run: >
|
|
|
|
make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc GCP_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" AZURE_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}"
|
2022-06-29 09:26:29 -04:00
|
|
|
AZURE_IMAGE_DEFINITION="constellation-coreos" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_BOOTSTRAPPER=y BOOTSTRAPPER_URL="https://${{ secrets.PUBLIC_BUCKET_NAME }}.s3.us-east-2.amazonaws.com/bootstrapper/${{ inputs.bootstrapper-name }}"
|
2022-03-22 11:03:15 -04:00
|
|
|
image-gcp image-azure upload-gcp upload-azure
|
|
|
|
working-directory: ${{ env.working-directory }}
|