Skip to content

Upgrade cass-operator to v1.22.3 (#1410) #3221

Upgrade cass-operator to v1.22.3 (#1410)

Upgrade cass-operator to v1.22.3 (#1410) #3221

name: Run unit/integration tests and build image
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
jobs:
unit_integration_tests:
name: Run unit/integration tests
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
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: golangci-lint
uses: golangci/golangci-lint-action@v6
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: Run unit and integration tests
run: |
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
make envtest test
- name: Check that the build did not generate additional git changes
run: |
if [ -n "$(git status --porcelain)" ]; then
git status
exit 1
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
build_image:
name: Build and push image to Docker Hub
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
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
- name: Compute tags
id: compute_tags
run: |
echo "TAGS=k8ssandra/k8ssandra-operator:${{ steps.vars.outputs.sha_short }},k8ssandra/k8ssandra-operator:latest" >> $GITHUB_ENV
- name: Compute release tags
id: compute_release_tags
if: startsWith(github.ref, 'refs/heads/release/')
run: |
echo "head ref = ${{ github.head_ref }}"
branch_ref=${{ github.ref }}
release_prefix=${branch_ref:19}
echo "TAGS=k8ssandra/k8ssandra-operator:${{ steps.vars.outputs.sha_short }},k8ssandra/k8ssandra-operator:${release_prefix}-latest" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
file: Dockerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.TAGS }}
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
helm_release:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
name: Helm release
needs: unit_integration_tests
uses: ./.github/workflows/helm_release.yaml
with:
helm_repo: stable
prerelease: true
secrets:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
GCP_HELM_BUCKET_NAME: ${{ secrets.GCP_HELM_BUCKET_NAME }}