From fdcc1cc41ea3154bd2faf3d055750baaa9ca3397 Mon Sep 17 00:00:00 2001 From: Noel Miller Date: Fri, 16 Feb 2024 01:30:32 -0600 Subject: [PATCH 01/19] fix: attempted fix for tags not being properly set in remote --- Makefile | 4 ++-- xorriso/gen_input.sh.in | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d6a4ba99..b07db351 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades. container/$(image_name)-$(version): mkdir container podman pull $(image_repo)/$(image_name):$(image_tag) - podman save --format oci-dir -o $(base_dir)/container/$(image_name)-$(version) $(image_repo)/$(image_name):$(image_tag) + podman save --format oci-dir -o $(base_dir)/container/$(image_name)-$(image_tag) $(image_repo)/$(image_name):$(image_tag) podman rmi $(image_repo)/$(image_name):$(image_tag) install-deps: @@ -62,7 +62,7 @@ xorriso/input.txt: xorriso/gen_input.sh xorriso/%.sh: xorriso/%.sh.in sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/xorriso/$*.sh.in > $(base_dir)/xorriso/$*.sh - sed 's/@VERSION@/$(version)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp + sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp mv $(base_dir)/xorriso/$*.sh{.tmp,} sed 's/@ARCH@/$(arch)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp mv $(base_dir)/xorriso/$*.sh{.tmp,} diff --git a/xorriso/gen_input.sh.in b/xorriso/gen_input.sh.in index 44b5b478..7eb58fd4 100644 --- a/xorriso/gen_input.sh.in +++ b/xorriso/gen_input.sh.in @@ -1,13 +1,13 @@ #!/bin/bash echo "-indev $(pwd)/boot.iso" -echo "-outdev $(pwd)/output/@IMAGE_NAME@-@VERSION@.iso" +echo "-outdev $(pwd)/@IMAGE_NAME@-@IMAGE_TAG@.iso" echo "-boot_image any replay" -echo "-volid @IMAGE_NAME@-@ARCH@-@VERSION@" +echo "-volid @IMAGE_NAME@-@ARCH@-@IMAGE_TAG@" echo "-joliet on" echo "-compliance joliet_long_names" cd container -for file in $(find @IMAGE_NAME@-@VERSION@) +for file in $(find @IMAGE_NAME@-@IMAGE_TAG@) do echo "-map $(pwd)/${file} ${file}" echo "-chmod 0444 ${file}" From 4d460abf7e6547a8ab8529231d7eeebf9df3b0fc Mon Sep 17 00:00:00 2001 From: Noel Miller Date: Fri, 16 Feb 2024 01:53:54 -0600 Subject: [PATCH 02/19] fix: added output back X_X --- xorriso/gen_input.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xorriso/gen_input.sh.in b/xorriso/gen_input.sh.in index 7eb58fd4..dbc167df 100644 --- a/xorriso/gen_input.sh.in +++ b/xorriso/gen_input.sh.in @@ -1,7 +1,7 @@ #!/bin/bash echo "-indev $(pwd)/boot.iso" -echo "-outdev $(pwd)/@IMAGE_NAME@-@IMAGE_TAG@.iso" +echo "-outdev $(pwd)/output/@IMAGE_NAME@-@IMAGE_TAG@.iso" echo "-boot_image any replay" echo "-volid @IMAGE_NAME@-@ARCH@-@IMAGE_TAG@" echo "-joliet on" From ffaea0d6c940ce0af8c5d582faff5a5188a9a538 Mon Sep 17 00:00:00 2001 From: Noel Miller Date: Fri, 16 Feb 2024 02:29:11 -0600 Subject: [PATCH 03/19] fix: fixed volid --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b07db351..533b5d9e 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ $(image_name)-$(version).iso: boot.iso container/$(image_name)-$(version) xorris boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl rm -Rf $(base_dir)/results lorax -p $(image_name) -v $(version) -r $(version) -t $(variant) \ - --isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(version) \ + --isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(image_tag) \ $(lorax_args) \ --repo /etc/yum.repos.d/fedora.repo \ --repo /etc/yum.repos.d/fedora-updates.repo \ From d4052a4fadf8e5e6ea83cc6af8b5e4131f4e5bab Mon Sep 17 00:00:00 2001 From: Noel Miller Date: Fri, 16 Feb 2024 02:55:22 -0600 Subject: [PATCH 04/19] fix: replaced @VERSION@ with IMAGE_TAG --- Makefile | 4 ++-- lorax_templates/configure_upgrades.tmpl.in | 6 +++--- lorax_templates/set_installer.tmpl.in | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 533b5d9e..3ea595d7 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades. $(base_dir)/results/ mv $(base_dir)/results/images/boot.iso $(base_dir)/ -container/$(image_name)-$(version): +container/$(image_name)-$(image_tag): mkdir container podman pull $(image_repo)/$(image_name):$(image_tag) podman save --format oci-dir -o $(base_dir)/container/$(image_name)-$(image_tag) $(image_repo)/$(image_name):$(image_tag) @@ -50,7 +50,7 @@ lorax_templates/%.tmpl: lorax_templates/%.tmpl.in sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/lorax_templates/$*.tmpl.in > $(base_dir)/lorax_templates/$*.tmpl sed 's/@IMAGE_REPO@/$(image_repo_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} - sed 's/@VERSION@/$(version)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp + sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} sed 's/@IMAGE_REPO_ESCAPED@/$(image_repo_double_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} diff --git a/lorax_templates/configure_upgrades.tmpl.in b/lorax_templates/configure_upgrades.tmpl.in index 498bf252..1bc7eddc 100644 --- a/lorax_templates/configure_upgrades.tmpl.in +++ b/lorax_templates/configure_upgrades.tmpl.in @@ -1,7 +1,7 @@ append usr/share/anaconda/interactive-defaults.ks "%post --erroronfail" -append usr/share/anaconda/interactive-defaults.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@VERSION@/' /ostree/deploy/default/deploy/*.origin" +append usr/share/anaconda/interactive-defaults.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@IMAGE_TAG@/' /ostree/deploy/default/deploy/*.origin" append usr/share/anaconda/interactive-defaults.ks "%end" append usr/share/anaconda/post-scripts/configure_upgrades.ks "%post --erroronfail" -append usr/share/anaconda/post-scripts/configure_upgrades.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@VERSION@/' /ostree/deploy/default/deploy/*.origin" -append usr/share/anaconda/post-scripts/configure_upgrades.ks "%end" \ No newline at end of file +append usr/share/anaconda/post-scripts/configure_upgrades.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@IMAGE_TAG@/' /ostree/deploy/default/deploy/*.origin" +append usr/share/anaconda/post-scripts/configure_upgrades.ks "%end" diff --git a/lorax_templates/set_installer.tmpl.in b/lorax_templates/set_installer.tmpl.in index 13332ff6..9021e18e 100644 --- a/lorax_templates/set_installer.tmpl.in +++ b/lorax_templates/set_installer.tmpl.in @@ -1 +1 @@ -append usr/share/anaconda/interactive-defaults.ks "ostreecontainer --url=/run/install/repo/@IMAGE_NAME@-@VERSION@ --transport=oci --no-signature-verification" \ No newline at end of file +append usr/share/anaconda/interactive-defaults.ks "ostreecontainer --url=/run/install/repo/@IMAGE_NAME@-@IMAGE_TAG@ --transport=oci --no-signature-verification" From 15bab3a80c6b997dbddba9ce4a3b3f6e8807b36a Mon Sep 17 00:00:00 2001 From: Noel Miller Date: Fri, 16 Feb 2024 03:07:28 -0600 Subject: [PATCH 05/19] fix: replaced version with image_tag --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3ea595d7..2da8e32b 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ ifeq ($(web_ui),true) lorax_args += -i anaconda-webui endif -$(image_name)-$(version).iso: boot.iso container/$(image_name)-$(version) xorriso/input.txt +$(image_name)-$(image_tag).iso: boot.iso container/$(image_name)-$(image_tag) xorriso/input.txt xorriso -dialog on < $(base_dir)/xorriso/input.txt boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl From 7ade13b85a931198430c67255a5f4eb3b7276695 Mon Sep 17 00:00:00 2001 From: Noel Miller Date: Fri, 16 Feb 2024 03:31:53 -0600 Subject: [PATCH 06/19] fix: replaced version with IMAGE_TAG --- .github/workflows/iso.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index a0b0c6c1..d5806ffe 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -22,6 +22,9 @@ on: IMAGE_REPO: required: true type: string + IMAGE_TAG: + required: true + type: string VARIANT: required: true type: string @@ -38,6 +41,7 @@ env: IMAGE_VERSION: ${{ inputs.IMAGE_VERSION || '39' }} IMAGE_ARCH: ${{ inputs.IMAGE_ARCH || 'x86_64' }} IMAGE_NAME: ${{ inputs.IMAGE_NAME || 'base-main' }} + IMAGE_TAG: ${{ inputs.IMAGE_TAG || 'latest' }} IMAGE_REPO: ${{ inputs.IMAGE_REPO || 'ghcr.io/ublue-os' }} VARIANT: ${{ inputs.VARIANT || 'Silverblue' }} CURR_REPO: ${{ inputs.BUILD_REPO || github.repository }} @@ -74,9 +78,9 @@ jobs: - name: Download image run: | - make container/${IMAGE_NAME}-${IMAGE_VERSION} \ + make container/${IMAGE_NAME}-${IMAGE_TAG} \ arch=${IMAGE_ARCH} \ - version=${IMAGE_VERSION} \ + image_tag=${IMAGE_TAG} \ image_repo=${{ steps.registry_case.outputs.lowercase }} \ image_name=${IMAGE_NAME} \ variant=${VARIANT} @@ -87,24 +91,26 @@ jobs: arch=${IMAGE_ARCH} \ version=${IMAGE_VERSION} \ image_repo=${{ steps.registry_case.outputs.lowercase }} \ + image_tag=${IMAGE_TAG} image_name=${IMAGE_NAME} \ variant=${VARIANT} - - name: Create deploy.iso + - name: Create ${IMAGE_NAME}-${IMAGE_TAG} run: | - make ${IMAGE_NAME}-${IMAGE_VERSION}.iso \ + make ${IMAGE_NAME}-${IMAGE_TAG}.iso \ arch=${IMAGE_ARCH} \ version=${IMAGE_VERSION} \ image_repo=${{ steps.registry_case.outputs.lowercase }} \ + image_tag=${IMAGE_TAG} image_name=${IMAGE_NAME} \ variant=${VARIANT} mkdir end_iso - mv ${IMAGE_NAME}-${IMAGE_VERSION}.iso end_iso/ + mv ${IMAGE_NAME}-${IMAGE_TAG}.iso end_iso/ - name: Upload ISO as artifact uses: actions/upload-artifact@v4 with: - name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}.iso + name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_TAG }}.iso path: end_iso/*.iso if-no-files-found: error retention-days: 0 From c52c3cf514ef8a4c9c94ef2c43b6f9bde11b8642 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 12:05:31 -0600 Subject: [PATCH 07/19] fix: use VERSION in ISO filename and VOLID --- Makefile | 13 +++++++------ lorax_templates/configure_upgrades.tmpl.in | 2 +- lorax_templates/set_installer.tmpl.in | 2 +- xorriso/gen_input.sh.in | 6 +++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 2da8e32b..317f7740 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,13 @@ ifeq ($(web_ui),true) lorax_args += -i anaconda-webui endif -$(image_name)-$(image_tag).iso: boot.iso container/$(image_name)-$(image_tag) xorriso/input.txt +$(image_name)-$(version).iso: boot.iso container/$(image_name)-$(image_tag) xorriso/input.txt xorriso -dialog on < $(base_dir)/xorriso/input.txt boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl rm -Rf $(base_dir)/results lorax -p $(image_name) -v $(version) -r $(version) -t $(variant) \ - --isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(image_tag) \ + --isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(version) \ $(lorax_args) \ --repo /etc/yum.repos.d/fedora.repo \ --repo /etc/yum.repos.d/fedora-updates.repo \ @@ -50,7 +50,7 @@ lorax_templates/%.tmpl: lorax_templates/%.tmpl.in sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/lorax_templates/$*.tmpl.in > $(base_dir)/lorax_templates/$*.tmpl sed 's/@IMAGE_REPO@/$(image_repo_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} - sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp + sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} sed 's/@IMAGE_REPO_ESCAPED@/$(image_repo_double_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} @@ -61,8 +61,9 @@ xorriso/input.txt: xorriso/gen_input.sh bash $(base_dir)/xorriso/gen_input.sh | tee $(base_dir)/xorriso/input.txt xorriso/%.sh: xorriso/%.sh.in - sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/xorriso/$*.sh.in > $(base_dir)/xorriso/$*.sh - sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp + sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/xorriso/$*.sh.in > $(base_dir)/xorriso/$*.sh.in2 + sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/xorriso/$*.sh.in2 > $(base_dir)/xorriso/$*.sh + sed 's/@VERSION@/$(version)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp mv $(base_dir)/xorriso/$*.sh{.tmp,} sed 's/@ARCH@/$(arch)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp mv $(base_dir)/xorriso/$*.sh{.tmp,} @@ -79,6 +80,6 @@ clean: rm -f $(base_dir)/{original,final}-pkgsizes.txt || true rm -f $(base_dir)/lorax.conf || true rm -f $(base_dir)/*.iso || true - rm -f $(base_dir)/*.log || true + rm -f $(base_dir)/*.log || true diff --git a/lorax_templates/configure_upgrades.tmpl.in b/lorax_templates/configure_upgrades.tmpl.in index 1bc7eddc..688cf797 100644 --- a/lorax_templates/configure_upgrades.tmpl.in +++ b/lorax_templates/configure_upgrades.tmpl.in @@ -4,4 +4,4 @@ append usr/share/anaconda/interactive-defaults.ks "%end" append usr/share/anaconda/post-scripts/configure_upgrades.ks "%post --erroronfail" append usr/share/anaconda/post-scripts/configure_upgrades.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@IMAGE_TAG@/' /ostree/deploy/default/deploy/*.origin" -append usr/share/anaconda/post-scripts/configure_upgrades.ks "%end" +append usr/share/anaconda/post-scripts/configure_upgrades.ks "%end" \ No newline at end of file diff --git a/lorax_templates/set_installer.tmpl.in b/lorax_templates/set_installer.tmpl.in index 9021e18e..522d99a3 100644 --- a/lorax_templates/set_installer.tmpl.in +++ b/lorax_templates/set_installer.tmpl.in @@ -1 +1 @@ -append usr/share/anaconda/interactive-defaults.ks "ostreecontainer --url=/run/install/repo/@IMAGE_NAME@-@IMAGE_TAG@ --transport=oci --no-signature-verification" +append usr/share/anaconda/interactive-defaults.ks "ostreecontainer --url=/run/install/repo/@IMAGE_NAME@-@IMAGE_TAG@ --transport=oci --no-signature-verification" \ No newline at end of file diff --git a/xorriso/gen_input.sh.in b/xorriso/gen_input.sh.in index dbc167df..95118099 100644 --- a/xorriso/gen_input.sh.in +++ b/xorriso/gen_input.sh.in @@ -1,9 +1,9 @@ #!/bin/bash echo "-indev $(pwd)/boot.iso" -echo "-outdev $(pwd)/output/@IMAGE_NAME@-@IMAGE_TAG@.iso" +echo "-outdev $(pwd)/@IMAGE_NAME@-@VERSION@.iso" echo "-boot_image any replay" -echo "-volid @IMAGE_NAME@-@ARCH@-@IMAGE_TAG@" +echo "-volid @IMAGE_NAME@-@ARCH@-@VERSION@" echo "-joliet on" echo "-compliance joliet_long_names" cd container @@ -12,4 +12,4 @@ do echo "-map $(pwd)/${file} ${file}" echo "-chmod 0444 ${file}" done -echo "-end" +echo "-end" \ No newline at end of file From b76eb6405e9f2882c0aa02ef45d011087ead2e72 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:19:23 -0600 Subject: [PATCH 08/19] feat: build isogenerator image --- .github/workflows/isogenerator-image.yml | 118 +++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 .github/workflows/isogenerator-image.yml diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml new file mode 100644 index 00000000..f3c49bf9 --- /dev/null +++ b/.github/workflows/isogenerator-image.yml @@ -0,0 +1,118 @@ +--- +name: isogenerator-image +on: + pull_request: + branches: + - main + paths: + - 'Dockerfile' + push: + branches: + - main + paths: + - 'Dockerfile' + workflow_dispatch: + +env: + IMAGE_NAME: isogenerator + IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" + +jobs: + push-ghcr: + name: Build and push image + runs-on: ubuntu-22.04 + + permissions: + contents: read + packages: write + id-token: write + + strategy: + fail-fast: false + + steps: + # Checkout push-to-registry action GitHub repository + - name: Checkout Push to Registry action + uses: actions/checkout@v3 + + - name: Generate tags + id: generate-tags + shell: bash + run: | + # Generate a timestamp for creating an image version history + TIMESTAMP="$(date +%Y%m%d)" + + COMMIT_TAGS=() + BUILD_TAGS=() + + # Have tags for tracking builds during pull request + SHA_SHORT="${GITHUB_SHA::7}" + COMMIT_TAGS+=("pr-${{ github.event.number }} + COMMIT_TAGS+=("${SHA_SHORT} + + COMMIT_TAGS+=("pr-${{ github.event.number }}") + COMMIT_TAGS+=("${SHA_SHORT}") + + BUILD_TAGS+=("${TIMESTAMP}") + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "Generated the following commit tags: " + for TAG in "${COMMIT_TAGS[@]}"; do + echo "${TAG}" + done + + alias_tags=("${COMMIT_TAGS[@]}") + else + BUILD_TAGS+=("latest") + alias_tags=("${BUILD_TAGS[@]}") + fi + + echo "Generated the following build tags: " + for TAG in "${BUILD_TAGS[@]}"; do + echo "${TAG}" + done + + echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT + + # Build metadata + - name: Image Metadata + uses: docker/metadata-action@v4 + id: meta + with: + images: | + ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }} + + labels: | + io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md + org.opencontainers.image.description=A container image for generating Universal Blue ISO files + org.opencontainers.image.title=${{ env.IMAGE_NAME }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Image + uses: docker/build-push-action@v4 + with: + context: ./ + file: ./Dockerfile + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.generate-tags.outputs.alias_tags }} + + check: + name: Check build successful + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + needs: [isogenerator-image] + steps: + - name: Exit on failure + if: ${{ needs.isogenerator-image.result == 'failure' || needs.isogenerator-image.result == 'skipped' }} + shell: bash + run: exit 1 + - name: Exit + shell: bash + run: exit 0 From bc1e79e6c9e7f2c22697a6d178b3e188ccba3489 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:19:45 -0600 Subject: [PATCH 09/19] refactor: kinoite variant is better except for silverblue --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7cc04924..bb592266 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV VERSION="39" ENV IMAGE_REPO="ghcr.io/ublue-os" ENV IMAGE_NAME="base-main" ENV IMAGE_TAG="$(version)" -ENV VARIANT="Silverblue" +ENV VARIANT="Kinoite" ENV WEB_UI="false" WORKDIR /isogenerator From 80013189caf611ad51c27801c0a5b1f4ee342a36 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:21:43 -0600 Subject: [PATCH 10/19] chore(ci): isogenerator image build --- .github/workflows/isogenerator-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml index f3c49bf9..561d029c 100644 --- a/.github/workflows/isogenerator-image.yml +++ b/.github/workflows/isogenerator-image.yml @@ -18,7 +18,7 @@ env: IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" jobs: - push-ghcr: + push-image: name: Build and push image runs-on: ubuntu-22.04 @@ -107,10 +107,10 @@ jobs: name: Check build successful if: ${{ !cancelled() }} runs-on: ubuntu-latest - needs: [isogenerator-image] + needs: [push-image] steps: - name: Exit on failure - if: ${{ needs.isogenerator-image.result == 'failure' || needs.isogenerator-image.result == 'skipped' }} + if: ${{ needs.push-image.result == 'failure' || needs.push-image.result == 'skipped' }} shell: bash run: exit 1 - name: Exit From 74eace4414ffd40619f17ea07635c8bb084d9eb0 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:23:55 -0600 Subject: [PATCH 11/19] chore(ci): fix parens --- .github/workflows/isogenerator-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml index 561d029c..82d6f1e8 100644 --- a/.github/workflows/isogenerator-image.yml +++ b/.github/workflows/isogenerator-image.yml @@ -47,8 +47,8 @@ jobs: # Have tags for tracking builds during pull request SHA_SHORT="${GITHUB_SHA::7}" - COMMIT_TAGS+=("pr-${{ github.event.number }} - COMMIT_TAGS+=("${SHA_SHORT} + COMMIT_TAGS+=("pr-${{ github.event.number }}) + COMMIT_TAGS+=("${SHA_SHORT}) COMMIT_TAGS+=("pr-${{ github.event.number }}") COMMIT_TAGS+=("${SHA_SHORT}") From 7bafe540a5497acaaf789469f81ef6f53d2e91db Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:26:00 -0600 Subject: [PATCH 12/19] chore(ci): fix quotes --- .github/workflows/isogenerator-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml index 82d6f1e8..a24acb59 100644 --- a/.github/workflows/isogenerator-image.yml +++ b/.github/workflows/isogenerator-image.yml @@ -47,8 +47,8 @@ jobs: # Have tags for tracking builds during pull request SHA_SHORT="${GITHUB_SHA::7}" - COMMIT_TAGS+=("pr-${{ github.event.number }}) - COMMIT_TAGS+=("${SHA_SHORT}) + COMMIT_TAGS+=("pr-${{ github.event.number }}") + COMMIT_TAGS+=("${SHA_SHORT}") COMMIT_TAGS+=("pr-${{ github.event.number }}") COMMIT_TAGS+=("${SHA_SHORT}") From 996510769e7b65d0ea6c79c7599e9dbed15d87c6 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:32:19 -0600 Subject: [PATCH 13/19] refactor(ci): use simpler tagging for generator image --- .github/workflows/isogenerator-image.yml | 46 ++++-------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml index a24acb59..c6be3bad 100644 --- a/.github/workflows/isogenerator-image.yml +++ b/.github/workflows/isogenerator-image.yml @@ -35,45 +35,6 @@ jobs: - name: Checkout Push to Registry action uses: actions/checkout@v3 - - name: Generate tags - id: generate-tags - shell: bash - run: | - # Generate a timestamp for creating an image version history - TIMESTAMP="$(date +%Y%m%d)" - - COMMIT_TAGS=() - BUILD_TAGS=() - - # Have tags for tracking builds during pull request - SHA_SHORT="${GITHUB_SHA::7}" - COMMIT_TAGS+=("pr-${{ github.event.number }}") - COMMIT_TAGS+=("${SHA_SHORT}") - - COMMIT_TAGS+=("pr-${{ github.event.number }}") - COMMIT_TAGS+=("${SHA_SHORT}") - - BUILD_TAGS+=("${TIMESTAMP}") - - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - echo "Generated the following commit tags: " - for TAG in "${COMMIT_TAGS[@]}"; do - echo "${TAG}" - done - - alias_tags=("${COMMIT_TAGS[@]}") - else - BUILD_TAGS+=("latest") - alias_tags=("${BUILD_TAGS[@]}") - fi - - echo "Generated the following build tags: " - for TAG in "${BUILD_TAGS[@]}"; do - echo "${TAG}" - done - - echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT - # Build metadata - name: Image Metadata uses: docker/metadata-action@v4 @@ -86,6 +47,11 @@ jobs: io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md org.opencontainers.image.description=A container image for generating Universal Blue ISO files org.opencontainers.image.title=${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} - name: Login to GitHub Container Registry uses: docker/login-action@v2 @@ -101,7 +67,7 @@ jobs: file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} labels: ${{ steps.meta.outputs.labels }} - tags: ${{ steps.generate-tags.outputs.alias_tags }} + tags: ${{ steps.meta.outputs.tags }} check: name: Check build successful From 35bd54d2645195d84913a373852f724b16c56585 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:40:49 -0600 Subject: [PATCH 14/19] fix: use output directory for resulting ISO --- xorriso/gen_input.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xorriso/gen_input.sh.in b/xorriso/gen_input.sh.in index 95118099..299cfc3a 100644 --- a/xorriso/gen_input.sh.in +++ b/xorriso/gen_input.sh.in @@ -1,7 +1,7 @@ #!/bin/bash echo "-indev $(pwd)/boot.iso" -echo "-outdev $(pwd)/@IMAGE_NAME@-@VERSION@.iso" +echo "-outdev $(pwd)/output/@IMAGE_NAME@-@VERSION@.iso" echo "-boot_image any replay" echo "-volid @IMAGE_NAME@-@ARCH@-@VERSION@" echo "-joliet on" From 313928c426834de8f6f623aacd62f9d74fb5de64 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:53:39 -0600 Subject: [PATCH 15/19] refactor: using docker to build ISO --- .github/workflows/iso.yml | 90 +++++++++++++-------------------------- Dockerfile | 4 +- 2 files changed, 31 insertions(+), 63 deletions(-) diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index 3c718fc3..8636cff9 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -11,10 +11,7 @@ on: workflow_call: inputs: - IMAGE_VERSION: - required: true - type: string - IMAGE_ARCH: + ARCH: required: true type: string IMAGE_NAME: @@ -29,90 +26,61 @@ on: VARIANT: required: true type: string + VERSION: + required: true + type: string + WEB_UI: + required: true + type: string BUILD_REPO: required: false type: string - default: JasonN3/container-installer + default: ublue-os/isogenerator BUILD_REF: required: false type: string default: main env: - IMAGE_VERSION: ${{ inputs.IMAGE_VERSION || '39' }} - IMAGE_ARCH: ${{ inputs.IMAGE_ARCH || 'x86_64' }} + ARCH: ${{ inputs.ARCH || 'x86_64' }} IMAGE_NAME: ${{ inputs.IMAGE_NAME || 'base-main' }} - IMAGE_TAG: ${{ inputs.IMAGE_TAG || 'latest' }} IMAGE_REPO: ${{ inputs.IMAGE_REPO || 'ghcr.io/ublue-os' }} - VARIANT: ${{ inputs.VARIANT || 'Silverblue' }} + IMAGE_TAG: ${{ inputs.IMAGE_TAG || 'latest' }} + VARIANT: ${{ inputs.VARIANT || 'Kinoite' }} + VERSION: ${{ inputs.VERSION || '39' }} + WEB_UI: ${{ inputs.WEB_UI || 'false' }} CURR_REPO: ${{ inputs.BUILD_REPO || github.repository }} CURR_REF: ${{ inputs.BUILD_REF || github.ref }} jobs: build-and-push-iso: runs-on: ubuntu-latest - container: - image: fedora:39 - options: "--privileged" permissions: contents: read packages: write steps: - - name: Install make and git - run: dnf install -y make git - - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: ${{ env.CURR_REPO }} - ref: ${{ env.CURR_REF }} - submodules: recursive - - - name: Install dependencies - run: make install-deps - - - name: Lowercase Registry - id: registry_case - uses: ASzc/change-string-case-action@v6 - with: - string: ${{ env.IMAGE_REPO }} - - - name: Download image - run: | - make container/${IMAGE_NAME}-${IMAGE_TAG} \ - arch=${IMAGE_ARCH} \ - image_tag=${IMAGE_TAG} \ - image_repo=${{ steps.registry_case.outputs.lowercase }} \ - image_name=${IMAGE_NAME} \ - variant=${VARIANT} - - - name: Create boot.iso - run: | - make boot.iso \ - arch=${IMAGE_ARCH} \ - version=${IMAGE_VERSION} \ - image_repo=${{ steps.registry_case.outputs.lowercase }} \ - image_tag=${IMAGE_TAG} - image_name=${IMAGE_NAME} \ - variant=${VARIANT} - - - name: Create ${IMAGE_NAME}-${IMAGE_TAG} + - name: Build ISO + shell: bash run: | - make ${IMAGE_NAME}-${IMAGE_TAG}.iso \ - arch=${IMAGE_ARCH} \ - version=${IMAGE_VERSION} \ - image_repo=${{ steps.registry_case.outputs.lowercase }} \ - image_tag=${IMAGE_TAG} - image_name=${IMAGE_NAME} \ - variant=${VARIANT} - mkdir end_iso - mv output/${IMAGE_NAME}-${IMAGE_TAG}.iso end_iso/ + set -eo pipefail + mkdir -f output + docker run \ + --rm --privileged \ + -v ./output:/isogenerator/output \ + -e ARCH="${{ env.ARCH }}" \ + -e IMAGE_NAME="${{ env.IMAGE_NAME }}" \ + -e IMAGE_REPO="${{ env.IMAGE_REPO }}" \ + -e IMAGE_TAG="${{ env.IMAGE_TAG }}" \ + -e VARIANT="${{ env.VARIANT }}" \ + -e VERSION="${{ env.VERSION }}" \ + -e WEB_UI="${{ env.WEB_UI }}" \ + isogenerator - name: Upload ISO as artifact uses: actions/upload-artifact@v4 with: name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_TAG }}.iso - path: end_iso/*.iso + path: output/*.iso if-no-files-found: error retention-days: 0 compression-level: 0 diff --git a/Dockerfile b/Dockerfile index bb592266..652cbd1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ FROM fedora:latest ENV ARCH="x86_64" -ENV VERSION="39" -ENV IMAGE_REPO="ghcr.io/ublue-os" ENV IMAGE_NAME="base-main" +ENV IMAGE_REPO="ghcr.io/ublue-os" ENV IMAGE_TAG="$(version)" ENV VARIANT="Kinoite" +ENV VERSION="39" ENV WEB_UI="false" WORKDIR /isogenerator From 553df3fbc75e4c88beff0de1596a757b53139771 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:54:59 -0600 Subject: [PATCH 16/19] chore: benjamin makes mistakes --- .github/workflows/iso.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index 8636cff9..8f1f5061 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -63,7 +63,7 @@ jobs: shell: bash run: | set -eo pipefail - mkdir -f output + mkdir -p output docker run \ --rm --privileged \ -v ./output:/isogenerator/output \ From fef35da0228071cbfefe71b11669b3e4edb2e73f Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 13:58:05 -0600 Subject: [PATCH 17/19] refactor: use full url for image --- .github/workflows/iso.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index 8f1f5061..a3de020e 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -74,7 +74,7 @@ jobs: -e VARIANT="${{ env.VARIANT }}" \ -e VERSION="${{ env.VERSION }}" \ -e WEB_UI="${{ env.WEB_UI }}" \ - isogenerator + ghcr.io/ublue-os/isogenerator:latest - name: Upload ISO as artifact uses: actions/upload-artifact@v4 From f62271f0ffa37012bd29a2b5c3ab42f10fe3fd2e Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 14:00:07 -0600 Subject: [PATCH 18/19] chore: TEMP change to validate full workflow --- .github/workflows/iso.yml | 2 +- .github/workflows/isogenerator-image.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index a3de020e..dc9e9d74 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -74,7 +74,7 @@ jobs: -e VARIANT="${{ env.VARIANT }}" \ -e VERSION="${{ env.VERSION }}" \ -e WEB_UI="${{ env.WEB_UI }}" \ - ghcr.io/ublue-os/isogenerator:latest + ghcr.io/ublue-os/isogenerator:pr-6 - name: Upload ISO as artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml index c6be3bad..126fa888 100644 --- a/.github/workflows/isogenerator-image.yml +++ b/.github/workflows/isogenerator-image.yml @@ -65,7 +65,8 @@ jobs: with: context: ./ file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} + #push: ${{ github.event_name != 'pull_request' }} + push: true labels: ${{ steps.meta.outputs.labels }} tags: ${{ steps.meta.outputs.tags }} From 4c3895d90de22b6f1b95a0a8863140959ac7caa3 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 16 Feb 2024 14:33:54 -0600 Subject: [PATCH 19/19] Revert "chore: TEMP change to validate full workflow" This reverts commit f62271f0ffa37012bd29a2b5c3ab42f10fe3fd2e. --- .github/workflows/iso.yml | 2 +- .github/workflows/isogenerator-image.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index dc9e9d74..a3de020e 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -74,7 +74,7 @@ jobs: -e VARIANT="${{ env.VARIANT }}" \ -e VERSION="${{ env.VERSION }}" \ -e WEB_UI="${{ env.WEB_UI }}" \ - ghcr.io/ublue-os/isogenerator:pr-6 + ghcr.io/ublue-os/isogenerator:latest - name: Upload ISO as artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml index 126fa888..c6be3bad 100644 --- a/.github/workflows/isogenerator-image.yml +++ b/.github/workflows/isogenerator-image.yml @@ -65,8 +65,7 @@ jobs: with: context: ./ file: ./Dockerfile - #push: ${{ github.event_name != 'pull_request' }} - push: true + push: ${{ github.event_name != 'pull_request' }} labels: ${{ steps.meta.outputs.labels }} tags: ${{ steps.meta.outputs.tags }}