Skip to content

Updating controller-runtime and dependencies #1438

Updating controller-runtime and dependencies

Updating controller-runtime and dependencies #1438

name: Cass Operator Build & Deploy
on:
push:
branches:
- master
pull_request:
branches: [ master ]
jobs:
testing:
name: Run unit tests
runs-on: ubuntu-latest
env:
CGO_ENABLED: 0
steps:
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
# GHA requires longer timeout
args: --timeout=10m
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: ${{ github.event_name == 'pull_request' }}
skip-pkg-cache: true
skip-build-cache: true
- name: Verify manifests and dirty state
run: |
make manifests generate
git update-index -q --really-refresh
git diff-files --quiet
- name: Unit Tests
run: |
make test
build_images:
name: Build Cass Operator Docker Image
runs-on: ubuntu-latest
needs: testing
if: github.ref == 'refs/heads/master'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set git parsed values
id: vars
run: |
echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "version=$(make version)" >> $GITHUB_OUTPUT
- name: Build and push
id: docker_build_cass_operator
uses: docker/build-push-action@v6
with:
file: Dockerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: k8ssandra/cass-operator:${{ steps.vars.outputs.sha_short }}, k8ssandra/cass-operator:v${{ steps.vars.outputs.version }}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and push
id: docker_build_system_logger
uses: docker/build-push-action@v6
with:
file: logger.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: k8ssandra/system-logger:${{ steps.vars.outputs.sha_short }}, k8ssandra/system-logger:v${{ steps.vars.outputs.version }}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Create bundle and validate
run: |
make IMG=k8ssandra/cass-operator:${{ steps.vars.outputs.version }} VERSION=${{ steps.vars.outputs.version }} CHANNEL=dev bundle
bin/operator-sdk bundle validate ./bundle --select-optional suite=operatorframework
bin/operator-sdk bundle validate ./bundle --select-optional name=operatorhub
bin/operator-sdk bundle validate ./bundle --select-optional name=good-practices
- name: Build and push cass-operator-bundle
id: docker_build_cass-operator_bundle
uses: docker/build-push-action@v6
with:
file: bundle.Dockerfile
build-args: |
VERSION=${{ steps.vars.outputs.version }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/cass-operator-bundle:v${{ steps.vars.outputs.version }}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and update cass-operator-catalog
run: |
make VERSION=${{ steps.vars.outputs.version }} CHANNEL=dev catalog-build catalog-push