Skip to content

Prepare release v4.6.0 #383

Prepare release v4.6.0

Prepare release v4.6.0 #383

Workflow file for this run

name: CI
on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'
env:
DOCKER_METADATA_PR_HEAD_SHA: true
jobs:
check:
name: Golang Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.13.2
args: --timeout=15m
unit-test:
name: Unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make test-unit-ci
integration-test:
name: Integration test
runs-on: ubuntu-22.04
needs:
- check
- unit-test
strategy:
matrix:
kubernetes:
- 1.32.8
- 1.33.8
- 1.34.4
- 1.35.1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install conntrack
run: sudo apt-get install -y conntrack
# medyagh/setup-minikube chmods /etc/cni/net.d without creating it, and the
# runner image no longer ships that directory.
# Upstream fix: https://github.com/medyagh/setup-minikube/pull/836
- name: Ensure CNI config directory exists
run: sudo mkdir -p /etc/cni/net.d
- uses: medyagh/setup-minikube@v0.0.18
with:
kubernetes-version: ${{ matrix.kubernetes }}
minikube-version: 1.38.1
driver: none
- name: Add redisfailover CRD
run: kubectl create -f manifests/databases.spotahome.com_redisfailovers.yaml
- run: make test-integration-ci
workflow-lint:
name: Workflow lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: actionlint
run: make lint-workflows
chart-test:
name: Chart testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.7.2
- name: Helm test
run: make test-helm-ci
# Despite the name, this job publishes the operator image to both Docker Hub
# (powerhome/redis-operator) and ghcr.io/powerhome/redis-operator in one build.
# Kept as `dockerhub-image` to avoid renaming a status check that branch
# protection may require; see PR #93 discussion.
dockerhub-image:
needs:
- check
- unit-test
- integration-test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
powerhome/redis-operator
ghcr.io/powerhome/redis-operator
# A pull request build carries a tag that moves to its newest image,
# so the image it replaces keeps no tag and the scheduled prune
# collects it. A build of master or of a release tag keeps a unique
# commit-sha tag, which stays addressable for as long as the package
# holds it.
tags: |
type=semver,pattern={{raw}}
type=sha,prefix=,suffix=,format=long,enable=${{ github.event_name != 'pull_request' }}
type=ref,event=pr
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: build
push: true
- name: Verify the ghcr package is publicly pullable
if: github.event_name != 'pull_request'
run: |
tag='${{ steps.meta.outputs.version }}'
token=$(curl -sf "https://ghcr.io/token?scope=repository:powerhome/redis-operator:pull&service=ghcr.io" | jq -r .token)
curl -sf -o /dev/null \
-H "Authorization: Bearer $token" \
-H "Accept: application/vnd.oci.image.index.v1+json" \
"https://ghcr.io/v2/powerhome/redis-operator/manifests/$tag" \
|| { echo "ghcr package is not anonymously pullable"; exit 1; }