From a483dc92a481ff63f6c79f39e0bf7037038fed02 Mon Sep 17 00:00:00 2001 From: "Jason N." <33561705+JasonN3@users.noreply.github.com> Date: Mon, 8 Apr 2024 10:21:10 -0400 Subject: [PATCH] separate tests --- .github/workflows/build_iso.yml | 25 +--- .github/workflows/build_iso_rhel.yml | 157 ++++++++++++++++++++++++++ .github/workflows/build_vars.yml | 2 + .github/workflows/build_vars_rhel.yml | 31 +++++ .github/workflows/tests.yml | 44 ++++++-- 5 files changed, 227 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build_iso_rhel.yml create mode 100644 .github/workflows/build_vars_rhel.yml diff --git a/.github/workflows/build_iso.yml b/.github/workflows/build_iso.yml index 9d52ce1..8bb3628 100644 --- a/.github/workflows/build_iso.yml +++ b/.github/workflows/build_iso.yml @@ -18,16 +18,11 @@ on: suffix: required: false type: string - secrets: - RH_REPO: - required: true - RH_ENT: - required: true jobs: load_vars: name: Load Variables - uses: ./.github/workflows/build_vars.yml + uses: ./.github/workflows/build_vars_rhel.yml build_iso: name: Build ISO @@ -45,10 +40,6 @@ jobs: fail-fast: false matrix: version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }} - include: - - version: 8 - image_tag: 39 - rhel: true steps: - name: Checkout uses: actions/checkout@v4 @@ -118,15 +109,6 @@ jobs: run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - name: Get UBI Subs - if: matrix.rhel == true - uses: actions/checkout@v4 - with: - repository: ${{ secrets.RH_REPO }} - ssh-key: ${{ secrets.RH_ENT }} - persist-credentials: false - path: ubi - - name: Build ISO uses: ./ id: build @@ -134,7 +116,7 @@ jobs: 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.image_tag || matrix.version }} + image_tag: ${{ matrix.version }} version: ${{ matrix.version }} variant: ${{ needs.load_vars.outputs.VARIANT }} flatpak_remote_refs: ${{ inputs.flatpaks_refs }} @@ -142,8 +124,7 @@ jobs: 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 - secrets_dir: ${{ matrix.rhel && format('{0}/ubi', github.workspace) || '' }} - repos: ${{ matrix.rhel && '/etc/yum.repos.d/redhat.repo' || '/etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo' }} + repos: '/etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo' - name: Upload ISO as artifact id: upload diff --git a/.github/workflows/build_iso_rhel.yml b/.github/workflows/build_iso_rhel.yml new file mode 100644 index 0000000..e32c144 --- /dev/null +++ b/.github/workflows/build_iso_rhel.yml @@ -0,0 +1,157 @@ +name: Build ISO + +on: + workflow_call: + inputs: + pr: + required: false + type: string + parent_job_name: + required: true + type: string + suffix: + required: false + type: string + secrets: + RH_REPO: + required: true + RH_ENT: + required: true + +jobs: + load_vars: + name: Load Variables + uses: ./.github/workflows/build_vars.yml + + build_iso: + name: Build ISO + env: + JOB_NAME: Build ISO + runs-on: ubuntu-latest + needs: + - load_vars + permissions: + contents: read + packages: write + statuses: write + continue-on-error: false + strategy: + fail-fast: false + matrix: + version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Switch branch + if: inputs.pr + env: + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ github.token }} + run: | + sudo apt-get update + sudo apt-get install -y hub + hub pr checkout ${{ inputs.pr }} + echo "sha=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Get Current Job Log URL + if: inputs.pr && always() + uses: Tiryoh/gha-jobid-action@v1 + id: jobs + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + job_name: "${{ inputs.parent_job_name }} / ${{ env.JOB_NAME }} (${{ matrix.version }})" + + - name: Set status + if: inputs.pr && always() + uses: myrotvorets/set-commit-status-action@v2.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + status: pending + context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + sha: ${{ env.sha }} + targetUrl: ${{ steps.jobs.outputs.html_url }} + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: Lowercase Registry + id: registry_case + uses: ASzc/change-string-case-action@v6 + with: + string: ${{ needs.load_vars.outputs.IMAGE_REPO }} + + - name: Get image version + id: meta + uses: docker/metadata-action@v5 + with: + tags: | + type=ref,event=branch + type=ref,event=pr + + - name: Login to Registry + run: | + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Get UBI Subs + uses: actions/checkout@v4 + with: + repository: ${{ secrets.RH_REPO }} + ssh-key: ${{ secrets.RH_ENT }} + persist-credentials: false + path: ubi + + - name: Build ISO + uses: ./ + 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_tag: ${{ needs.load_vars.outputs.IMAGE_TAG }} + version: ${{ matrix.version }} + variant: ${{ needs.load_vars.outputs.VARIANT }} + 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 + secrets_dir: ${{ format('{0}/ubi', github.workspace) }} + repos: '/etc/yum.repos.d/redhat.repo' + + - 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 || '') }} + 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 + if-no-files-found: error + retention-days: 0 + compression-level: 0 + overwrite: true + + - name: Set status + if: inputs.pr && always() + uses: myrotvorets/set-commit-status-action@v2.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + status: ${{ job.status }} + context: ${{ env.JOB_NAME }} (${{ matrix.version }}) + 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..69cb7cc 100644 --- a/.github/workflows/build_vars.yml +++ b/.github/workflows/build_vars.yml @@ -7,6 +7,8 @@ on: value: 'x86_64' BUILD_VERSIONS: value: '[38, 39, 40]' + BUILD_VERSIONS_RHEL: + value: '[8]' IMAGE_NAME: value: 'base' IMAGE_REPO: diff --git a/.github/workflows/build_vars_rhel.yml b/.github/workflows/build_vars_rhel.yml new file mode 100644 index 0000000..25290f4 --- /dev/null +++ b/.github/workflows/build_vars_rhel.yml @@ -0,0 +1,31 @@ +name: Build Vars + +on: + workflow_call: + outputs: + ARCH: + value: 'x86_64' + BUILD_VERSIONS: + value: '[8]' + IMAGE_NAME: + value: 'fedora-bootc' + IMAGE_REPO: + value: 'quay.io/centos-bootc' + IMAGE_TAG: + value: 'eln' + VARIANT: + value: 'Server' + SECURE_BOOT_KEY_URL: + value: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der' + ENROLLMENT_PASSWORD: + value: 'container-installer' + + +jobs: + load-vars: + name: Load Variables + runs-on: ubuntu-latest + steps: + - name: Sucess + run: + echo "Vars loaded" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b2718f4..169170e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,9 +49,6 @@ jobs: parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO with Flatpaks flatpaks_refs_dir: flatpak_refs suffix: flatpaks - secrets: - RH_REPO: ${{ secrets.RH_REPO }} - RH_ENT: ${{ secrets.RH_ENT }} test_iso_flatpaks: name: Test ISO with Flatpaks @@ -85,9 +82,6 @@ jobs: 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 - secrets: - RH_REPO: ${{ secrets.RH_REPO }} - RH_ENT: ${{ secrets.RH_ENT }} test_iso_flatpak_refs: name: Test ISO with Flatpak Refs @@ -119,9 +113,6 @@ jobs: with: pr: ${{ inputs.pr }} parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO - secrets: - RH_REPO: ${{ secrets.RH_REPO }} - RH_ENT: ${{ secrets.RH_ENT }} test_iso: name: Test ISO @@ -139,4 +130,37 @@ jobs: 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 Deployment + + build_iso_rhel: + name: Build RHEL ISO + needs: + - build_container + uses: ./.github/workflows/build_iso_rhel.yml + with: + pr: ${{ inputs.pr }} + parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO + suffix: rhel + secrets: + RH_REPO: ${{ secrets.RH_REPO }} + RH_ENT: ${{ secrets.RH_ENT }} + + test_iso_rhel: + name: Test RHEL 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 + suffix: rhel + + test_deployment_rhel: + name: Test RHEL 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 + suffix: rhel \ No newline at end of file