Files
provider-kairos/.github/workflows/image.yaml
Ettore Di Giacinto 52c7568ecc 🤖 Drop flaky workflows jobs
Drops qrcode test (needs to be optimized), and drops build-vm jobs as are redundant( we run similar tests in kairos )
Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
2022-12-03 22:48:13 +00:00

470 lines
14 KiB
YAML

name: Build image
on:
push:
branches:
- main
pull_request:
concurrency:
group: ci-image-${{ github.head_ref || github.ref }}-${{ github.repository }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # OIDC support
strategy:
fail-fast: false
matrix:
include:
- flavor: "opensuse"
#- flavor: "tumbleweed"
#- flavor: "fedora"
#- flavor: "ubuntu"
- flavor: "alpine-opensuse-leap"
- flavor: "alpine-ubuntu"
- flavor: "ubuntu"
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: setup-docker
uses: docker-practice/actions-setup-docker@master
- name: Release space from worker
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install Cosign
uses: sigstore/cosign-installer@main
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
- name: Build 🔧
env:
FLAVOR: ${{ matrix.flavor }}
IMAGE: quay.io/kairos/kairos-${{ matrix.flavor }}:latest
run: |
./earthly.sh +all --IMAGE=$IMAGE --FLAVOR=$FLAVOR
sudo mv build/* .
sudo rm -rf build
- uses: actions/upload-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.iso.zip
path: |
*.iso
*.sha256
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.initrd.zip
path: |
*-initrd
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.squashfs.zip
path: |
*.squashfs
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.kernel.zip
path: |
*-kernel
*-initrd
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.ipxe.zip
path: |
*.ipxe
if-no-files-found: error
- name: Push to quay
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
COSIGN_EXPERIMENTAL: 1
run: |
docker push quay.io/kairos/kairos-${{ matrix.flavor }}:latest
cosign sign quay.io/kairos/kairos-${{ matrix.flavor }}:latest
- name: Push to testing
run: |
docker tag quay.io/kairos/kairos-${{ matrix.flavor }}:latest ttl.sh/kairos-${{ matrix.flavor }}-${{ github.sha }}:8h
docker push ttl.sh/kairos-${{ matrix.flavor }}-${{ github.sha }}:8h
# Test start
build-vm-images:
needs:
- build
runs-on: macos-12
strategy:
fail-fast: false
matrix:
include:
- flavor: "opensuse"
- flavor: "alpine-opensuse-leap"
# - flavor: "tumbleweed"
# - flavor: "ubuntu"
# - flavor: "fedora"
# steps:
# - uses: actions/checkout@v3
# - name: Install deps
# run: |
# brew install hudochenkov/sshpass/sshpass
# brew install qemu
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: kairos-${{ matrix.flavor }}.iso.zip
# - run: |
# git clone https://github.com/kairos-io/kairos
# ls -liah
# iso=$(ls *.iso)
# bash kairos/scripts/build_vm.sh $iso
# - uses: actions/upload-artifact@v3
# with:
# name: kairos-${{ matrix.flavor }}.qcow2.tar.xz
# path: |
# *.qcow2.tar.xz
# - uses: actions/upload-artifact@v3
# with:
# name: kairos-${{ matrix.flavor }}.ova
# path: |
# *.ova
# if-no-files-found: error
prepare-test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.16'
- name: Prepare config
run: |
./earthly.sh +test-create-config --WITH_DNS=true
- uses: actions/upload-artifact@v3
with:
name: config.yaml
path: |
config.yaml
if-no-files-found: error
upgrade-single-node-k8s-test:
needs:
- prepare-test
runs-on: macos-12
strategy:
fail-fast: true
matrix:
include:
- flavor: "opensuse"
node: "A" # Arbitrary field
- flavor: "alpine-opensuse-leap"
node: "B" # Arbitrary field
#- flavor: "tumbleweed"
# node: "C"
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.iso.zip
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: config.yaml
- name: Install deps
run: |
brew install cdrtools jq
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.16'
- run: |
ls -liah
export ISO=$PWD/$(ls *.iso)
export GOPATH="/Users/runner/go"
export PATH=$PATH:$GOPATH/bin
export CLOUD_INIT=$PWD/config.yaml
export CREATE_VM=true
export FLAVOR=${{ matrix.flavor }}
./.github/run_test.sh "upgrade-k8s"
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.flavor }}-vbox.logs.zip
path: tests/**/logs/*
if-no-files-found: warn
decentralized-k8s-test-opensuse:
needs:
- prepare-test
- upgrade-single-node-k8s-test
runs-on: macos-12
strategy:
fail-fast: true
matrix:
include:
- flavor: "opensuse"
node: "A" # Arbitrary field
- flavor: "opensuse"
node: "B"
# - flavor: "alpine"
# node: "C"
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.iso.zip
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: config.yaml
- name: Install deps
run: |
brew install cdrtools jq
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.16'
- run: |
ls -liah
export ISO=$PWD/$(ls *.iso)
export GOPATH="/Users/runner/go"
export PATH=$PATH:$GOPATH/bin
export CLOUD_INIT=$PWD/config.yaml
export CREATE_VM=true
export FLAVOR=${{ matrix.flavor }}
./.github/run_test.sh "decentralized-k8s"
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.flavor }}-vbox.logs.zip
path: tests/**/logs/*
if-no-files-found: warn
prepare-alpine-test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.16'
- name: Prepare config
run: |
./earthly.sh +test-create-config --WITH_DNS=true
- uses: actions/upload-artifact@v3
with:
name: config.yaml
path: |
config.yaml
if-no-files-found: error
decentralized-k8s-test-alpine:
needs:
- prepare-alpine-test
- decentralized-k8s-test-opensuse
runs-on: macos-12
strategy:
fail-fast: true
matrix:
include:
- flavor: "alpine-opensuse-leap"
node: "A" # Arbitrary field
- flavor: "alpine-opensuse-leap"
node: "B"
# - flavor: "alpine"
# node: "C"
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: kairos-${{ matrix.flavor }}.iso.zip
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: config.yaml
- name: Install deps
run: |
brew install cdrtools jq
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.16'
- run: |
ls -liah
export ISO=$PWD/$(ls *.iso)
export GOPATH="/Users/runner/go"
export PATH=$PATH:$GOPATH/bin
export CLOUD_INIT=$PWD/config.yaml
export CREATE_VM=true
export FLAVOR=${{ matrix.flavor }}
./.github/run_test.sh "decentralized-k8s"
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.flavor }}-vbox.logs.zip
path: tests/**/logs/*
if-no-files-found: warn
latest-release:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- flavor: "alpine-opensuse-leap"
- flavor: "opensuse"
steps:
- uses: robinraju/release-downloader@v1.6
with:
# A flag to set the download target as latest release
# The default value is 'false'
latest: true
repository: "kairos-io/provider-kairos"
fileName: "kairos-${{ matrix.flavor }}-*v1.25*.iso"
out-file-path: "last-release"
- uses: actions/upload-artifact@v3
with:
name: latest-release-${{ matrix.flavor }}.zip
path: last-release
if-no-files-found: error
# qrcode-test-cli:
# needs:
# - build
# - prepare-alpine-test
# - upgrade-test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: config.yaml
# - name: Install Go
# uses: actions/setup-go@v3
# with:
# go-version: '^1.16'
# - run: |
# ./earthly.sh +build-kairos-agent-provider
# sudo cp -rfv build/agent-provider-kairos /usr/bin/kairos
# export CLOUD_INIT=$PWD/tests/assets/qrcode.yaml
# export FLAVOR=${{ matrix.flavor }}
# ./.github/run_test.sh "qrcode-register"
# env:
# SENDKEY: 4kgpo43kphopj
# - uses: actions/upload-artifact@v3
# if: failure()
# with:
# name: screenshot.zip
# path: |
# tests/*.png
# qrcode-test:
# needs:
# - build
# - upgrade-test
# - prepare-alpine-test
# runs-on: macos-12
# strategy:
# fail-fast: false
# matrix:
# include:
# - flavor: "alpine-opensuse-leap"
# node: "A" # Arbitrary field
# # - flavor: "alpine"
# # node: "C"
# steps:
# - uses: actions/checkout@v3
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: config.yaml
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: kairos-${{ matrix.flavor }}.iso.zip
# - name: Install deps
# run: |
# brew install cdrtools jq
# - name: Install Go
# uses: actions/setup-go@v3
# with:
# go-version: '^1.16'
# - run: |
# ls -liah
# export ISO=$PWD/$(ls *.iso)
# export GOPATH="/Users/runner/go"
# export PATH=$PATH:$GOPATH/bin
# export CLOUD_INIT=$PWD/tests/assets/qrcode.yaml
# export CREATE_VM=true
# export FLAVOR=${{ matrix.flavor }}
# ./.github/run_test.sh "qrcode-install"
# env:
# SENDKEY: 4kgpo43kphopj
# - uses: actions/upload-artifact@v3
# if: failure()
# with:
# name: ${{ matrix.flavor }}-qrcode-test.logs.zip
# path: tests/**/logs/*
# if-no-files-found: warn
upgrade-test:
needs:
- build
- latest-release
runs-on: macos-12
strategy:
fail-fast: false
matrix:
include:
- flavor: "alpine-opensuse-leap"
node: "A" # Arbitrary field
- flavor: "opensuse"
node: "B"
# - flavor: "alpine"
# node: "C"
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: latest-release-${{ matrix.flavor }}.zip
- name: Install deps
run: |
brew install cdrtools jq
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.16'
- run: |
ls -liah
export ISO=$PWD/$(ls kairos-${{ matrix.flavor }}-*.iso | tail -n1 )
export GOPATH="/Users/runner/go"
export CONTAINER_IMAGE=ttl.sh/kairos-${{ matrix.flavor }}-${{ github.sha }}:8h
export PATH=$PATH:$GOPATH/bin
export CLOUD_INIT=$PWD/tests/assets/config.yaml
export CREATE_VM=true
export FLAVOR=${{ matrix.flavor }}
./.github/run_test.sh "upgrade-latest-with-kubernetes"
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.flavor }}-upgrade-test.logs.zip
path: tests/**/logs/*
if-no-files-found: warn