That allows us to use different distro bases for different stable branches.
Fixes: 60a53abaa38a ("ci: Add automation for building the containers") Signed-off-by: Dumitru Ceara <dce...@redhat.com> --- .cirrus.yml | 2 +- .github/workflows/containers.yml | 16 ++++++++++++---- .github/workflows/test.yml | 16 +++++++++++++++- Documentation/internals/release-process.rst | 6 ++++++ utilities/containers/Makefile | 4 ++-- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index bd4cd08aaf..23e720cc47 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ arm_unit_tests_task: arm_container: - image: ghcr.io/ovn-org/ovn-tests:fedora + image: ghcr.io/ovn-org/ovn-tests:main-fedora memory: 4G cpu: 2 diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml index 57e815ed86..1bf98b4a5a 100644 --- a/.github/workflows/containers.yml +++ b/.github/workflows/containers.yml @@ -7,9 +7,6 @@ on: - cron: '0 0 * * 1' env: - IMAGE_REGISTRY: ghcr.io - IMAGE_NAMESPACE: ovn-org - IMAGE_NAME: ovn-tests CONTAINERS_PATH: ./utilities/containers DEPENDENCIES: podman @@ -31,13 +28,24 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v2 + - name: Build image name + run: | + echo "IMAGE_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \ + >> $GITHUB_ENV + echo "IMAGE_REGISTRY=ghcr.io" \ + >> $GITHUB_ENV + echo "IMAGE_NAME=ovn-tests" \ + >> $GITHUB_ENV + echo "IMAGE_NAMESPACE=$GITHUB_REPOSITORY_OWNER" \ + >> $GITHUB_ENV + - name: Build container images id: build-image uses: redhat-actions/buildah-build@v2 with: image: ${{ env.IMAGE_NAME }} archs: amd64, arm64 - tags: ${{ matrix.distro }} + tags: ${{ env.IMAGE_BRANCH }}-${{ matrix.distro }} build-args: CONTAINERS_PATH=${{ env.CONTAINERS_PATH }} dockerfiles: ${{ env.CONTAINERS_PATH }}/${{ matrix.distro }}/Dockerfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c5ce6ed10..5ecf993e7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,7 +83,6 @@ jobs: build-linux: needs: build-dpdk env: - IMAGE_NAME: ghcr.io/ovn-org/ovn-tests:ubuntu ARCH: ${{ matrix.cfg.arch }} CC: ${{ matrix.cfg.compiler }} DPDK: ${{ matrix.cfg.dpdk }} @@ -128,6 +127,21 @@ jobs: with: submodules: recursive + - name: get CI container image name + run: | + image_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + image="ghcr.io/$GITHUB_REPOSITORY_OWNER/ovn-tests:${image_branch}-ubuntu" + if ! podman pull $image; then + # Fall back to the main branch if the current branch image doesn't + # exist. + image="ghcr.io/$GITHUB_REPOSITORY_OWNER/ovn-tests:main-ubuntu" + if ! podman pull $image; then + # Fall back to the old way of using the single per-repo image. + image="ghcr.io/$GITHUB_REPOSITORY_OWNER/ovn-tests:ubuntu" + fi + fi + echo "IMAGE_NAME=$image" >> "$GITHUB_ENV" + # For weekly runs, don't update submodules - name: checkout without submodule if: github.event_name == 'schedule' diff --git a/Documentation/internals/release-process.rst b/Documentation/internals/release-process.rst index ec79fe48c3..7927e848b7 100644 --- a/Documentation/internals/release-process.rst +++ b/Documentation/internals/release-process.rst @@ -58,6 +58,12 @@ Scheduling`_ for the timing of each stage: bug fixes to the main branch, except for bugs present only on release branches (which are rare in practice). + When a release branch is created it might be beneficial to manually trigger + a run of the `containers.yml` GitHub actions workflow on this new branch. + This ensures that a branch-specific CI container image is built. This + image will be used by subsequent CI runs on this branch (otherwise the main + branch image is used by default). + At this stage, sometimes there can be exceptions to the rule that a release branch receives only bug fixes. Like bug fixes, new features on release branches should be backports of the corresponding commits on the main diff --git a/utilities/containers/Makefile b/utilities/containers/Makefile index d79e4ad5ee..e2e8f95064 100644 --- a/utilities/containers/Makefile +++ b/utilities/containers/Makefile @@ -1,5 +1,5 @@ CONTAINER_CMD ?= podman -IMAGE_NAME ?= "ovn-org/ovn-tests" +IMAGE_NAME ?= "ovn-org/ovn-tests:main" CONTAINERS_PATH ?= "." distros := fedora ubuntu @@ -7,5 +7,5 @@ distros := fedora ubuntu .PHONY: $(distros) $(distros): - $(CONTAINER_CMD) build --no-cache --rm -t $(IMAGE_NAME):$@ \ + $(CONTAINER_CMD) build --no-cache --rm -t $(IMAGE_NAME)-$@ \ -f $@/Dockerfile . --build-arg=CONTAINERS_PATH=$(CONTAINERS_PATH) _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev