Skip to content

Commit 928b899

Browse files
author
datacore-bolt-ci
committed
ci(stability): merge the develop branch
2 parents 48e60db + db0753d commit 928b899

File tree

7 files changed

+364
-58
lines changed

7 files changed

+364
-58
lines changed

.github/workflows/develop-chart.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: cachix/[email protected]
15+
1516
- name: Pre-populate nix-shell
1617
run: |
1718
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
1819
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
1920
nix-shell --pure --run "echo" ./scripts/helm/shell.nix
20-
- name: Check if the chart is publishable
21+
22+
- name: Publish locally in the workspace
2123
run: |
2224
branch="${{ github.ref_name }}"
2325
nix-shell --pure --run "./scripts/helm/publish-chart-yaml.sh --check-chart "$branch"" ./scripts/helm/shell.nix
26+
nix-shell --pure --run "SKIP_GIT=1 ./scripts/helm/generate-readme.sh" ./scripts/helm/shell.nix
27+
2428
- name: Publish Mayastor Helm chart
2529
uses: stefanprodan/[email protected]
2630
env:

.github/workflows/image.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,26 @@ on:
44
branches:
55
- develop
66
- 'release/**'
7-
tags:
8-
- 'v[0-9]+.[0-9]+.[0-9]+**'
7+
workflow_call:
8+
inputs:
9+
tag:
10+
description: 'Tag to be released (e.g. v2.9.0)'
11+
required: true
12+
type: string
13+
registry:
14+
description: 'Registry, example: ghcr.io'
15+
required: true
16+
type: string
17+
namespace:
18+
description: 'Namespace, example: mayastor/dev'
19+
required: true
20+
type: string
921

1022
env:
1123
CARGO_TERM_COLOR: always
1224
CARGO_INCREMENTAL: 0
1325
CI: 1
26+
TAG: ${{ inputs.tag }}
1427

1528
jobs:
1629
image-build-push:
@@ -26,11 +39,27 @@ jobs:
2639
if [ "${{ github.ref_type }}" == "tag" ]; then
2740
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
2841
fi
42+
2943
- uses: cachix/[email protected]
44+
3045
- name: Login to Docker Hub
3146
uses: docker/login-action@v3
3247
with:
3348
username: ${{ secrets.DOCKERHUB_USERNAME }}
3449
password: ${{ secrets.DOCKERHUB_TOKEN }}
50+
51+
- name: Login to GHCR
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
3558
- name: Build and push the release images
36-
run: ./scripts/release.sh
59+
run: |
60+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
61+
nix-shell --pure --run "./scripts/helm/publish-chart-yaml.sh --app-tag ${{ inputs.tag }} --override-chart ${{ inputs.tag }} ${{ inputs.tag }}" ./scripts/helm/shell.nix
62+
./scripts/release.sh --tag ${{ inputs.tag }} --registry ${{ inputs.registry }}/${{ github.repository_owner }}/${{ inputs.namespace }}
63+
elif [[ "${{ github.event_name }}" == "push" ]]; then
64+
./scripts/release.sh
65+
fi

.github/workflows/release-binaries.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: Release Artifacts
22
on:
33
push:
4-
tags:
5-
- 'v[0-9]+.[0-9]+.[0-9]+**'
64
branches:
75
- 'release/**'
86
- 'develop'
7+
workflow_call:
8+
inputs:
9+
tag:
10+
description: 'Tag to build, example: v2.9.0'
11+
required: true
12+
type: string
913

1014
jobs:
1115
kubectl-plugin:
@@ -42,6 +46,7 @@ jobs:
4246
with:
4347
fetch-depth: 0
4448
submodules: recursive
49+
4550
- uses: actions/checkout@v4
4651
env:
4752
checkout_token: ${{ secrets.ORG_CI_GITHUB }}
@@ -56,15 +61,18 @@ jobs:
5661
if [ "${{ github.ref_type }}" == "tag" ]; then
5762
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
5863
fi
64+
5965
- uses: cachix/[email protected]
6066
with:
6167
enable_kvm: false
6268
- run: |
6369
nix-build -A utils.release.${{ matrix.arch }}.${{ matrix.target }}.kubectl-plugin --arg incremental false ${{ matrix.system }}
70+
6471
- name: Archive executable
6572
run: |
6673
# NOTE: Update the .krew.yaml file (if required) when making changes here.
6774
tar -czvf kubectl-mayastor-${{ matrix.arch }}-${{ matrix.target }}.tar.gz LICENSE -C result/bin kubectl-mayastor${{ matrix.suffix }}
75+
6876
- uses: actions/upload-artifact@v4
6977
with:
7078
name: kubectl-mayastor-${{ matrix.arch }}-${{ matrix.target }}

.github/workflows/release.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: Release Tagging Workflow
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
env:
8+
TAG: ${{ github.ref_name }}
9+
CI: 1
10+
11+
jobs:
12+
preflight-checks:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
submodules: recursive
20+
21+
- uses: cachix/[email protected]
22+
- name: Pre-populate nix-shell
23+
run: |
24+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
25+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
26+
nix-shell --pure --run "echo" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix
27+
28+
- name: Login to Docker Hub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+
- name: Validate if the release should be even made
35+
run: |
36+
nix-shell --pure --keep CI --keep TAG --run "./dependencies/control-plane/utils/dependencies/scripts/staging/validate.sh \
37+
--tag ${{ github.ref_name }} \
38+
--type release \
39+
--chart true" \
40+
./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix
41+
42+
release-images:
43+
runs-on: ubuntu-latest
44+
needs: preflight-checks
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
submodules: recursive
51+
52+
- uses: cachix/[email protected]
53+
- name: Pre-populate nix-shell
54+
run: |
55+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
56+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
57+
nix-shell --pure --run "echo" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix
58+
59+
- name: Login to Docker Hub
60+
uses: docker/login-action@v3
61+
with:
62+
username: ${{ secrets.DOCKERHUB_USERNAME }}
63+
password: ${{ secrets.DOCKERHUB_TOKEN }}
64+
65+
- name: Login to GHCR
66+
uses: docker/login-action@v3
67+
with:
68+
registry: ghcr.io
69+
username: ${{ github.actor }}
70+
password: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Mirror images from dev to Docker Hub
73+
run: |
74+
nix-shell --pure --keep CI --keep TAG --run "./dependencies/control-plane/utils/dependencies/scripts/staging/mirror-images.sh \
75+
--source ghcr.io/${{ github.repository_owner }}/mayastor/dev \
76+
--target docker.io/${{ github.repository_owner }} \
77+
--tag ${{ github.ref_name }} \
78+
--chart true" \
79+
./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix
80+
81+
release-kubectl-binaries:
82+
runs-on: ubuntu-latest
83+
needs: preflight-checks
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
with:
88+
fetch-depth: 0
89+
submodules: recursive
90+
91+
- uses: cachix/[email protected]
92+
- name: Pre-populate nix-shell
93+
run: |
94+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
95+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
96+
nix-shell --pure --run "echo" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix
97+
98+
- name: Mirror kubectl artifacts
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
run: |
102+
nix-shell --pure --keep CI --keep TAG --run "./dependencies/control-plane/utils/dependencies/scripts/staging/kubectl-oci.sh pull \
103+
--tag ${{ github.ref_name }} \
104+
--namespace ${{ github.repository_owner }}/mayastor/dev/plugin \
105+
--username ${{ github.actor }} \
106+
--password ${{ secrets.GITHUB_TOKEN }}" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix
107+
108+
./scripts/github/release-artifacts.sh \
109+
--tag ${{ github.ref_name }} \
110+
--repo-org ${{ github.repository_owner }} \
111+
--upload ${{ github.event.repository.name }} \
112+
upload
113+
114+
release-helm-chart:
115+
runs-on: ubuntu-latest
116+
needs: [release-images, preflight-checks]
117+
steps:
118+
- uses: actions/checkout@v4
119+
with:
120+
fetch-depth: 0
121+
submodules: recursive
122+
123+
- name: Login to GHCR
124+
uses: docker/login-action@v3
125+
with:
126+
registry: ghcr.io
127+
username: ${{ github.actor }}
128+
password: ${{ secrets.GITHUB_TOKEN }}
129+
130+
- name: Fetch mayastor chart
131+
env:
132+
RAW_TAG: ${{ github.ref_name }}
133+
IMAGE_ORG: ${{ github.repository_owner }}
134+
run: |
135+
VERSION=${RAW_TAG#v}
136+
echo "CHART_VERSION=$VERSION" >> $GITHUB_ENV
137+
138+
rm -rf charts
139+
mkdir -p charts-staged charts-final chart
140+
141+
CHART_REF=oci://ghcr.io/${IMAGE_ORG}/mayastor/dev/helm/
142+
helm pull "$CHART_REF" \
143+
--version ${VERSION} \
144+
--destination charts-staged
145+
146+
tar -xzf charts-staged/mayastor-"$VERSION".tgz -C charts-final
147+
148+
mv charts-final/mayastor/* chart
149+
150+
- name: Publish helm chart
151+
uses: stefanprodan/[email protected]
152+
env:
153+
TMPDIR: /tmp
154+
with:
155+
token: ${{ secrets.GITHUB_TOKEN }}
156+
charts_dir: .
157+
158+
- name: Publish helm chart as OCI
159+
uses: appany/[email protected]
160+
with:
161+
name: mayastor
162+
repository: ${{ github.repository_owner }}/charts
163+
tag: ${{ env.CHART_VERSION }}
164+
path: ./chart
165+
registry: ghcr.io
166+
registry_username: ${{ github.actor }}
167+
registry_password: ${{ secrets.GITHUB_TOKEN }}
168+
update_dependencies: 'false'

0 commit comments

Comments
 (0)