From 6572ad805c08cad49fc0cdbf385ed3e4cdf29e2f Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 14 Nov 2022 18:35:27 +0100 Subject: [PATCH] :seedling: Re-order packages layout (#417) * :seedling: Simplify framework images creation No need to account anymore for different flavors of the toolkit Signed-off-by: Ettore Di Giacinto * :robot: No need to publish framework images anymore Signed-off-by: Ettore Di Giacinto * :arrow_up: Bump Kairos repositories Signed-off-by: Ettore Di Giacinto Signed-off-by: Ettore Di Giacinto --- .github/workflows/image-framework.yaml | 53 -------------------------- Earthfile | 43 +++++++++++++-------- images/Dockerfile.alpine | 8 +--- images/Dockerfile.alpine-arm-rpi | 8 ---- repositories/repositories.yaml | 4 +- 5 files changed, 30 insertions(+), 86 deletions(-) delete mode 100644 .github/workflows/image-framework.yaml diff --git a/.github/workflows/image-framework.yaml b/.github/workflows/image-framework.yaml deleted file mode 100644 index ea44d8a3e..000000000 --- a/.github/workflows/image-framework.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: Build latest Framework images - -on: - push: - branches: - - master - -concurrency: - group: ci-fw-${{ 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" - 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/master' }} - 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/framework - run: | - ./earthly.sh +framework-image --IMG=${IMAGE}:latest --FLAVOR=${FLAVOR} --WITH_KERNEL=false - ./earthly.sh +framework-image --IMG=${IMAGE}-generic:latest --FLAVOR=${FLAVOR} --WITH_KERNEL=true - - name: Push to quay - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - env: - COSIGN_EXPERIMENTAL: 1 - IMAGE: quay.io/kairos/framework - run: | - docker push ${IMAGE}:latest - docker push ${IMAGE}-generic:latest - cosign sign ${IMAGE}:latest - cosign sign ${IMAGE}-generic:latest \ No newline at end of file diff --git a/Earthfile b/Earthfile index 489890de3..52e9e18dd 100644 --- a/Earthfile +++ b/Earthfile @@ -161,19 +161,17 @@ framework: ENV USER=root - IF [ "$FLAVOR" == "ubuntu-20-lts" ] || [ "$FLAVOR" == "ubuntu-22-lts" ] - ARG TOOLKIT_IMG="ubuntu" - ELSE IF [ "$FLAVOR" == "rockylinux" ] - ARG TOOLKIT_IMG="fedora" - ELSE IF [ "$FLAVOR" != "ubuntu" ] && [ "$FLAVOR" != "opensuse" ] && [ "$FLAVOR" != "fedora" ] - ARG TOOLKIT_IMG="opensuse" - ELSE - ARG TOOLKIT_IMG="$FLAVOR" - END - # Framework files RUN luet install -y --system-target /framework \ - system/elemental-toolkit-$TOOLKIT_IMG dracut/kcrypt system/kcrypt system/suc-upgrade + system/base-cloud-config dracut/immutable-rootfs dracut/kcrypt static/grub-config system/kcrypt system/suc-upgrade system/shim system/grub2-efi system/elemental-cli + + IF [ "$FLAVOR" = "alpine" ] || [ "$FLAVOR" = "alpine-arm-rpi" ] + RUN luet install -y --system-target /framework \ + init-svc/openrc + ELSE + RUN luet install -y --system-target /framework \ + init-svc/systemd + END # Keep openSUSE kernel on ARM IF [ "$FLAVOR" = "opensuse-arm-rpi" ] || [ "$FLAVOR" = "alpine-arm-rpi" ] @@ -184,11 +182,6 @@ framework: distro-kernels/ubuntu distro-initrd/ubuntu END - # Required for Secure boot - RUN luet install -y --system-target /framework system/shim system/grub2-efi - # Elemental CLI - RUN luet install -y --system-target /framework system/elemental-cli - COPY +luet/luet /framework/usr/bin/luet RUN luet cleanup --system-target /framework @@ -254,6 +247,24 @@ docker: # Copy kairos binaries COPY +build-kairos-agent/kairos-agent /usr/bin/kairos-agent + + # Enable services + IF [ -f /sbin/openrc ] + RUN mkdir -p /etc/runlevels/default && \ + ln -sf /etc/init.d/cos-setup-boot /etc/runlevels/default/cos-setup-boot && \ + ln -sf /etc/init.d/cos-setup-network /etc/runlevels/default/cos-setup-network && \ + ln -sf /etc/init.d/cos-setup-reconcile /etc/runlevels/default/cos-setup-reconcile && \ + ln -sf /etc/init.d/kairos-agent /etc/runlevels/default/kairos-agent + # Otherwise we assume systemd + ELSE + RUN ls -liah /etc/systemd/system + RUN systemctl enable cos-setup-rootfs.service && \ + systemctl enable cos-setup-initramfs.service && \ + systemctl enable cos-setup-reconcile.timer && \ + systemctl enable cos-setup-fs.service && \ + systemctl enable cos-setup-boot.service && \ + systemctl enable cos-setup-network.service + END # Regenerate initrd if necessary IF [ "$FLAVOR" = "opensuse" ] || [ "$FLAVOR" = "opensuse-arm-rpi" ] || [ "$FLAVOR" = "tumbleweed-arm-rpi" ] diff --git a/images/Dockerfile.alpine b/images/Dockerfile.alpine index 0877b2faa..b7754c980 100644 --- a/images/Dockerfile.alpine +++ b/images/Dockerfile.alpine @@ -96,13 +96,6 @@ RUN apk --no-cache add \ open-vm-tools-vmbackup \ openntpd -RUN mkdir -p /etc/runlevels/default && \ - ln -sf /etc/init.d/cos-setup-boot /etc/runlevels/default/cos-setup-boot && \ - ln -sf /etc/init.d/cos-setup-network /etc/runlevels/default/cos-setup-network && \ - ln -sf /etc/init.d/cos-setup-reconcile /etc/runlevels/default/cos-setup-reconcile && \ - ln -sf /etc/init.d/crond /etc/runlevels/default/crond && \ - ln -sf /etc/init.d/kairos-agent /etc/runlevels/default/kairos-agent - RUN rc-update add sshd boot && \ rc-update add connman boot && \ rc-update add acpid boot && \ @@ -111,6 +104,7 @@ RUN rc-update add sshd boot && \ rc-update add udev sysinit && \ rc-update add udev-trigger sysinit && \ rc-update add openntpd boot && \ + rc-update add crond && \ rc-update add fail2ban # Symlinks to make elemental installer work diff --git a/images/Dockerfile.alpine-arm-rpi b/images/Dockerfile.alpine-arm-rpi index 839d7c266..cb00df162 100644 --- a/images/Dockerfile.alpine-arm-rpi +++ b/images/Dockerfile.alpine-arm-rpi @@ -93,13 +93,6 @@ RUN apk --no-cache add \ open-vm-tools-vmbackup \ openntpd - -RUN mkdir -p /etc/runlevels/default && \ - ln -sf /etc/init.d/cos-setup-boot /etc/runlevels/default/cos-setup-boot && \ - ln -sf /etc/init.d/cos-setup-network /etc/runlevels/default/cos-setup-network && \ - ln -sf /etc/init.d/cos-setup-reconcile /etc/runlevels/default/cos-setup-reconcile && \ - ln -sf /etc/init.d/kairos-agent /etc/runlevels/default/kairos-agent - RUN rc-update add sshd boot && \ rc-update add connman boot && \ rc-update add acpid boot && \ @@ -115,4 +108,3 @@ RUN rc-update add sshd boot && \ RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install && \ ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv -# RUN ln -sf Image /boot/vmlinuz diff --git a/repositories/repositories.yaml b/repositories/repositories.yaml index 097780348..ec6f11b7a 100644 --- a/repositories/repositories.yaml +++ b/repositories/repositories.yaml @@ -9,9 +9,9 @@ repositories: priority: 2 urls: - "quay.io/kairos/packages" - reference: 20221114105054-repository.yaml + reference: 20221114135627-repository.yaml - !!merge <<: *kairos arch: arm64 urls: - "quay.io/kairos/packages-arm64" - reference: 20221114105316-repository.yaml + reference: 20221114140603-repository.yaml