diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..b97b2b1 --- /dev/null +++ b/.github/workflows/build.yaml @@ -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 }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 72877e9..86ea463 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -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 \ No newline at end of file +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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index c50d3d6..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# name: Release - -# on: -# push: -# tags: -# - v* - -# permissions: -# contents: write - -# concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true - - -# jobs: -# release-iso-image: -# runs-on: ubuntu-latest -# steps: -# - name: Login to Docker Hub -# uses: docker/login-action@v2 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# - uses: actions/checkout@v3 -# - name: create .netrc file -# env: -# REPO_USER: ${{ secrets.REPO_USER }} -# REPO_TOKEN: ${{ secrets.REPO_TOKEN }} -# shell: bash -# run: | -# echo "machine github.com" > .netrc -# echo " login $REPO_USER" >> .netrc -# echo " password $REPO_TOKEN" >> .netrc -# echo "machine api.github.com" >> .netrc -# echo " login $REPO_USER" >> .netrc -# echo " password $REPO_TOKEN" >> .netrc -# - uses: earthly/actions-setup@v1 -# - run: ./earthly --ci --push -P --output +build-all-images --PE_VERSION=${{ github.ref_name }} -# - run: | -# if [[ "${{ github.ref }}" =~ .*-.*$ ]]; then -# echo "IS_PRERELEASE=true" > $GITHUB_ENV -# fi -# - uses: softprops/action-gh-release@v1 -# with: -# files: build/* -# prerelease: ${{ env.IS_PRERELEASE }} -# generate_release_notes: true \ No newline at end of file diff --git a/Earthfile b/Earthfile index 12cbf3f..b4d35e6 100644 --- a/Earthfile +++ b/Earthfile @@ -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 @@ -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" ] @@ -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}