1
- # Copyright 2020 The OpenEBS Authors. All rights reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- name : release
1
+ name : Release Images and Charts
15
2
16
3
on :
17
4
release :
18
5
types :
19
6
- " created"
20
7
21
8
jobs :
9
+ lint :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout
13
+ uses : actions/checkout@v4
14
+ with :
15
+ fetch-depth : 0
16
+
17
+ - uses : cachix/install-nix-action@v22
18
+ -
uses :
rrbutani/[email protected]
19
+ with :
20
+ file : shell.nix
21
+
22
+ - name : Check if the chart is publishable
23
+ run : |
24
+ TAG=${{ github.event.release.tag_name }}
25
+ ./scripts/update-chart-version.sh --tag $TAG --publish-release
26
+
27
+ - name : Run chart-testing lint
28
+ run : |
29
+ ct lint --config ct.yaml
30
+
31
+ unit-tests :
32
+ runs-on : ubuntu-latest
33
+ steps :
34
+ - name : Checkout
35
+ uses : actions/checkout@v4
36
+
37
+ - name : Unit test
38
+ run : make test
39
+
40
+ - name : Upload Coverage Report
41
+ uses : codecov/codecov-action@v4
42
+ with :
43
+ token : ${{ secrets.CODECOV_TOKEN }}
44
+ file : ./coverage.txt
45
+ name : coverage-$(date +%s)
46
+ flags : unittests
47
+
48
+ bdd-tests :
49
+ runs-on : ubuntu-latest
50
+ needs : ["unit-tests"]
51
+ strategy :
52
+ fail-fast : true
53
+ matrix :
54
+ kubernetes : [v1.27.3]
55
+ steps :
56
+ - name : Checkout
57
+ uses : actions/checkout@v4
58
+
59
+ - name : Set up Go 1.19
60
+ uses : actions/setup-go@v4
61
+ with :
62
+ go-version : 1.19.9
63
+ cache : false
64
+
65
+ - name : Build images locally
66
+ run : make zfs-driver-image || exit 1;
67
+
68
+ - name : Setup zfs pools
69
+ run : |
70
+ sudo apt-get install zfsutils-linux -y
71
+ truncate -s 100G /tmp/disk.img
72
+ sudo zpool create zfspv-pool $(sudo losetup -f /tmp/disk.img --show)
73
+
74
+ - name : Setup Minikube-Kubernetes
75
+ uses : medyagh/setup-minikube@latest
76
+ with :
77
+ cache : false
78
+ minikube-version : 1.31.1
79
+ driver : none
80
+ kubernetes-version : ${{ matrix.kubernetes }}
81
+ cni : calico
82
+ start-args : " --install-addons=false"
83
+
84
+ - name : Setting environment variables
85
+ run : |
86
+ echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
87
+ echo "OPENEBS_NAMESPACE=openebs" >> $GITHUB_ENV
88
+
89
+ - name : bootstrap
90
+ run : make bootstrap
91
+
92
+ - name : Running tests
93
+ run : |
94
+ make ci
95
+ make sanity
96
+
97
+ - name : Upload CI Test Coverage Report
98
+ uses : codecov/codecov-action@v4
99
+ with :
100
+ token : ${{ secrets.CODECOV_TOKEN }}
101
+ file : ./tests/bdd_coverage.txt
102
+ name : coverage-bdd_coverage-$(date +%s)
103
+ flags : bddtests
104
+
22
105
csi-driver :
23
- if : contains(github.ref, 'tags/v')
24
106
runs-on : ubuntu-latest
107
+ needs : ["lint", "bdd-tests"]
25
108
steps :
26
109
- name : Checkout
27
110
uses : actions/checkout@v4
28
-
111
+
112
+ - uses : cachix/install-nix-action@v22
113
+ - name : Pre-populate nix-shell
114
+ run : |
115
+ export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
116
+ echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
117
+ nix-shell --pure --run "echo" ./shell.nix
118
+
119
+ - name : Check if the chart is publishable
120
+ run : |
121
+ TAG=${{ github.event.release.tag_name }}
122
+ nix-shell --pure --run "./scripts/update-chart-version.sh --tag $TAG --publish-release" ./shell.nix
123
+
29
124
- name : Set Image Org
30
- # sets the default IMAGE_ORG to openebs
31
125
run : |
32
126
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
33
127
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
34
128
35
- - name : Set Tag and Branch
129
+ - name : Set IMAGE_TAG and BRANCH
36
130
run : |
37
- TAG="${GITHUB_REF#refs/*/v}"
38
- echo "TAG=${TAG}" >> $GITHUB_ENV
39
- echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
40
- BRANCH="v${TAG%.*}.x"
41
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
131
+ BRANCH=${{ github.ref_name }}
132
+ echo "BRANCH=$BRANCH" >> $GITHUB_ENV
133
+ echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $$2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
42
134
43
135
- name : Set Build Date
44
136
id : date
45
137
run : |
46
138
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
47
-
139
+
48
140
- name : Docker meta
49
141
id : docker_meta
50
142
uses : docker/metadata-action@v4
@@ -56,36 +148,12 @@ jobs:
56
148
ghcr.io/${{ env.IMAGE_ORG }}/zfs-driver
57
149
tags : |
58
150
type=raw,value=latest,enable=false
59
- type=raw,value=${{ env.TAG }}
60
-
61
- - name : Print Build info
62
- run : |
63
- echo "${{ steps.docker_meta.outputs.tags }}"
64
- echo "RELEASE TAG: ${RELEASE_TAG}"
65
- echo "RELEASE BRANCH: ${BRANCH}"
66
-
67
- - name : Configure Git
68
- run : |
69
- git config user.name "GitHub Actions"
70
- git config user.email "[email protected] "
151
+ type=raw,value=${{ env.IMAGE_TAG }}
71
152
72
- - name : Update Operator YAML
73
- if : " !github.event.release.prerelease"
153
+ - name : Print Tag info
74
154
run : |
75
- echo "update the operator yaml with the image tag"
76
- sed -i "s/zfs-driver:.*/zfs-driver:${RELEASE_TAG}/" deploy/yamls/zfs-driver.yaml
77
- sed -i "s/openebs.io\/version:.*/openebs.io\/version: ${RELEASE_TAG}/" deploy/yamls/zfs-driver.yaml
78
- sed -i "s/zfs-driver:.*/zfs-driver:${RELEASE_TAG}/" deploy/zfs-operator.yaml
79
- sed -i "s/openebs.io\/version:.*/openebs.io\/version: ${RELEASE_TAG}/" deploy/zfs-operator.yaml
80
- sed -i "s/newTag:.*/newTag: ${RELEASE_TAG}/" deploy/yamls/kustomization.yaml
81
-
82
- git diff --quiet deploy/ || CHANGED=$?
83
- if [[ $CHANGED -ne 0 ]]; then
84
- echo "Commiting operator yaml changes"
85
- git add deploy/
86
- git commit -s -m 'chore(yaml): updating operator yaml with the image tag'
87
- git push origin HEAD:"${BRANCH}"
88
- fi
155
+ echo "BRANCH: ${{ env.BRANCH }}"
156
+ echo "${{ steps.docker_meta.outputs.tags }}"
89
157
90
158
- name : Set up QEMU
91
159
uses : docker/setup-qemu-action@v3
@@ -99,11 +167,11 @@ jobs:
99
167
version : v0.13.1
100
168
101
169
- name : Login to Docker Hub
102
- uses : docker/login-action@v3
170
+ uses : docker/login-action@v3
103
171
with :
104
172
username : ${{ secrets.DOCKERHUB_USERNAME }}
105
173
password : ${{ secrets.DOCKERHUB_TOKEN }}
106
-
174
+
107
175
- name : Login to Quay
108
176
uses : docker/login-action@v3
109
177
with :
@@ -131,4 +199,28 @@ jobs:
131
199
DBUILD_DATE=${{ steps.date.outputs.DATE }}
132
200
DBUILD_REPO_URL=https://github.com/openebs/zfs-localpv
133
201
DBUILD_SITE_URL=https://openebs.io
134
- RELEASE_TAG=${{ env.RELEASE_TAG }}
202
+ BRANCH=${{ env.BRANCH }}
203
+
204
+ release-chart :
205
+ runs-on : ubuntu-latest
206
+ needs : ["csi-driver"]
207
+ steps :
208
+ - uses : actions/checkout@v4
209
+
210
+ - uses : cachix/install-nix-action@v22
211
+ - name : Pre-populate nix-shell
212
+ run : |
213
+ export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
214
+ echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
215
+ nix-shell --pure --run "echo" ./shell.nix
216
+
217
+ - name : Check if the chart is publishable
218
+ run : |
219
+ TAG=${{ github.event.release.tag_name }}
220
+ nix-shell --pure --run "./scripts/update-chart-version.sh --tag $TAG --publish-release" ./shell.nix
221
+
222
+ - name : Publish zfs localpv develop or prerelease helm chart
223
+ uses : stefanprodan/helm-gh-pages@master
224
+ with :
225
+ token : ${{ secrets.GITHUB_TOKEN }}
226
+ charts_dir : ./deploy/helm
0 commit comments