From 383427c619a8b6f0f008f7fb55ee3a721662381b Mon Sep 17 00:00:00 2001 From: Jason Nagin <33561705+JasonN3@users.noreply.github.com> Date: Thu, 9 May 2024 15:39:51 -0400 Subject: [PATCH] Add build for Fedora-bootc (#105) --- .codacy/markdownlint.rb | 2 + .github/ISSUE_TEMPLATE/bug_report.md | 6 +- .github/workflows/build_iso.yml | 35 ++++------- .github/workflows/build_vars.yml | 51 +++++++++++++--- .github/workflows/test_deployment.yml | 43 ++++++------- .github/workflows/test_iso.yml | 39 +++++------- .github/workflows/tests.yml | 88 ++++----------------------- .mdlrc | 1 + Makefile | 13 ++-- README.md | 71 +++++++++++++-------- action.yml | 1 + external/Makefile | 2 +- test/iso/install_os-release.sh | 2 +- test/repo/vars.py | 4 +- test/vm/Makefile | 4 +- xorriso/Makefile | 3 +- xorriso/gen_input.sh | 7 ++- 17 files changed, 174 insertions(+), 198 deletions(-) create mode 100644 .codacy/markdownlint.rb create mode 100644 .mdlrc diff --git a/.codacy/markdownlint.rb b/.codacy/markdownlint.rb new file mode 100644 index 0000000..fcd51bc --- /dev/null +++ b/.codacy/markdownlint.rb @@ -0,0 +1,2 @@ +all +rule 'MD033', :allowed_elements => ["a","img","picture","source"] \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b443a7a..4cac71d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -12,6 +12,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,8 +25,9 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/workflows/build_iso.yml b/.github/workflows/build_iso.yml index 54e309f..990de53 100644 --- a/.github/workflows/build_iso.yml +++ b/.github/workflows/build_iso.yml @@ -9,15 +9,6 @@ on: parent_job_name: required: true type: string - flatpaks_refs: - required: false - type: string - flatpaks_refs_dir: - required: false - type: string - suffix: - required: false - type: string jobs: load_vars: @@ -38,8 +29,7 @@ jobs: continue-on-error: false strategy: fail-fast: false - matrix: - version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }} + matrix: ${{ fromJson(needs.load_vars.outputs.BUILD_MATRIX) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -63,7 +53,7 @@ jobs: id: jobs with: github_token: ${{ secrets.GITHUB_TOKEN }} - job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }})" + job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" per_page: 100 - name: Set status @@ -72,7 +62,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} status: pending - context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + context: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" sha: ${{ env.sha }} targetUrl: ${{ steps.jobs.outputs.html_url }} @@ -115,25 +105,26 @@ jobs: id: build with: arch: ${{ needs.load_vars.outputs.ARCH }} - image_name: ${{ needs.load_vars.outputs.IMAGE_NAME }} - image_repo: ${{ needs.load_vars.outputs.IMAGE_REPO }} + image_name: ${{ matrix.image_name }} + image_repo: ${{ matrix.image_repo}} image_tag: ${{ matrix.version }} version: ${{ matrix.version }} + repos: ${{ matrix.repos }} variant: ${{ needs.load_vars.outputs.VARIANT }} - flatpak_remote_refs: ${{ inputs.flatpaks_refs }} - flatpak_remote_refs_dir: ${{ inputs.flatpaks_refs_dir }} + flatpak_remote_refs: ${{ matrix.flatpaks == 'flatpak_refs' && needs.load_vars.outputs.FLATPAK_REMOTE_REFS || '' }} + flatpak_remote_refs_dir: ${{ matrix.flatpaks == 'flatpak_refs_dir' && needs.load_vars.outputs.FLATPAK_REMOTE_REFS_DIR || '' }} secure_boot_key_url: ${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} enrollment_password: ${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }} - iso_name: build/${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso + iso_name: build/${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }}.iso - name: Upload ISO as artifact id: upload uses: actions/upload-artifact@v4 with: - name: ${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }} + name: ${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }} path: | - build/${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso - build/${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso-CHECKSUM + build/${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }}.iso + build/${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }}.iso-CHECKSUM if-no-files-found: error retention-days: 0 compression-level: 0 @@ -145,7 +136,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} status: ${{ job.status }} - context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + context: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" sha: ${{ env.sha }} targetUrl: ${{ steps.jobs.outputs.html_url }} diff --git a/.github/workflows/build_vars.yml b/.github/workflows/build_vars.yml index ce4e273..55b53cc 100644 --- a/.github/workflows/build_vars.yml +++ b/.github/workflows/build_vars.yml @@ -5,18 +5,53 @@ on: outputs: ARCH: value: 'x86_64' - BUILD_VERSIONS: - value: '[38, 39, 40]' - IMAGE_NAME: - value: 'base' - IMAGE_REPO: - value: 'quay.io/fedora-ostree-desktops' - IMAGE_TAG: - value: '39' + BUILD_MATRIX: + value: ' + { + "version": [ + "38", + "39", + "40", + ], + "flatpaks": [ + "false", + "flatpak_dir", + "flatpak_refs" + ], + "exclude": [ + { + "version": "40", + "flatpaks": "flatpak_dir" + }, + { + "version": "40", + "flatpaks": "flatpak_refs" + } + ], + "include": [ + { + "version": "38", + "image_repo": "quay.io/fedora-ostree-desktops", + "image_name": "base" + }, + { + "version": "39", + "image_repo": "quay.io/fedora-ostree-desktops", + "image_name": "base" + }, + { + "version": "40", + "image_repo": "quay.io/fedora", + "image_name": "fedora-bootc" + } + ] + }' VARIANT: value: 'Server' FLATPAK_REMOTE_REFS_DIR: value: flatpak_refs + FLATPAK_REMOTE_REFS: + value: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable" SECURE_BOOT_KEY_URL: value: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der' ENROLLMENT_PASSWORD: diff --git a/.github/workflows/test_deployment.yml b/.github/workflows/test_deployment.yml index da2a2b2..792b68a 100644 --- a/.github/workflows/test_deployment.yml +++ b/.github/workflows/test_deployment.yml @@ -9,15 +9,6 @@ on: parent_job_name: required: true type: string - flatpaks_refs: - required: false - type: string - flatpaks_refs_dir: - required: false - type: string - suffix: - required: false - type: string jobs: load_vars: @@ -37,8 +28,7 @@ jobs: continue-on-error: false strategy: fail-fast: false - matrix: - version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }} + matrix: ${{ fromJson(needs.load_vars.outputs.BUILD_MATRIX) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -62,7 +52,7 @@ jobs: id: jobs with: github_token: ${{ secrets.GITHUB_TOKEN }} - job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }})" + job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" per_page: 100 - name: Set status @@ -71,7 +61,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} status: pending - context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + context: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" sha: ${{ env.sha }} targetUrl: ${{ steps.jobs.outputs.html_url }} @@ -84,7 +74,7 @@ jobs: - name: Download generated ISO uses: actions/download-artifact@v4 with: - name: ${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }} + name: ${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }} - name: Run VM Tests env: @@ -93,18 +83,23 @@ jobs: VM_IP: "127.0.0.1" VM_PORT: "5555" run: | - make test/vm ISO_NAME=${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso \ - VM_IP=${VM_IP} VM_PORT=${VM_PORT} VM_USER=${VM_USER} VM_PASS=${VM_PASS} \ + make test/vm \ ARCH=${{ needs.load_vars.outputs.ARCH}} \ - IMAGE_NAME=${{ needs.load_vars.outputs.IMAGE_NAME}} \ - IMAGE_REPO=${{ needs.load_vars.outputs.IMAGE_REPO}} \ + ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }} \ + ${{ matrix.flatpaks == 'flatpak_refs' && format('FLATPAK_REMOTE_REFS="{0}"', needs.load_vars.outputs.FLATPAK_REMOTE_REFS) || '' }} \ + ${{ matrix.flatpaks == 'flatpak_refs_dir' && format('FLATPAK_REMOTE_REFS_DIR="{0}"', needs.load_vars.outputs.FLATPAK_REMOTE_REFS_DIR) || '' }} \ + IMAGE_NAME=${{ matrix.image_name }} \ + IMAGE_REPO=${{ matrix.image_repo }} \ IMAGE_TAG=${{ matrix.version }} \ - VERSION=${{ matrix.version }} \ - VARIANT=${{ needs.load_vars.outputs.VARIANT }} \ - ${{ inputs.flatpaks_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpaks_refs) || '' }} \ - ${{ inputs.flatpaks_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="{0}"', inputs.flatpaks_refs_dir) || '' }} \ + ISO_NAME=${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }}.iso \ + ${{ matrix.repos != '' && format('REPOS="{0}"', matrix.repos) || '' }} \ SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \ - ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }} + VARIANT=${{ needs.load_vars.outputs.VARIANT }} \ + VERSION=${{ matrix.version }} \ + VM_IP=${VM_IP} \ + VM_PASS=${VM_PASS} \ + VM_PORT=${VM_PORT} \ + VM_USER=${VM_USER} - name: Set status if: inputs.pr && always() @@ -112,6 +107,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} status: ${{ job.status }} - context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + context: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" sha: ${{ env.sha }} targetUrl: ${{ steps.jobs.outputs.html_url }} diff --git a/.github/workflows/test_iso.yml b/.github/workflows/test_iso.yml index b78c2a5..3b072d7 100644 --- a/.github/workflows/test_iso.yml +++ b/.github/workflows/test_iso.yml @@ -9,15 +9,6 @@ on: parent_job_name: required: true type: string - flatpaks_refs: - required: false - type: string - flatpaks_refs_dir: - required: false - type: string - suffix: - required: false - type: string jobs: load_vars: @@ -37,8 +28,7 @@ jobs: continue-on-error: false strategy: fail-fast: false - matrix: - version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }} + matrix: ${{ fromJson(needs.load_vars.outputs.BUILD_MATRIX) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -62,7 +52,7 @@ jobs: id: jobs with: github_token: ${{ secrets.GITHUB_TOKEN }} - job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }})" + job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" per_page: 100 - name: Set status @@ -71,7 +61,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} status: pending - context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + context: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" sha: ${{ env.sha }} targetUrl: ${{ steps.jobs.outputs.html_url }} @@ -84,22 +74,23 @@ jobs: - name: Download generated ISO uses: actions/download-artifact@v4 with: - name: ${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }} + name: ${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }} - name: Run ISO checks run: | make test/iso \ ARCH=${{ needs.load_vars.outputs.ARCH}} \ - IMAGE_NAME=${{ needs.load_vars.outputs.IMAGE_NAME}} \ - IMAGE_REPO=${{ needs.load_vars.outputs.IMAGE_REPO}} \ - IMAGE_TAG=${{ matrix.version }} \ - VERSION=${{ matrix.version }} \ - VARIANT=${{ needs.load_vars.outputs.VARIANT }} \ - ${{ inputs.flatpaks_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpaks_refs) || '' }} \ - ${{ inputs.flatpaks_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="{0}"', inputs.flatpaks_refs_dir) || '' }} \ - SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \ ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }} \ - ISO_NAME=${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso + ${{ matrix.flatpaks == 'flatpak_refs' && format('FLATPAK_REMOTE_REFS="{0}"', needs.load_vars.outputs.FLATPAK_REMOTE_REFS) || '' }} \ + ${{ matrix.flatpaks == 'flatpak_refs_dir' && format('FLATPAK_REMOTE_REFS_DIR="{0}"', needs.load_vars.outputs.FLATPAK_REMOTE_REFS_DIR) || '' }} \ + IMAGE_NAME=${{ matrix.image_name }} \ + IMAGE_REPO=${{ matrix.image_repo }} \ + IMAGE_TAG=${{ matrix.version }} \ + ISO_NAME=${{ matrix.image_name }}-${{ matrix.version }}${{ matrix.flatpaks == 'false' && '' || format('-{0}', matrix.flatpaks) }}.iso \ + ${{ matrix.repos != '' && format('REPOS="{0}"', matrix.repos) || '' }} \ + SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \ + VARIANT=${{ needs.load_vars.outputs.VARIANT }} \ + VERSION=${{ matrix.version }} - name: Set status if: inputs.pr && always() @@ -107,6 +98,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} status: ${{ job.status }} - context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + context: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }}, ${{ matrix.flatpaks }})" sha: ${{ env.sha }} targetUrl: ${{ steps.jobs.outputs.html_url }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b715490..651d3f0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,95 +31,29 @@ jobs: pr: ${{ inputs.pr }} parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build Container - build_iso_flatpaks: - name: Build ISO with Flatpaks + build_isos: + name: Build ISOs needs: - build_container uses: ./.github/workflows/build_iso.yml with: pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO with Flatpaks - flatpaks_refs_dir: flatpak_refs - suffix: flatpaks + parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISOs - test_iso_flatpaks: - name: Test ISO with Flatpaks + test_isos: + name: Test ISOs needs: - - build_iso_flatpaks + - build_isos uses: ./.github/workflows/test_iso.yml with: pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO with Flatpaks - flatpaks_refs_dir: flatpak_refs - suffix: flatpaks + parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISOs - test_deployment_flatpaks: - name: Test Deployment with Flatpaks + test_deployments: + name: Test Deployments needs: - - build_iso_flatpaks + - build_isos uses: ./.github/workflows/test_deployment.yml with: pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment with Flatpaks - flatpaks_refs_dir: flatpak_refs - suffix: flatpaks - - build_iso_flatpak_refs: - name: Build ISO with Flatpak Refs - needs: - - build_container - uses: ./.github/workflows/build_iso.yml - with: - pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO with Flatpak Refs - flatpaks_refs: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable" - suffix: flatpaks_refs - - test_iso_flatpak_refs: - name: Test ISO with Flatpak Refs - needs: - - build_iso_flatpak_refs - uses: ./.github/workflows/test_iso.yml - with: - pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO with Flatpak Refs - flatpaks_refs: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable" - suffix: flatpaks_refs - - test_deployment_flatpak_refs: - name: Test Deployment with Flatpak Refs - needs: - - build_iso_flatpak_refs - uses: ./.github/workflows/test_deployment.yml - with: - pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment with Flatpak Refs - flatpaks_refs: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable" - suffix: flatpaks_refs - - build_iso: - name: Build ISO - needs: - - build_container - uses: ./.github/workflows/build_iso.yml - with: - pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO - - test_iso: - name: Test ISO - needs: - - build_iso - uses: ./.github/workflows/test_iso.yml - with: - pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO - - test_deployment: - name: Test Deployment - needs: - - build_iso - uses: ./.github/workflows/test_deployment.yml - with: - pr: ${{ inputs.pr }} - parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment \ No newline at end of file + parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployments diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 0000000..17717c6 --- /dev/null +++ b/.mdlrc @@ -0,0 +1 @@ +style "#{File.dirname(__FILE__)}/.codacy/markdownlint.rb" \ No newline at end of file diff --git a/Makefile b/Makefile index 65557ce..7886947 100644 --- a/Makefile +++ b/Makefile @@ -34,17 +34,18 @@ _TEMPLATE_VARS := ARCH IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCA _VOLID := $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG) ifeq ($(findstring redhat.repo,$(REPOS)),redhat.repo) -_RHEL := true +export _RHEL := true +_LORAX_TEMPLATES += $(call get_templates,rhel) else -_RHEL := false +undefine _RHEL endif ifeq ($(_RHEL),true) _LORAX_ARGS += --nomacboot --noupgrade else ifeq ($(VARIANT),Server) -_LORAX_ARGS += --macboot --noupgrade +_LORAX_ARGS += --macboot --noupgrade --squashfs-only else -_LORAX_ARGS += --nomacboot +_LORAX_ARGS += --nomacboot --squashfs-only endif ifeq ($(WEB_UI),true) @@ -110,7 +111,7 @@ results/images/boot.iso: external/lorax/branch-$(VERSION) $(filter lorax_templat $(if $(wildcard /etc/rpm/macros.image-language-conf),mv /etc/rpm/macros.image-language-conf $(_TEMP_DIR)/macros.image-language-conf) lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \ - --isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(PWD)/external/lorax/share/templates.d/99-generic \ + --isfinal --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(PWD)/external/lorax/share/templates.d/99-generic \ $(_LORAX_ARGS) \ $(foreach file,$(_REPO_FILES),--repo $(PWD)/$(file)) \ $(foreach file,$(_LORAX_TEMPLATES),--add-template $(PWD)/$(file)) \ @@ -131,7 +132,7 @@ clean: .PHONY: install-deps install-deps: - $(install_pkg) lorax xorriso coreutils gettext + $(install_pkg) lorax xorriso coreutils gettext syslinux-nonlinux $(foreach DIR,$(filter-out test,$(_SUBDIRS)),$(MAKE) -w -C $(DIR) install-deps;) diff --git a/README.md b/README.md index 764e3fd..974e8c8 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/35a48e77e64f469ba19d60a1a1e0be71)](https://app.codacy.com/gh/JasonN3/build-container-installer/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) # Build Container Installer Action + This action is used to generate an ISO for installing an OSTree stored in a container image. This utilizes the anaconda command `ostreecontainer` ## Usage + This action is designed to be called from a GitHub workflow using the following format ```yaml - name: Build ISO @@ -36,9 +38,11 @@ This action is designed to be called from a GitHub workflow using the following See [Customizing](#customizing) for information about customizing the ISO that gets created using `with` ## Customizing + The following variables can be used to customize the created ISO. ### Inputs + | Variable | Description | Default Value | Action | Container/Makefile | | ----------------------- | ---------------------------------------------------------------------------- | -------------------------------------------- | ------------------ | ------------------ | | additional_templates | Space delimited list of additional Lorax templates to include | \[empty\] | :white_check_mark: | :white_check_mark: | @@ -48,12 +52,12 @@ The following variables can be used to customize the created ISO. | flatpak_remote_name | Name of the Flatpak repo on the destination OS | flathub | :white_check_mark: | :white_check_mark: | | flatpak_remote_refs | Space separated list of flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: | | flatpak_remote_refs_dir | Directory that contains files that list the flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: | -| flatpak_remote_url | URL of the flatpakrepo file | https://flathub.org/repo/flathub.flatpakrepo | :white_check_mark: | :white_check_mark: | +| flatpak_remote_url | URL of the flatpakrepo file | | :white_check_mark: | :white_check_mark: | | image_name | Name of the source container image | base | :white_check_mark: | :white_check_mark: | | image_repo | Repository containing the source container image | quay.io/fedora-ostree-desktops | :white_check_mark: | :white_check_mark: | | image_tag | Tag of the source container image | *VERSION* | :white_check_mark: | :white_check_mark: | | iso_name | Name of the ISO you wish to output when completed | build/deploy.iso | :white_check_mark: | :white_check_mark: | -| make_target | Overrides the default make target | *ISO Checksum* | :white_check_mark: | :x: | +| make_target | Overrides the default make target | *ISO_NAME*-Checksum | :white_check_mark: | :x: | | repos | List of repo files for Lorax to use | /etc/yum.repos.d/*.repo | :white_check_mark: | :white_check_mark: | | rootfs_size | The size (in GiB) for the squashfs runtime volume | 2 | :white_check_mark: | :white_check_mark: | | secure_boot_key_url | Secure boot key that is installed from URL location\*\* | \[empty\] | :white_check_mark: | :white_check_mark: | @@ -67,6 +71,7 @@ Variant will be the third item in the package name. Example: `fedora-release-kin \*\* If you need to reference a local file, you can use `file://*path*` ### Outputs + | Variable | Description | Usage | | -------- | ----------------------------------------| ------------------------------------------------ | | iso_name | The name of the resulting .iso | ${{ steps.YOUR_ID_FOR_ACTION.outputs.iso_name }} | @@ -75,7 +80,9 @@ Variant will be the third item in the package name. Example: `fedora-release-kin For outputs, see example above. ## Development + ### Makefile + The Makefile contains all of the commands that are run in the action. There are separate targets for each file generated, however `make` can be used to generate the final image and `make clean` can be used to clean up the workspace. The resulting ISO will be stored in the `build` directory. `make install-deps` can be used to install the necessary packages @@ -83,6 +90,7 @@ The Makefile contains all of the commands that are run in the action. There are See [Customizing](#customizing) for information about customizing the ISO that gets created. All variable should be specified CAPITALIZED. ### Container + A container with `make install-deps` already run is provided at `ghcr.io/jasonn3/build-container-installer:latest` To use the container file, run `docker run --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest`. @@ -103,6 +111,7 @@ docker run --rm --privileged --volume .:/build-container-installer/build ghcr.i ``` ### VSCode Dev Container + There is a dev container configuration provided for development. By default it will use the existing container image available at `ghcr.io/jasonn3/build-container-installer:latest`, however, you can have it build a new image by editing `.devcontainer/devcontainer.json` and replacing `image` with `build`. `Ctrl+/` can be used to comment and uncomment blocks of code within VSCode. The code from VSCode will be available at `/workspaces/build-container-installer` once the container has started. @@ -112,35 +121,45 @@ Privileged is required for access to loop devices for lorax. Use existing container image: ``` { - "name": "Existing Dockerfile", - // "build": { - // "context": "..", - // "dockerfile": "../Containerfile", - // "args": { - // "version": "39" - // } - // }, - "image": "ghcr.io/jasonn3/build-container-installer:latest", - "overrideCommand": true, - "shutdownAction": "stopContainer", - "privileged": true + "name": "Existing Dockerfile", +// "build": { +// "context": "..", +// "dockerfile": "../Containerfile", +// "args": { +// "version": "39" +// } +// }, + "image": "ghcr.io/jasonn3/build-container-installer:latest", + "overrideCommand": true, + "shutdownAction": "stopContainer", + "privileged": true } ``` Build a new container image: ``` { - "name": "Existing Dockerfile", - "build": { - "context": "..", - "dockerfile": "../Containerfile", - "args": { - "version": "39" - } - }, - //"image": "ghcr.io/jasonn3/build-container-installer:latest", - "overrideCommand": true, - "shutdownAction": "stopContainer", - "privileged": true + "name": "Existing Dockerfile", + "build": { + "context": "..", + "dockerfile": "../Containerfile", + "args": { + "version": "39" + } + }, + //"image": "ghcr.io/jasonn3/build-container-installer:latest", + "overrideCommand": true, + "shutdownAction": "stopContainer", + "privileged": true } ``` + +## Star History + + + + + + Star History Chart + + \ No newline at end of file diff --git a/action.yml b/action.yml index 2df4659..0a6a436 100644 --- a/action.yml +++ b/action.yml @@ -211,6 +211,7 @@ runs: IMAGE_REPO="${{ inputs.image_repo }}" \ IMAGE_TAG="${{ inputs.image_tag || inputs.version }}" \ ISO_NAME=/github/workspace/${{ inputs.iso_name }} \ + ${{ inputs.repos && format('REPOS="{0}"', inputs.repos) || '' }} \ SECURE_BOOT_KEY_URL="${{ inputs.secure_boot_key_url }}" \ VARIANT="${{ inputs.variant }}" \ VERSION="${{ inputs.version }}" \ diff --git a/external/Makefile b/external/Makefile index d56cb17..74047b1 100644 --- a/external/Makefile +++ b/external/Makefile @@ -1,6 +1,6 @@ lorax/branch-$(VERSION): git config advice.detachedHead false - cd lorax && git reset --hard HEAD && git checkout tags/$(shell cd lorax && git tag -l lorax-$(VERSION).* --sort=creatordate | tail -n 1) + cd lorax && git reset --hard HEAD && git checkout $(if $(_RHEL),rhel$(word 1,$(subst ., ,$(VERSION)))-branch,tags/$(shell cd lorax && git tag -l lorax-$(VERSION).* --sort=creatordate | tail -n 1)) touch lorax/branch-$(VERSION) install-deps: diff --git a/test/iso/install_os-release.sh b/test/iso/install_os-release.sh index 37e0007..788111a 100644 --- a/test/iso/install_os-release.sh +++ b/test/iso/install_os-release.sh @@ -1,6 +1,6 @@ #!/bin/bash -FOUND_VERSION=$(grep VERSION_ID mnt/install/etc/os-release | cut -d= -f2) +FOUND_VERSION=$(grep VERSION_ID mnt/install/etc/os-release | cut -d= -f2 | tr -d '"') if [[ ${FOUND_VERSION} != ${VERSION} ]] then diff --git a/test/repo/vars.py b/test/repo/vars.py index e76f3e3..4aea753 100755 --- a/test/repo/vars.py +++ b/test/repo/vars.py @@ -100,12 +100,12 @@ for line in readme_lines: if parts[2].strip() != inputs[var_name]['description']: print("WARNING: " + var_name + " description in README.md does not match action.yml") if 'default_value' in inputs[var_name]: - if not parts[3].strip().strip('"').startswith('*'): + if not parts[3].strip().strip('"<>').startswith('*'): if inputs[var_name]['default_value'] == "": if parts[3].strip().strip('"') != '\\[empty\\]': print("ERROR: " + var_name + " default value in README.md does not match action.yml") errors += 1 - elif parts[3].strip().strip('"') != inputs[var_name]['default_value']: + elif parts[3].strip().strip('"<>') != inputs[var_name]['default_value']: print("ERROR: " + var_name + " default value in README.md does not match action.yml") errors += 1 if 'action' in inputs[var_name] and inputs[var_name]['action']: diff --git a/test/vm/Makefile b/test/vm/Makefile index 1c3ef4b..99288cb 100644 --- a/test/vm/Makefile +++ b/test/vm/Makefile @@ -32,7 +32,7 @@ files/mnt/iso: sudo mount -o loop ../../$(ISO_NAME) files/mnt/iso files/grub.cfg: files/mnt/iso - cp files/mnt/iso/boot/grub2/grub.cfg files/grub.cfg + cp files/mnt/iso/$(if $(_RHEL),isolinux/grub.conf,boot/grub2/grub.cfg) files/grub.cfg sed -i 's/quiet/console=ttyS0,115200n8 inst.ks=cdrom:\/ks.cfg/' files/grub.cfg sed -i 's/set default="1"/set default="0"/' files/grub.cfg sed -i 's/set timeout=60/set timeout=1/' files/grub.cfg @@ -57,7 +57,7 @@ files/install.iso: files/grub.cfg -compliance joliet_long_names -map files/ks.cfg ks.cfg -chmod 0444 ks.cfg - -map files/grub.cfg boot/grub2/grub.cfg + -map files/grub.cfg $(if $(_RHEL),isolinux/grub.conf,boot/grub2/grub.cfg) -end EOF diff --git a/xorriso/Makefile b/xorriso/Makefile index 65b8b2a..b2f5d87 100644 --- a/xorriso/Makefile +++ b/xorriso/Makefile @@ -1,5 +1,6 @@ input.txt: gen_input.sh - sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/boot/grub2/grub.cfg + find + $(if $(wildcard ../results/boot/grub2/grub.cfg),sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/boot/grub2/grub.cfg) sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/EFI/BOOT/grub.cfg $(eval _VARS = ARCH FLATPAK_DIR IMAGE_NAME IMAGE_TAG ISO_NAME VERSION) $(foreach var,$(_VARS),$(var)=$($(var))) bash gen_input.sh | tee input.txt diff --git a/xorriso/gen_input.sh b/xorriso/gen_input.sh index a0f3a48..0329186 100644 --- a/xorriso/gen_input.sh +++ b/xorriso/gen_input.sh @@ -14,8 +14,11 @@ do then continue fi - echo "-map ${PWD}/${file} ${file:2}" - echo "-chmod 0444 ${file:2}" + if [[ -f ${PWD}/${file} ]] + then + echo "-map ${PWD}/${file} ${file:2}" + echo "-chmod 0444 ${file:2}" + fi done popd > /dev/null