Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Build

on:
workflow_call:
inputs:
push:
type: boolean
description: "Push package image"
required: false
default: false
target:
type: string
description: "Target to build"
required: false
default: "package"
branch:
type: string
description: "Branch to build"
required: false
default: "main"
envs:
type: string
description: "Environment variables to build"
required: false
default: ""
cleanup:
type: boolean
description: "Cleanup"
required: false
default: false

env:
IMAGE_REPOSITORY: gcr.io/spectro-dev-public

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Release space from worker
if: ${{ inputs.cleanup }}
run: |
echo "Listing top largest packages"
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
head -n 30 <<< "${pkgs}"
echo
df -h
echo
sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true
sudo apt-get remove --auto-remove android-sdk-platform-tools || true
sudo apt-get purge --auto-remove android-sdk-platform-tools || true
sudo rm -rf /usr/local/lib/android
sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true
sudo rm -rf /usr/share/dotnet
sudo apt-get remove -y '^mono-.*' || true
sudo apt-get remove -y '^ghc-.*' || true
sudo apt-get remove -y '.*jdk.*|.*jre.*' || true
sudo apt-get remove -y 'php.*' || true
sudo apt-get remove -y hhvm || true
sudo apt-get remove -y powershell || true
sudo apt-get remove -y firefox || true
sudo apt-get remove -y monodoc-manual || true
sudo apt-get remove -y msbuild || true
sudo apt-get remove -y microsoft-edge-stable || true
sudo apt-get remove -y '^google-.*' || true
sudo apt-get remove -y azure-cli || true
sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true
sudo apt-get remove -y '^gfortran-.*' || true
sudo apt-get remove -y '^gcc-*' || true
sudo apt-get remove -y '^g++-*' || true
sudo apt-get remove -y '^cpp-*' || true
sudo apt-get autoremove -y
sudo apt-get clean
echo
echo "Listing top largest packages"
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
head -n 30 <<< "${pkgs}"
echo
sudo rm -rfv build || true
df -h
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Install earthly
uses: Luet-lab/luet-install-action@v1.1
with:
repository: quay.io/kairos/packages
packages: utils/earthly
- name: Set .arg file
if: ${{ inputs.envs }}
run: |
echo "${{ inputs.envs }}" > .arg
cat .arg
- run: earthly --ci --no-cache +${{ inputs.target }}
if: ${{ !inputs.push }}
- run: earthly --ci --output --push --no-cache +${{ inputs.target }}
if: ${{ inputs.push }}
36 changes: 25 additions & 11 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# name: Pr
name: Pr

# on: [pull_request]
on: [pull_request]

# concurrency:
# group: ${{ github.pr_workflow }}-${{ github.ref }}
# cancel-in-progress: true
concurrency:
group: pr-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

# permissions:
# contents: read
permissions:
contents: write
pull-requests: write
issues: read
checks: write

# jobs:
# build:
# uses: ./.github/workflows/release.yaml
# secrets: inherit
jobs:
k8s:
name: k8s install test
uses: ./.github/workflows/build.yaml
strategy:
matrix:
flavor: [k3s, kubeadm, rke2]
with:
cleanup: true
target: build-provider-images
branch: ${{ github.head_ref }}
envs: |
TARGET=install-k8s-test
K8S_DISTRIBUTION=${{ matrix.flavor }}
ARCH=amd64
48 changes: 0 additions & 48 deletions .github/workflows/release.yaml

This file was deleted.

8 changes: 6 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG TARGETOS
ARG TARGETARCH

# Default image repositories used in the builds.
ARG ALPINE_IMG=gcr.io/spectro-images-public/alpine:3.16.2
ARG ALPINE_IMG=gcr.io/spectro-images-public/alpine:3.17
ARG SPECTRO_PUB_REPO=gcr.io/spectro-images-public
ARG SPECTRO_LUET_REPO=gcr.io/spectro-dev-public
ARG KAIROS_BASE_IMAGE_URL=gcr.io/spectro-images-public
Expand Down Expand Up @@ -320,7 +320,7 @@ kairos-agent:
SAVE ARTIFACT /usr/bin/kairos-agent /kairos-agent

install-k8s:
FROM --platform=linux/${ARCH} alpine:3.19
FROM --platform=linux/${ARCH} $ALPINE_IMG
COPY +luet/luet /usr/bin/luet

IF [ "$K8S_DISTRIBUTION" = "kubeadm" ] || [ "$K8S_DISTRIBUTION" = "kubeadm-fips" ]
Expand Down Expand Up @@ -355,6 +355,10 @@ install-k8s:
RUN rm -rf /output/var/cache/*
SAVE ARTIFACT /output/*

install-k8s-test:
FROM +install-k8s
RUN rm -rf /output

build-uki-iso:
FROM --platform=linux/${ARCH} $OSBUILDER_IMAGE
ENV ISO_NAME=${ISO_NAME}
Expand Down