From 28f166983b9c12938cba4d80292483c6caedd2d8 Mon Sep 17 00:00:00 2001 From: Jiri Konecny Date: Tue, 30 Apr 2024 12:00:31 +0200 Subject: [PATCH 1/2] infra: Upload container images also for CentOS Add rhel-9 and rhel-10 containers to the container images we are uploading on quay.io so these container images could be gated. This is now possible because we migrated from RHEL containers to CentOS Stream containers, so we can gate containers for rhel branches and simplify our workflows. --- .../container-autoupdate-fedora.yml.j2 | 31 ------------------- ...te-fedora.yml => container-autoupdate.yml} | 16 +++++----- .github/workflows/container-autoupdate.yml.j2 | 23 ++++++++++++++ 3 files changed, 32 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/container-autoupdate-fedora.yml.j2 rename .github/workflows/{container-autoupdate-fedora.yml => container-autoupdate.yml} (64%) create mode 100644 .github/workflows/container-autoupdate.yml.j2 diff --git a/.github/workflows/container-autoupdate-fedora.yml.j2 b/.github/workflows/container-autoupdate-fedora.yml.j2 deleted file mode 100644 index eb3a48c2b72..00000000000 --- a/.github/workflows/container-autoupdate-fedora.yml.j2 +++ /dev/null @@ -1,31 +0,0 @@ -{% if distro_release == "rawhide" %} -name: Refresh Fedora container images -on: - schedule: - - cron: 0 0 * * * - # be able to start this action manually from a actions tab when needed - workflow_dispatch: - -permissions: - contents: read - -jobs: - - master: - # Don't run scheduled workflows on forks. - if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda' - uses: ./.github/workflows/container-rebuild-action.yml - secrets: inherit - with: - container-tag: master - branch: master - - {% for branch in supported_branches if branch.variant == "fedora" %} - {$ branch|first $}: - uses: ./.github/workflows/container-rebuild-action.yml - secrets: inherit - with: - container-tag: {$ branch|first $} - branch: {$ branch|first $} - {% endfor %} -{% endif %} diff --git a/.github/workflows/container-autoupdate-fedora.yml b/.github/workflows/container-autoupdate.yml similarity index 64% rename from .github/workflows/container-autoupdate-fedora.yml rename to .github/workflows/container-autoupdate.yml index 22a87677f29..fb0d76f1131 100644 --- a/.github/workflows/container-autoupdate-fedora.yml +++ b/.github/workflows/container-autoupdate.yml @@ -3,9 +3,9 @@ # THIS FILE IS GENERATED FROM A TEMPLATE # DO NOT EDIT THIS FILE MANUALLY! # ====================================== -# The template is located in: container-autoupdate-fedora.yml.j2 +# The template is located in: container-autoupdate.yml.j2 -name: Refresh Fedora container images +name: Refresh Fedora and CentOS Stream container images on: schedule: - cron: 0 0 * * * @@ -16,13 +16,15 @@ permissions: contents: read jobs: - - master: + update-container: + strategy: + fail-fast: false + matrix: + branch: ['master', 'rhel-9', 'rhel-10'] # Don't run scheduled workflows on forks. if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda' uses: ./.github/workflows/container-rebuild-action.yml secrets: inherit with: - container-tag: master - branch: master - + container-tag: ${{ matrix.branch }} + branch: ${{ matrix.branch }} diff --git a/.github/workflows/container-autoupdate.yml.j2 b/.github/workflows/container-autoupdate.yml.j2 new file mode 100644 index 00000000000..b75d86a966c --- /dev/null +++ b/.github/workflows/container-autoupdate.yml.j2 @@ -0,0 +1,23 @@ +name: Refresh Fedora and CentOS Stream container images +on: + schedule: + - cron: 0 0 * * * + # be able to start this action manually from a actions tab when needed + workflow_dispatch: + +permissions: + contents: read + +jobs: + update-container: + strategy: + fail-fast: false + matrix: + branch: ['master'{% for branch in supported_branches %}, '{$ branch|first $}'{% endfor %}] + # Don't run scheduled workflows on forks. + if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda' + uses: ./.github/workflows/container-rebuild-action.yml + secrets: inherit + with: + container-tag: ${{ matrix.branch }} + branch: ${{ matrix.branch }} From c0b1e2a6c1e3a371a0488039c54fc5b0247803bb Mon Sep 17 00:00:00 2001 From: Jiri Konecny Date: Tue, 30 Apr 2024 12:30:21 +0200 Subject: [PATCH 2/2] infra: Remove templating from container rebuild The container-rebuild-action reusable workflow do not need template file. It will just not work on the other branches. --- .../workflows/container-rebuild-action.yml.j2 | 100 ------------------ 1 file changed, 100 deletions(-) delete mode 100644 .github/workflows/container-rebuild-action.yml.j2 diff --git a/.github/workflows/container-rebuild-action.yml.j2 b/.github/workflows/container-rebuild-action.yml.j2 deleted file mode 100644 index b1e4c3db503..00000000000 --- a/.github/workflows/container-rebuild-action.yml.j2 +++ /dev/null @@ -1,100 +0,0 @@ -{% if distro_release == "rawhide" %} -name: Rebuild container images -# Rebuilds both ci and rpm container images for a given "target". Currently known targets: -# - master -# - eln -# - fedora-NN -# -# Image is: -# - built from the repo at ref , -# - based on the right container according to branch settings, or optionally on if set, -# - tagged as quay.io/rhinstaller/anaconda-{ci|rpm}:. -# -# See also inputs below. - -# Reusable workflow, does not run on its own. Typically, use in an action this way: -# jobs: -# foo: -# uses: ./.github/workflows/container-rebuild-action.yml -# secrets: inherit -# with: -# container-tag: foo -# branch: foo - -on: - workflow_call: - inputs: - container-tag: - required: true - type: string - branch: - required: true - type: string - base-container: - required: false - type: string - # secrets consumed: QUAY_USERNAME, QUAY_PASSWORD - # these are provided by using the quay.io environment below - -permissions: - contents: read - -jobs: - refresh-container: - name: Refresh anaconda container - runs-on: ubuntu-20.04 - environment: quay.io - strategy: - fail-fast: false - matrix: - container-type: ['ci', 'rpm'] - env: - CI_TAG: '${{ inputs.container-tag }}' - timeout-minutes: 60 - steps: - - name: Checkout anaconda repository - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - - name: Build anaconda-${{ matrix.container-type }} container - run: | - BASE_CONTAINER=${{ inputs.base-container }} - make -f Makefile.am anaconda-${{ matrix.container-type }}-build ${BASE_CONTAINER:+BASE_CONTAINER=}${BASE_CONTAINER:-} - - - name: Run tests in anaconda-ci container - if: matrix.container-type == 'ci' - run: | - # put the log in the output, where it's easy to read and link to - make -f Makefile.am container-ci || { cat test-logs/test-suite.log; exit 1; } - - - name: Run tests in anaconda-rpm container - if: matrix.container-type == 'rpm' - run: | - # put the log in the output, where it's easy to read and link to - make -f Makefile.am container-rpm-test || { cat test-logs/test-suite.log; exit 1; } - - - name: Upload test and coverage logs from local testing - if: always() - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.container-tag }}-${{ matrix.container-type }}-logs - path: | - test-logs/test-suite.log - test-logs/unit_tests.log - test-logs/pylint/runpylint*.log - test-logs/coverage-*.log - - - name: Login to container registry - run: podman login -u ${{ secrets.QUAY_USERNAME }} -p ${{ secrets.QUAY_PASSWORD }} quay.io - - # we can hardcode the path to the image here because this will be executed only for master image - - name: Add latest tag for master container - if: ${{ inputs.container-tag == 'master' }} - run: | - podman tag quay.io/rhinstaller/anaconda-${{ matrix.container-type }}:master quay.io/rhinstaller/anaconda-${{ matrix.container-type }}:latest - CI_TAG=latest make -f Makefile.am anaconda-${{ matrix.container-type }}-push - - - name: Push container to registry - run: make -f Makefile.am anaconda-${{ matrix.container-type }}-push -{% endif %}