Skip to content

Commit

Permalink
Added support for bulding arm images with rpi support
Browse files Browse the repository at this point in the history
Signed-off-by: venkatnsrinivasan <[email protected]>
  • Loading branch information
venkatnsrinivasan committed May 8, 2023
1 parent 9fc7a92 commit 78c9aaa
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 7 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish-arm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish

on:
push:
tags:
- v*

jobs:
images:
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
matrix:
base-image:
- quay.io/kairos/core-opensuse-arm-rpi:v2.0.3
- quay.io/kairos/core-opensuse-leap-arm-generic:v2.0.3
k3s-version:
- v1.25.2+k3s1
- v1.25.0+k3s1
- v1.24.6+k3s1
- v1.24.4+k3s1
- v1.23.12+k3s1
- v1.23.10+k3s1
- v1.22.15+k3s1
- v1.22.13+k3s1
env:
REGISTRY: quay.io
REGISTRY_USER: ${{ secrets.QUAY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@master
- uses: sigstore/cosign-installer@main
- uses: docker/setup-buildx-action@master
- uses: earthly/actions-setup@v1
with:
version: "latest"
- run: echo $REGISTRY_PASSWORD | docker login -u $REGISTRY_USER --password-stdin $REGISTRY
- run: env | grep ACTIONS_ID_TOKEN_REQUEST > .env
- run: env | grep REGISTRY >> .env
- run: earthly --ci --push +docker-arm64-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}
- run: earthly --ci +cosign-arm64-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}

4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:
- run: echo $REGISTRY_PASSWORD | docker login -u $REGISTRY_USER --password-stdin $REGISTRY
- run: env | grep ACTIONS_ID_TOKEN_REQUEST > .env
- run: env | grep REGISTRY >> .env
- run: earthly --ci --push +docker-all-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}
- run: earthly --ci +cosign-all-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}
- run: earthly --ci --push +docker-amd64-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}
- run: earthly --ci +cosign-amd64-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}

2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
- uses: earthly/actions-setup@v1
with:
version: "v0.6.30"
- run: earthly --ci +docker-all-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}
- run: earthly --ci +docker-amd64-platforms --K3S_VERSION=${{ matrix.k3s-version }} --BASE_IMAGE=${{ matrix.base-image }}
15 changes: 11 additions & 4 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ build-provider-package:
docker:
DO +VERSION
ARG VERSION=$(cat VERSION)
ARG USERPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH

FROM $BASE_IMAGE

Expand All @@ -84,12 +88,13 @@ docker:
COPY +luet/luet /usr/bin/luet

ENV INSTALL_K3S_BIN_DIR="/usr/bin"
ENV ARCH=$TARGETARCH
RUN curl -sfL https://get.k3s.io > installer.sh \
&& INSTALL_K3S_SKIP_START="true" INSTALL_K3S_SKIP_ENABLE="true" bash installer.sh \
&& INSTALL_K3S_SKIP_START="true" INSTALL_K3S_SKIP_ENABLE="true" bash installer.sh agent \
&& rm -rf installer.sh

RUN curl -sL https://github.com/etcd-io/etcd/releases/download/v3.5.5/etcd-v3.5.5-linux-amd64.tar.gz | sudo tar -zxv --strip-components=1 -C /usr/local/bin
RUN curl -sL https://github.com/etcd-io/etcd/releases/download/v3.5.5/etcd-v3.5.5-linux-${TARGETARCH}.tar.gz | sudo tar -zxv --strip-components=1 -C /usr/local/bin
COPY +build-provider/agent-provider-k3s /system/providers/agent-provider-k3s

ENV OS_ID=${BASE_IMAGE_NAME}-k3s
Expand All @@ -103,7 +108,7 @@ docker:
# add support for airgap to k3s provider
# ref: https://docs.k3s.io/installation/airgap
RUN mkdir -p /var/lib/rancher/k3s/agent/images
RUN curl -L --output /var/lib/rancher/k3s/agent/images/images.tar "https://github.com/k3s-io/k3s/releases/download/${K3S_VERSION}/k3s-airgap-images-amd64.tar"
RUN curl -L --output /var/lib/rancher/k3s/agent/images/images.tar "https://github.com/k3s-io/k3s/releases/download/${K3S_VERSION}/k3s-airgap-images-${TARGETARCH}.tar"

SAVE IMAGE --push $IMAGE_REPOSITORY/${BASE_IMAGE_NAME}-k3s:${K3S_VERSION_TAG}
SAVE IMAGE --push $IMAGE_REPOSITORY/${BASE_IMAGE_NAME}-k3s:${K3S_VERSION_TAG}_${VERSION}
Expand Down Expand Up @@ -136,14 +141,16 @@ cosign:
RUN cosign sign $IMAGE_REPOSITORY/${BASE_IMAGE_NAME}-k3s:${K3S_VERSION_TAG}
RUN cosign sign $IMAGE_REPOSITORY/${BASE_IMAGE_NAME}-k3s:${K3S_VERSION_TAG}_${VERSION}

docker-all-platforms:
docker-amd64-platforms:
BUILD --platform=linux/amd64 +docker
docker-arm64-platforms:
BUILD --platform=linux/arm64 +docker

provider-package-all-platforms:
BUILD --platform=linux/amd64 +build-provider-package
BUILD --platform=linux/arm64 +build-provider-package

cosign-all-platforms:
cosign-amd64-platforms:
BUILD --platform=linux/amd64 +cosign
cosign-arm64-platforms:
BUILD --platform=linux/arm64 +cosign

0 comments on commit 78c9aaa

Please sign in to comment.