Skip to content

Commit 9bee700

Browse files
committed
Supplement workflows configures
1 parent 25df31a commit 9bee700

File tree

6 files changed

+287
-7
lines changed

6 files changed

+287
-7
lines changed

.github/workflows/build_and_push.yml

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ jobs:
7878
uses: actions/checkout@v4
7979

8080
- name: Build images locally
81-
run: make provisioner-localpv-image
81+
run: |
82+
make provisioner-localpv-image
83+
make pvc-manager-image
8284
8385
- name: Setup Minikube-Kubernetes
8486
uses: medyagh/setup-minikube@latest
@@ -205,9 +207,110 @@ jobs:
205207
DBUILD_SITE_URL=https://openebs.io
206208
BRANCH=${{ env.BRANCH }}
207209
210+
pvc-manager:
211+
runs-on: ubuntu-latest
212+
needs: ['integration-test']
213+
steps:
214+
- name: Checkout
215+
uses: actions/checkout@v4
216+
217+
- name: Set up Go 1.19
218+
uses: actions/setup-go@v5
219+
with:
220+
go-version: 1.19.13
221+
222+
- name: Set Image Org
223+
# sets the default IMAGE_ORG to openebs
224+
run: |
225+
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
226+
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
227+
228+
- name: Set CI Tag
229+
run: |
230+
BRANCH=${{ github.ref_name }}
231+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
232+
CI_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)
233+
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
234+
235+
- name: Set Build Date
236+
id: date
237+
run: |
238+
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
239+
240+
- name: Docker meta
241+
id: docker_meta
242+
uses: docker/metadata-action@v4
243+
with:
244+
# add each registry to which the image needs to be pushed here
245+
images: |
246+
${{ env.IMAGE_ORG }}/pvc-manager
247+
quay.io/${{ env.IMAGE_ORG }}/pvc-manager
248+
ghcr.io/${{ env.IMAGE_ORG }}/pvc-manager
249+
tags: |
250+
type=raw,value=latest,enable=false
251+
type=raw,value=${{ env.TAG }}
252+
253+
- name: Print Tag info
254+
run: |
255+
echo "BRANCH: ${{ env.BRANCH }}"
256+
echo "${{ steps.docker_meta.outputs.tags }}"
257+
258+
- name: Set up QEMU
259+
uses: docker/setup-qemu-action@v2
260+
with:
261+
platforms: all
262+
263+
- name: Set up Docker Buildx
264+
id: buildx
265+
uses: docker/setup-buildx-action@v2
266+
with:
267+
version: v0.5.1
268+
269+
- name: Login to DockerHub
270+
uses: docker/login-action@v2
271+
with:
272+
username: ${{ secrets.DOCKERHUB_USERNAME }}
273+
password: ${{ secrets.DOCKERHUB_TOKEN }}
274+
275+
- name: Login to Quay
276+
uses: docker/login-action@v2
277+
with:
278+
registry: quay.io
279+
username: ${{ secrets.QUAY_USERNAME }}
280+
password: ${{ secrets.QUAY_TOKEN }}
281+
282+
- name: Login to GHCR
283+
uses: docker/login-action@v2
284+
with:
285+
registry: ghcr.io
286+
username: ${{ github.actor }}
287+
password: ${{ secrets.GITHUB_TOKEN }}
288+
289+
- name: Checkout
290+
uses: actions/checkout@v4
291+
292+
- name: Build pvc-manager binary
293+
run: make pvc-manager
294+
295+
- name: Build and Push multi-arch Image
296+
uses: docker/build-push-action@v4
297+
with:
298+
context: .
299+
file: ./buildscripts/pvc-manager/Dockerfile
300+
push: true
301+
load: false
302+
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
303+
tags: |
304+
${{ steps.docker_meta.outputs.tags }}
305+
build-args: |
306+
DBUILD_DATE=${{ steps.date.outputs.DATE }}
307+
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
308+
DBUILD_SITE_URL=https://openebs.io
309+
BRANCH=${{ env.BRANCH }}
310+
208311
release-chart:
209312
runs-on: ubuntu-latest
210-
needs: ['provisioner-localpv']
313+
needs: ['provisioner-localpv', 'pvc-manager']
211314
steps:
212315
- uses: actions/checkout@v4
213316
- name: Publish provisioner-localpv develop or prerelease helm chart

.github/workflows/pull_request.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ jobs:
9393
uses: actions/checkout@v4
9494

9595
- name: Build images locally
96-
run: make provisioner-localpv-image
96+
run: |
97+
make provisioner-localpv-image
98+
make pvc-manager-image
9799
98100
- name: Setup Minikube-Kubernetes
99101
uses: medyagh/setup-minikube@latest
@@ -153,3 +155,38 @@ jobs:
153155
push: false
154156
load: false
155157
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
158+
159+
pvc-manager:
160+
runs-on: ubuntu-latest
161+
needs: ['integration-test']
162+
steps:
163+
- name: Set up Go 1.19
164+
uses: actions/setup-go@v5
165+
with:
166+
go-version: 1.19.13
167+
168+
- name: Setup QEMU
169+
uses: docker/setup-qemu-action@v2
170+
with:
171+
platforms: all
172+
173+
- name: Set up Docker Buildx
174+
id: buildx
175+
uses: docker/setup-buildx-action@v2
176+
with:
177+
version: v0.5.1
178+
179+
- name: Checkout
180+
uses: actions/checkout@v4
181+
182+
- name: Build pvc-manager binary
183+
run: make pvc-manager
184+
185+
- name: Build multi-arch Image
186+
uses: docker/build-push-action@v4
187+
with:
188+
context: .
189+
file: ./buildscripts/pvc-manager/Dockerfile
190+
push: false
191+
load: false
192+
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,35 @@ jobs:
9191
QY: quay.io/${{ env.IMAGE_ORG }}/provisioner-localpv:${{ env.VERSION }}
9292
run: |
9393
nix-shell --pure --run "crane copy --platform all ${{ env.SRC }} ${{ env.QY }}"
94+
95+
- name: Mirror pvc-manager multi-arch image with crane to Dockerhub
96+
env:
97+
SRC: ghcr.io/${{ env.IMAGE_ORG }}/dev/pvc-manager:${{ env.VERSION }}
98+
DH: docker.io/${{ env.IMAGE_ORG }}/pvc-manager:${{ env.VERSION }}
99+
run: |
100+
nix-shell --pure --run "crane copy --platform all ${{ env.SRC }} ${{ env.DH }}" ./shell.nix
94101
102+
- name: Mirror pvc-manager multi-arch image with crane to Github
103+
env:
104+
SRC: ghcr.io/${{ env.IMAGE_ORG }}/dev/pvc-manager:${{ env.VERSION }}
105+
GH: ghcr.io/${{ env.IMAGE_ORG }}/pvc-manager:${{ env.VERSION }}
106+
run: |
107+
nix-shell --pure --run "crane copy --platform all ${{ env.SRC }} ${{ env.GH }}" ./shell.nix
108+
109+
- name: Mirror pvc-manager multi-arch image with crane to Quay
110+
env:
111+
SRC: ghcr.io/${{ env.IMAGE_ORG }}/dev/pvc-manager:${{ env.VERSION }}
112+
QY: quay.io/${{ env.IMAGE_ORG }}/pvc-manager:${{ env.VERSION }}
113+
run: |
114+
nix-shell --pure --run "crane copy --platform all ${{ env.SRC }} ${{ env.QY }}"
115+
95116
- name: Update the registry and the repository
96117
run: |
97118
nix-shell --pure --run "./scripts/update-reg-repo.sh --registry docker.io/ --repository ${{ env.IMAGE_ORG }}/provisioner-localpv" ./shell.nix
119+
120+
- name: Update the registry and the repository for pvc-manager
121+
run: |
122+
nix-shell --pure --run "./scripts/update-reg-repo.sh --registry docker.io/ --repository ${{ env.IMAGE_ORG }}/pvc-manager --component pvc-manager" ./shell.nix
98123
99124
- name: Publish chart via helm-gh-pages
100125
uses: stefanprodan/helm-gh-pages@master

.github/workflows/staging.yml

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ jobs:
8181
uses: actions/checkout@v4
8282

8383
- name: Build images locally
84-
run: make provisioner-localpv-image || exit 1;
84+
run: |
85+
make provisioner-localpv-image || exit 1;
86+
make pvc-manager-image || exit 1;
8587
8688
- name: Setup Minikube-Kubernetes
8789
uses: medyagh/setup-minikube@latest
@@ -194,9 +196,94 @@ jobs:
194196
DBUILD_SITE_URL=https://openebs.io
195197
BRANCH=${{ env.BRANCH }}
196198
199+
pvc-manager:
200+
needs: ['integration-test']
201+
runs-on: ubuntu-latest
202+
steps:
203+
- name: Checkout
204+
uses: actions/checkout@v4
205+
206+
- uses: cachix/install-nix-action@v22
207+
- name: Pre-populate nix-shell
208+
run: |
209+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
210+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
211+
nix-shell --pure --run "echo" ./shell.nix
212+
213+
- name: Check if the chart is publishable
214+
run: |
215+
nix-shell --pure --run "./scripts/update-chart-version.sh --tag ${TAG} --publish-release" ./shell.nix
216+
217+
- name: Set Image Org
218+
run: |
219+
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
220+
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
221+
222+
- name: Set IMAGE_TAG and BRANCH
223+
run: |
224+
BRANCH=${{ github.ref_name }}
225+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
226+
echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
227+
228+
- name: Set Build Date
229+
id: date
230+
run: |
231+
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
232+
233+
- name: Docker meta
234+
id: docker_meta
235+
uses: docker/metadata-action@v4
236+
with:
237+
images: |
238+
ghcr.io/${{ env.IMAGE_ORG }}/dev/pvc-manager
239+
tags: |
240+
type=raw,value=latest,enable=false
241+
type=raw,value=${{ env.IMAGE_TAG }}
242+
243+
- name: Print Tag info
244+
run: |
245+
echo "BRANCH: ${{ env.BRANCH }}"
246+
echo "RELEASE_TAG: ${{ steps.docker_meta.outputs.tags }}"
247+
248+
- name: Setup QEMU
249+
uses: docker/setup-qemu-action@v2
250+
with:
251+
platforms: all
252+
253+
- name: Setup Docker Buildx
254+
id: buildx
255+
uses: docker/setup-buildx-action@v2
256+
with:
257+
version: v0.5.1
258+
259+
- name: Login to GHCR
260+
uses: docker/login-action@v2
261+
with:
262+
registry: ghcr.io
263+
username: ${{ github.actor }}
264+
password: ${{ secrets.GITHUB_TOKEN }}
265+
266+
- name: Build pvc-manager binary
267+
run: make pvc-manager
268+
269+
- name: Build and Push Image
270+
uses: docker/build-push-action@v4
271+
with:
272+
context: .
273+
file: ./buildscripts/pvc-manager/Dockerfile
274+
push: true
275+
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
276+
tags: |
277+
${{ steps.docker_meta.outputs.tags }}
278+
build-args: |
279+
DBUILD_DATE=${{ steps.date.outputs.DATE }}
280+
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
281+
DBUILD_SITE_URL=https://openebs.io
282+
BRANCH=${{ env.BRANCH }}
283+
197284
release-chart:
198285
runs-on: ubuntu-latest
199-
needs: ["provisioner-localpv"]
286+
needs: ["provisioner-localpv", "pvc-manager"]
200287
steps:
201288
- uses: actions/checkout@v4
202289

@@ -220,6 +307,10 @@ jobs:
220307
run: |
221308
nix-shell --pure --run "./scripts/update-reg-repo.sh --registry ghcr.io/ --repository ${{ env.IMAGE_ORG }}/dev/provisioner-localpv" ./shell.nix
222309
310+
- name: Update the registry and repository for pvc-manager in values.yaml
311+
run: |
312+
nix-shell --pure --run "./scripts/update-reg-repo.sh --registry ghcr.io/ --repository ${{ env.IMAGE_ORG }}/dev/pvc-manager --component pvc-manager" ./shell.nix
313+
223314
- name: Set Chart Version
224315
run: |
225316
TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)

Makefile.buildx.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ docker.buildx.provisioner-localpv: DOCKERX_IMAGE_NAME=$(PROVISIONER_LOCALPV_IMAG
4646
docker.buildx.provisioner-localpv: COMPONENT=$(PROVISIONER_LOCALPV)
4747
docker.buildx.provisioner-localpv: docker.buildx
4848

49+
.PHONY: docker.buildx.pvc-manager
50+
docker.buildx.pvc-manager: DOCKERX_IMAGE_NAME=$(PVC_MANAGER_IMAGE_TAG)
51+
docker.buildx.pvc-manager: COMPONENT=$(PVC_MANAGER)
52+
docker.buildx.pvc-manager: docker.buildx
53+
4954
.PHONY: buildx.push.provisioner-localpv
5055
buildx.push.provisioner-localpv:
5156
BUILDX=true DIMAGE=${IMAGE_ORG}/provisioner-localpv ./buildscripts/push.sh
57+
58+
.PHONY: buildx.push.pvc-manager
59+
buildx.push.pvc-manager:
60+
BUILDX=true DIMAGE=${IMAGE_ORG}/pvc-manager ./buildscripts/push.sh

scripts/update-reg-repo.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VALUES_YAML="$CHART_DIR/values.yaml"
99

1010
NEW_REGISTRY="ghcr.io"
1111
NEW_REPOSITORY="openebs/dev"
12+
COMPONENT="provisioner-localpv"
1213

1314
source "$SCRIPT_DIR/yq_utils.sh"
1415
source "$SCRIPT_DIR/log.sh"
@@ -20,9 +21,11 @@ Usage: $(basename "$0") [OPTIONS]
2021
Options:
2122
--registry The registry to be updated to.
2223
--repository The repository to be updated to.
24+
--component The component to be updated (provisioner-localpv or pvc-manager).
2325
2426
Examples:
2527
$(basename "$0") --registry ghcr.io --repository openebs/dev
28+
$(basename "$0") --registry ghcr.io --repository openebs/dev --component pvc-manager
2629
EOF
2730
}
2831

@@ -43,6 +46,11 @@ while [ "$#" -gt 0 ]; do
4346
NEW_REPOSITORY=$1
4447
shift
4548
;;
49+
--component)
50+
shift
51+
COMPONENT=$1
52+
shift
53+
;;
4654
*)
4755
help
4856
log_fatal "Unknown option: $1"
@@ -58,5 +66,12 @@ if [ -z "${NEW_REPOSITORY:-}" ]; then
5866
log_fatal "Missing required flag: --repository"
5967
fi
6068

61-
yq_ibl ".localpv.image.registry = \"$NEW_REGISTRY\"" "$VALUES_YAML"
62-
yq_ibl ".localpv.image.repository = \"$NEW_REPOSITORY\"" "$VALUES_YAML"
69+
if [ "$COMPONENT" = "provisioner-localpv" ]; then
70+
yq_ibl ".localpv.image.registry = \"$NEW_REGISTRY\"" "$VALUES_YAML"
71+
yq_ibl ".localpv.image.repository = \"$NEW_REPOSITORY\"" "$VALUES_YAML"
72+
elif [ "$COMPONENT" = "pvc-manager" ]; then
73+
yq_ibl ".pvcManager.image.registry = \"$NEW_REGISTRY\"" "$VALUES_YAML"
74+
yq_ibl ".pvcManager.image.repository = \"$NEW_REPOSITORY\"" "$VALUES_YAML"
75+
else
76+
log_fatal "Unknown component: $COMPONENT. Supported components: provisioner-localpv, pvc-manager"
77+
fi

0 commit comments

Comments
 (0)