-
Notifications
You must be signed in to change notification settings - Fork 66
147 lines (142 loc) · 6.59 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Cass Operator Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
# Allow to rerun this for a tag to get updated UBI-images
jobs:
release_cass_operator:
name: Release Docker Image
runs-on: ubuntu-latest
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 QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: ${{ !env.ACT }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: ${{ !env.ACT }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set git parsed values
id: vars
shell: bash
run: |
echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "TARGET_VERSION=$(echo ${GITHUB_REF#refs/tags/} | awk '{print substr($0,2)}')" >> $GITHUB_ENV
- name: Build system-logger
id: docker_build_system-logger
uses: docker/build-push-action@v6
with:
file: logger.Dockerfile
build-args: |
VERSION=${{ env.TARGET_VERSION }}
context: .
load: true
tags: k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}, ghcr.io/k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build cass-operator
id: docker_build_cass-operator
uses: docker/build-push-action@v6
with:
file: Dockerfile
build-args: |
VERSION=${{ env.TARGET_VERSION }}
context: .
load: true
tags: k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}, ghcr.io/k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Push system-logger
id: docker_push_system-logger
uses: docker/build-push-action@v6
with:
file: logger.Dockerfile
build-args: |
VERSION=${{ env.TARGET_VERSION }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}, ghcr.io/k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64, linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Push cass-operator
id: docker_push_cass-operator
uses: docker/build-push-action@v6
with:
file: Dockerfile
build-args: |
VERSION=${{ env.TARGET_VERSION }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}, ghcr.io/k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64, linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Tag and push images for Red Hat certification
shell: bash
if: ${{ !env.ACT }}
run: |
docker tag k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}} quay.io/redhat-isv-containers/5ebee0e40e3deaf258b160d1:${{ steps.vars.outputs.tag_name}}
docker tag k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}} quay.io/redhat-isv-containers/6138f998fb33d420b79f0af9:${{ steps.vars.outputs.tag_name}}
docker login -u redhat-isv-containers+5ebee0e40e3deaf258b160d1-robot quay.io -p ${{ secrets.CASS_OPERATOR_CONNECT_SECRET }}
docker push quay.io/redhat-isv-containers/5ebee0e40e3deaf258b160d1:${{ steps.vars.outputs.tag_name}}
docker login -u redhat-isv-containers+6138f998fb33d420b79f0af9-robot quay.io -p ${{ secrets.SYSTEM_LOGGER_CONNECT_SECRET }}
docker push quay.io/redhat-isv-containers/6138f998fb33d420b79f0af9:${{ steps.vars.outputs.tag_name}}
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "mirror"
oc: "4"
- name: Install CLI tools from GitHub
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "github"
github_pat: ${{ github.token }}
preflight: "latest"
- name: Run preflight checks and submit results
shell: bash
run: |
docker login -u redhat-isv-containers+5ebee0e40e3deaf258b160d1-robot quay.io -p ${{ secrets.CASS_OPERATOR_CONNECT_SECRET }}
preflight check container quay.io/redhat-isv-containers/5ebee0e40e3deaf258b160d1:${{ steps.vars.outputs.tag_name}} --certification-project-id=5ebee0e40e3deaf258b160d1 --pyxis-api-token=${{ secrets.PREFLIGHT_KEY }} --submit --docker-config=$HOME/.docker/config.json
docker login -u redhat-isv-containers+6138f998fb33d420b79f0af9-robot quay.io -p ${{ secrets.SYSTEM_LOGGER_CONNECT_SECRET }}
preflight check container quay.io/redhat-isv-containers/6138f998fb33d420b79f0af9:${{ steps.vars.outputs.tag_name}} --certification-project-id=6138f998fb33d420b79f0af9 --pyxis-api-token=${{ secrets.PREFLIGHT_KEY }} --submit --docker-config=$HOME/.docker/config.json
- name: Create bundle
shell: bash
if: ${{ !env.ACT }} # Act does not have yq
run: |
make IMG=k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}} VERSION=${{ env.TARGET_VERSION }} bundle
- name: Build and push cass-operator-bundle
id: docker_build_cass-operator_bundle
if: ${{ !env.ACT }}
uses: docker/build-push-action@v6
with:
file: bundle.Dockerfile
build-args: |
VERSION=${{ env.TARGET_VERSION }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/cass-operator-bundle:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache