diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index ba1c9e1..deccd4a 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -17,11 +17,14 @@ jobs: - name: Build the image run: ./build ostreeImage-${{ matrix.arch }} working-directory: ./debian - - name: Upload ${{ matrix.arch }} image + - name: Rename build artifact + run: mv *ostreeImage-${{ matrix.arch }}-trixie-*.ostree.raw ostree-debian-image-${{ matrix.arch }}.tar.gz + working-directory: ./debian/.build + - name: Upload debian ${{ matrix.arch }} image uses: actions/upload-artifact@v3 with: - name: ostree-${{ matrix.arch }}-trixie-image - path: debian/.build/*ostreeImage-${{ matrix.arch }}-trixie-*.ostree.raw + name: ostree-debian-image-${{ matrix.arch }} + path: debian/.build/ostree-debian-image-${{ matrix.arch }}.tar.gz retention-days: 2 gardenlinux-image: @@ -30,17 +33,22 @@ jobs: fail-fast: false matrix: arch: [ amd64, arm64 ] - platform: [ kvm ] + platform: [ kvm, metal ] steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - name: Configure Build Variant + run: echo ${{ matrix.platform }} > features/ostreeImage/BUILD_VARIANT - name: Build the image run: ./build ostreeImage-${{ matrix.arch }} working-directory: ./gardenlinux - - name: Upload ${{ matrix.arch }} image + - name: Rename build artifact + run: mv *ostreeImage-${{ matrix.arch }}-today-*.ostree.raw ostree-gardenlinux-image-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz + working-directory: ./gardenlinux/.build + - name: Upload gardenlinux ${{ matrix.platform }} ${{ matrix.arch }} image uses: actions/upload-artifact@v3 with: - name: ostreeImage-${{ matrix.arch }} - path: gardenlinux/.build/*ostreeImage-${{ matrix.arch }}-today-*.ostree.raw + name: ostree-gardenlinux-image-${{ matrix.platform }}-${{ matrix.arch }} + path: gardenlinux/.build/ostree-gardenlinux-image-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz retention-days: 2 diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index c595f58..c99557b 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -42,6 +42,9 @@ jobs: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - name: Configure Build Variant + run: echo ${{ matrix.platform }} > features/ostreeRepo/BUILD_VARIANT + working-directory: ./gardenlinux - name: Build the repo run: ./build ${{ matrix.platform }}_dev_curl-ostreeRepo-${{ matrix.arch }} working-directory: ./gardenlinux diff --git a/debian/features/ostreeImage/image.ostree.raw b/debian/features/ostreeImage/image.ostree.raw index afe1d5b..1ae5040 100755 --- a/debian/features/ostreeImage/image.ostree.raw +++ b/debian/features/ostreeImage/image.ostree.raw @@ -16,12 +16,8 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="debian/testing/$BUILDER_ARCH" -# REPO_CNAME=$(echo $BUILDER_CNAME | sed 's/Image/Repo/g') -# FIXME proper name building -REPO_CNAME=ostreeRepo-${BUILDER_ARCH}-trixie -REMOTE_NAME="$REPO_CNAME".ostreeRepo -REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz" REMOTE_URL="http://ostree.gardenlinux.io" +REMOTE_ARCHIVE_NAME=ostree-debian-repo-${BUILDER_ARCH}.tar.gz rootfs="$1" output="$2" diff --git a/debian/features/ostreeRepo/image.ostreeRepo.tar.gz b/debian/features/ostreeRepo/image.ostreeRepo.tar.gz index 5d0a696..e5a4dfa 100755 --- a/debian/features/ostreeRepo/image.ostreeRepo.tar.gz +++ b/debian/features/ostreeRepo/image.ostreeRepo.tar.gz @@ -14,9 +14,9 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="debian/testing/$BUILDER_ARCH" -REMOTE_NAME="$BUILDER_CNAME".ostreeRepo -REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz" REMOTE_URL="http://ostree.gardenlinux.io" +REMOTE_ARCHIVE_NAME=ostree-debian-repo-${BUILDER_ARCH}.tar.gz +REMOTE_NAME=debian-repo-${BUILDER_ARCH} rootfs="$1" output="$2" @@ -43,9 +43,11 @@ if curl --head --silent --fail $REMOTE_URL/$REMOTE_ARCHIVE_NAME 2> /dev/null; ostree admin init-fs --modern $OSTREE_SYSROOT ostree admin os-init --sysroot=$OSTREE_SYSROOT debian ostree config --repo=$OSTREE_REPO set sysroot.bootloader none - ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin $REMOTE_URL/$REMOTE_NAME $OSTREE_REF fi +ostree remote --repo=$OSTREE_REPO delete --if-exists origin +ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin $REMOTE_URL/$REMOTE_NAME $OSTREE_REF + ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "Debian $REMOTE_NAME $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work" ostree log --repo=$OSTREE_REPO $OSTREE_REF diff --git a/gardenlinux/features/ostreeImage/.gitignore b/gardenlinux/features/ostreeImage/.gitignore new file mode 100644 index 0000000..c6fa83e --- /dev/null +++ b/gardenlinux/features/ostreeImage/.gitignore @@ -0,0 +1 @@ +BUILD_VARIANT diff --git a/gardenlinux/features/ostreeImage/image.ostree.raw b/gardenlinux/features/ostreeImage/image.ostree.raw index 3dc93b4..4f71e86 100755 --- a/gardenlinux/features/ostreeImage/image.ostree.raw +++ b/gardenlinux/features/ostreeImage/image.ostree.raw @@ -16,20 +16,16 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="gardenlinux/today/$BUILDER_ARCH" -# REPO_CNAME=$(echo $BUILDER_CNAME | sed 's/Image/Repo/g') -# FIXME proper name building - -REPO_CNAME=kvm-ostreeRepo_curl_dev-${BUILDER_ARCH}-today -REMOTE_NAME="$REPO_CNAME".ostreeRepo -REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz" +# BUILD_VARIANT determains which repo we need to download (like metal, kvm, gcp, aws, azure, ..) +BUILD_VARIANT=$(cat /builder/features/ostreeImage/BUILD_VARIANT) REMOTE_URL="http://ostree.gardenlinux.io" +REMOTE_ARCHIVE_NAME=ostree-gardenlinux-repo-${BUILD_VARIANT}-${BUILDER_ARCH}.tar.gz rootfs="$1" output="$2" tar xf "$rootfs" -C "$rootfs_work" - mkdir -p $OSTREE_REPO mkdir -p $OSTREE_SYSROOT download="$(mktemp -d)" diff --git a/gardenlinux/features/ostreeRepo/.gitignore b/gardenlinux/features/ostreeRepo/.gitignore new file mode 100644 index 0000000..c6fa83e --- /dev/null +++ b/gardenlinux/features/ostreeRepo/.gitignore @@ -0,0 +1 @@ +BUILD_VARIANT diff --git a/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz b/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz index 7853d1f..73a25ec 100755 --- a/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz +++ b/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz @@ -14,9 +14,11 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="gardenlinux/today/$BUILDER_ARCH" -REMOTE_NAME="$BUILDER_CNAME".ostreeRepo -REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz" +# BUILD_VARIANT determains which repo we need to download (like metal, kvm, gcp, aws, azure, ..) +BUILD_VARIANT=$(cat /builder/features/ostreeRepo/BUILD_VARIANT) REMOTE_URL="http://ostree.gardenlinux.io" +REMOTE_ARCHIVE_NAME=ostree-gardenlinux-repo-${BUILD_VARIANT}-${BUILDER_ARCH}.tar.gz +REMOTE_NAME=gardenlinux-repo-${BUILD_VARIANT}-${BUILDER_ARCH} rootfs="$1" output="$2" @@ -43,10 +45,12 @@ if curl --head --silent --fail $REMOTE_URL/$REMOTE_ARCHIVE_NAME 2> /dev/null; ostree admin init-fs --modern $OSTREE_SYSROOT ostree admin os-init --sysroot=$OSTREE_SYSROOT gardenlinux ostree config --repo=$OSTREE_REPO set sysroot.bootloader none - ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin $REMOTE_URL/$REMOTE_NAME $OSTREE_REF fi -ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "Garden Linux $REMOTE_NAME $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work" +ostree remote --repo=$OSTREE_REPO delete --if-exists origin +ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin $REMOTE_URL/$REMOTE_NAME $OSTREE_REF + +ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "Garden Linux $BUILD_VARIANT $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work" ostree log --repo=$OSTREE_REPO $OSTREE_REF