From b79cbd3876c3e4891bda33517d73b9dfb69d8a21 Mon Sep 17 00:00:00 2001 From: Aitor Perez <1515757+Zerpet@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:55:18 +0100 Subject: [PATCH] WIP - use ghcr --- .github/workflows/build-test-publish.yml | 27 +++++++++++++++++------- Makefile | 2 ++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 718321f8a..82fe06c9c 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -13,7 +13,7 @@ on: branches: [ "main" ] env: - GO_VERSION: ~1.24 + GO_VERSION: 'stable' # Taken from https://github.com/kubernetes-sigs/kind/releases/tag/v0.18.0 # The image here should be listed under 'Images built for this release' for the version of kind in go.mod KIND_NODE_IMAGE: "kindest/node:v1.32.0" @@ -120,6 +120,7 @@ jobs: permissions: contents: 'write' id-token: 'write' + packages: 'write' steps: - name: Checkout uses: actions/checkout@v5 @@ -135,9 +136,10 @@ jobs: uses: docker/metadata-action@v5 with: # list of Docker images to use as base name for tags + # rabbitmqoperator/cluster-operator + # quay.io/rabbitmqoperator/cluster-operator images: | - rabbitmqoperator/cluster-operator - quay.io/rabbitmqoperator/cluster-operator + ghcr.io/rabbitmq/cluster-operator # generate Docker tags based on the following events/attributes tags: | type=sha @@ -165,10 +167,18 @@ jobs: username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push id: build uses: docker/build-push-action@v6 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }} + # if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }} with: context: . platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x @@ -207,8 +217,7 @@ jobs: pushd config/installation kustomize edit set image rabbitmqoperator/cluster-operator-dev=rabbitmqoperator/cluster-operator:"${RELEASE_VERSION}" popd - make generate-installation-manifest QUAY_IO_OPERATOR_IMAGE=quay.io/rabbitmqoperator/cluster-operator:"${RELEASE_VERSION}" - echo -n "cluster-operator-${{ steps.meta.outputs.version }}.yml" > "latest-cluster-operator-dev-manifest.txt" + make generate-installation-manifest QUAY_IO_OPERATOR_IMAGE=quay.io/rabbitmqoperator/cluster-operator:"${RELEASE_VERSION}" GHCR_IO_OPERATOR_IMAGE=ghcr.io/rabbitmq/cluster-operator:"${RELEASE_VERSION}" - name: Upload operator manifests uses: actions/upload-artifact@v4 @@ -227,7 +236,7 @@ jobs: rabbitmq-image: - rabbitmq:3.13.7-management - rabbitmq:management - - pivotalrabbitmq/rabbitmq:main + - pivotalrabbitmq/rabbitmq:main-otp27 steps: - name: Check out code into the Go module directory uses: actions/checkout@v5 @@ -352,7 +361,8 @@ jobs: test_doc_examples: name: Documented example tests runs-on: ubuntu-latest - if: ${{ github.event_name != 'pull_request' }} + # if: ${{ github.event_name != 'pull_request' }} + if: false needs: build_operator steps: - name: Check out code into the Go module directory @@ -491,6 +501,7 @@ jobs: files: | cluster-operator.yml cluster-operator-quay-io.yml + cluster-operator-ghcr-io.yml generate_release_notes: true draft: true body_path: release-header.md diff --git a/Makefile b/Makefile index ce211e583..73e263d41 100644 --- a/Makefile +++ b/Makefile @@ -191,11 +191,13 @@ $(YTT): | $(LOCAL_TESTBIN) chmod +x $(YTT) QUAY_IO_OPERATOR_IMAGE ?= quay.io/rabbitmqoperator/cluster-operator:latest +GHCR_IO_OPERATOR_IMAGE ?= ghcr.io/rabbitmq/cluster-operator:latest # Builds a single-file installation manifest to deploy the Operator generate-installation-manifest: | $(YTT) mkdir -p releases kustomize build config/installation/ > releases/cluster-operator.yml $(YTT) -f releases/cluster-operator.yml -f config/ytt/overlay-manager-image.yaml --data-value operator_image=$(QUAY_IO_OPERATOR_IMAGE) > releases/cluster-operator-quay-io.yml + $(YTT) -f releases/cluster-operator.yml -f config/ytt/overlay-manager-image.yaml --data-value operator_image=$(GHCR_IO_OPERATOR_IMAGE) > releases/cluster-operator-ghcr-io.yml docker-build: ## Build the docker image with tag `latest` @$(call check_defined, OPERATOR_IMAGE, path to the Operator image within the registry e.g. rabbitmq/cluster-operator)