Skip to content

Commit 83ce266

Browse files
committed
Use ghcr.io registry for container images
1 parent a178a61 commit 83ce266

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.github/workflows/build-test-publish.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
branches: [ "main" ]
1414

1515
env:
16-
GO_VERSION: ~1.24
16+
GO_VERSION: 'stable'
1717
# Taken from https://github.com/kubernetes-sigs/kind/releases/tag/v0.18.0
1818
# The image here should be listed under 'Images built for this release' for the version of kind in go.mod
1919
KIND_NODE_IMAGE: "kindest/node:v1.32.0"
@@ -120,6 +120,7 @@ jobs:
120120
permissions:
121121
contents: 'write'
122122
id-token: 'write'
123+
packages: 'write'
123124
steps:
124125
- name: Checkout
125126
uses: actions/checkout@v5
@@ -138,6 +139,7 @@ jobs:
138139
images: |
139140
rabbitmqoperator/cluster-operator
140141
quay.io/rabbitmqoperator/cluster-operator
142+
ghcr.io/rabbitmq/cluster-operator
141143
# generate Docker tags based on the following events/attributes
142144
tags: |
143145
type=sha
@@ -151,20 +153,28 @@ jobs:
151153
uses: docker/setup-buildx-action@v3
152154

153155
- name: Login to Docker Hub
154-
if: github.event_name != 'pull_request'
156+
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
155157
uses: docker/login-action@v3
156158
with:
157159
username: ${{ secrets.DOCKERHUB_USERNAME }}
158160
password: ${{ secrets.DOCKERHUB_TOKEN }}
159161

160162
- name: Login to Quay.io
161-
if: github.event_name != 'pull_request'
163+
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
162164
uses: docker/login-action@v3
163165
with:
164166
registry: quay.io
165167
username: ${{ secrets.QUAY_USERNAME }}
166168
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
167169

170+
- name: Login to GHCR
171+
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
172+
uses: docker/login-action@v3
173+
with:
174+
registry: ghcr.io
175+
username: ${{ github.repository_owner }}
176+
password: ${{ secrets.GITHUB_TOKEN }}
177+
168178
- name: Build and push
169179
id: build
170180
uses: docker/build-push-action@v6
@@ -176,6 +186,9 @@ jobs:
176186
push: true
177187
tags: ${{ steps.meta.outputs.tags }}
178188
labels: ${{ steps.meta.outputs.labels }}
189+
# FIXME: mount cache in the container
190+
# https://github.com/reproducible-containers/buildkit-cache-dance
191+
# https://docs.docker.com/build/ci/github-actions/cache/#cache-mounts
179192
cache-from: type=gha
180193
cache-to: type=gha,mode=max
181194

@@ -207,8 +220,7 @@ jobs:
207220
pushd config/installation
208221
kustomize edit set image rabbitmqoperator/cluster-operator-dev=rabbitmqoperator/cluster-operator:"${RELEASE_VERSION}"
209222
popd
210-
make generate-installation-manifest QUAY_IO_OPERATOR_IMAGE=quay.io/rabbitmqoperator/cluster-operator:"${RELEASE_VERSION}"
211-
echo -n "cluster-operator-${{ steps.meta.outputs.version }}.yml" > "latest-cluster-operator-dev-manifest.txt"
223+
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}"
212224
213225
- name: Upload operator manifests
214226
uses: actions/upload-artifact@v4
@@ -227,7 +239,7 @@ jobs:
227239
rabbitmq-image:
228240
- rabbitmq:3.13.7-management
229241
- rabbitmq:management
230-
- pivotalrabbitmq/rabbitmq:main
242+
- pivotalrabbitmq/rabbitmq:main-otp27
231243
steps:
232244
- name: Check out code into the Go module directory
233245
uses: actions/checkout@v5
@@ -491,6 +503,7 @@ jobs:
491503
files: |
492504
cluster-operator.yml
493505
cluster-operator-quay-io.yml
506+
cluster-operator-ghcr-io.yml
494507
generate_release_notes: true
495508
draft: true
496509
body_path: release-header.md

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,13 @@ $(YTT): | $(LOCAL_TESTBIN)
191191
chmod +x $(YTT)
192192

193193
QUAY_IO_OPERATOR_IMAGE ?= quay.io/rabbitmqoperator/cluster-operator:latest
194+
GHCR_IO_OPERATOR_IMAGE ?= ghcr.io/rabbitmq/cluster-operator:latest
194195
# Builds a single-file installation manifest to deploy the Operator
195196
generate-installation-manifest: | $(YTT)
196197
mkdir -p releases
197198
kustomize build config/installation/ > releases/cluster-operator.yml
198199
$(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
200+
$(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
199201

200202
docker-build: ## Build the docker image with tag `latest`
201203
@$(call check_defined, OPERATOR_IMAGE, path to the Operator image within the registry e.g. rabbitmq/cluster-operator)

0 commit comments

Comments
 (0)