Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
groups:
all:
patterns:
- '*'
schedule:
interval: "daily"
ignore:
Expand All @@ -15,10 +19,18 @@ updates:
versions: ["0.2.x"]
- package-ecosystem: "gomod"
directory: "/internal/tools/"
groups:
tools:
patterns:
- '*'
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/internal/promtool/"
groups:
promtool:
patterns:
- '*'
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -120,11 +120,13 @@ jobs:
permissions:
contents: 'write'
id-token: 'write'
packages: 'write'
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Install Go
id: set-go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
Expand All @@ -138,6 +140,7 @@ jobs:
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
Expand All @@ -151,20 +154,28 @@ jobs:
uses: docker/setup-buildx-action@v3

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

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

- name: Login to GHCR
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
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
Expand All @@ -176,8 +187,13 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# FIXME: mount cache in the container
# https://github.com/reproducible-containers/buildkit-cache-dance
# https://docs.docker.com/build/ci/github-actions/cache/#cache-mounts
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GO_TAG=${{ steps.set-go.outputs.go-version }}

- name: Build to TAR
id: build_tar
Expand Down Expand Up @@ -207,8 +223,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
Expand All @@ -227,7 +242,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
Expand Down Expand Up @@ -491,6 +506,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
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG GO_TAG=1.24
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.24 AS builder
FROM --platform=$BUILDPLATFORM golang:${GO_TAG} AS builder

WORKDIR /workspace

Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ unit-tests::vuln
unit-tests::manifests
unit-tests::just-unit-tests ## Run unit tests

GINKGO ?= go run github.com/onsi/ginkgo/v2/ginkgo

.PHONY: just-unit-tests
just-unit-tests:
ginkgo -r --randomize-all api/ internal/ pkg/
$(GINKGO) -r --randomize-all api/ internal/ pkg/

.PHONY: integration-tests
integration-tests::install-tools
Expand All @@ -81,7 +83,7 @@ integration-tests::just-integration-tests ## Run integration tests

.PHONY: just-integration-tests
just-integration-tests:
ginkgo -r controllers/
$(GINKGO) -r controllers/

manifests: install-tools ## Generate manifests e.g. CRD, RBAC etc.
controller-gen crd rbac:roleName=operator-role paths="./api/...;./controllers/..." output:crd:artifacts:config=config/crd/bases
Expand Down Expand Up @@ -191,11 +193,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)
Expand Down Expand Up @@ -232,7 +236,7 @@ cert-manager-rm:
kubectl delete -f https://github.com/cert-manager/cert-manager/releases/download/v$(CERT_MANAGER_VERSION)/cert-manager.yaml --ignore-not-found

system-tests: install-tools ## Run end-to-end tests against Kubernetes cluster defined in ~/.kube/config
NAMESPACE="$(SYSTEM_TEST_NAMESPACE)" K8S_OPERATOR_NAMESPACE="$(K8S_OPERATOR_NAMESPACE)" ginkgo -nodes=3 --randomize-all -r system_tests/
NAMESPACE="$(SYSTEM_TEST_NAMESPACE)" K8S_OPERATOR_NAMESPACE="$(K8S_OPERATOR_NAMESPACE)" $(GINKGO) -nodes=3 --randomize-all -r system_tests/

kubectl-plugin-tests: ## Run kubectl-rabbitmq tests
@echo "running kubectl plugin tests"
Expand Down
Loading