Skip to content

Commit 5a9d104

Browse files
authored
feat: Implement release process (#5)
1 parent 08bfec3 commit 5a9d104

File tree

5 files changed

+323
-0
lines changed

5 files changed

+323
-0
lines changed

.github/assets-config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
archives:
2+
- source: docs
3+
outputName: docs
4+
archiveType: tar

.github/docker-build-config.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"components": [
3+
{
4+
"name": "qubership-rabbitmq-integration-tests",
5+
"file": "operator/operator-robot-image/Dockerfile",
6+
"context": "operator/operator-robot-image"
7+
},
8+
{
9+
"name": "qubership-rabbitmq-operator",
10+
"file": "operator/Dockerfile",
11+
"context": "operator"
12+
},
13+
{
14+
"name": "qubership-rabbitmq-transfer",
15+
"file": "docker-transfer/Dockerfile",
16+
"context": ""
17+
},
18+
{
19+
"name": "qubership-rabbitmq-backup-daemon",
20+
"file": "rabbitmq-backup-daemon/Dockerfile",
21+
"context": "rabbitmq-backup-daemon"
22+
},
23+
{
24+
"name": "qubership-rabbitmq-performance-tests-image",
25+
"file": "performance-tests-image/Dockerfile",
26+
"context": "performance-tests-image"
27+
},
28+
{
29+
"name": "qubership-rabbitmq-monitoring",
30+
"file": "telegraf/Dockerfile",
31+
"context": "telegraf"
32+
},
33+
{
34+
"name": "qubership-rabbitmq-image",
35+
"file": "rabbitmq-docker/4.0/Dockerfile",
36+
"context": "rabbitmq-docker"
37+
},
38+
{
39+
"name": "qubership-rabbitmq-image-3",
40+
"file": "rabbitmq-docker/3.13/Dockerfile",
41+
"context": "rabbitmq-docker"
42+
}
43+
],
44+
"platforms": "linux/amd64,linux/arm64"
45+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
3+
charts:
4+
- name: qubership-rabbitmq
5+
chart_file: operator/charts/helm/rabbitmq/Chart.yaml
6+
values_file: operator/charts/helm/rabbitmq/values.yaml
7+
image:
8+
- ghcr.io/netcracker/qubership-rabbitmq-integration-tests:${release}
9+
- ghcr.io/netcracker/qubership-rabbitmq-operator:${release}
10+
- ghcr.io/netcracker/qubership-rabbitmq-transfer:${release}
11+
- ghcr.io/netcracker/qubership-rabbitmq-backup-daemon:${release}
12+
- ghcr.io/netcracker/qubership-rabbitmq-performance-tests-image:${release}
13+
- ghcr.io/netcracker/qubership-rabbitmq-monitoring:${release}
14+
- ghcr.io/netcracker/qubership-rabbitmq-image:${release}
15+
- ghcr.io/netcracker/qubership-rabbitmq-image-3:${release}
16+
- ghcr.io/netcracker/qubership-disaster-recovery-daemon:${drd_release}
17+
- ghcr.io/netcracker/qubership-deployment-status-provisioner:${sp_release}

.github/release-drafter-config.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name-template: '$RESOLVED_VERSION'
2+
tag-template: '$RESOLVED_VERSION'
3+
4+
5+
categories:
6+
- title: '💣 Breaking Changes'
7+
labels:
8+
- breaking-change
9+
- title: '💡 New Features'
10+
labels:
11+
- feature
12+
- enhancement
13+
- title: '🐞 Bug Fixes'
14+
labels:
15+
- bug
16+
- fix
17+
- bugfix
18+
- title: '⚙️ Technical Debt'
19+
labels:
20+
- refactor
21+
- title: '📝 Documentation'
22+
labels:
23+
- documentation
24+
25+
change-template: '- $TITLE (#$NUMBER) by @$AUTHOR'
26+
no-changes-template: 'No significant changes'
27+
28+
template: |
29+
## 🚀 Release
30+
31+
### What's Changed
32+
$CHANGES
33+
34+
---
35+
36+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION
37+
38+
version-resolver:
39+
major:
40+
labels:
41+
- major
42+
minor:
43+
labels:
44+
- minor
45+
patch:
46+
labels:
47+
- patch
48+
default: patch
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
---
2+
3+
name: Helm Charts Release
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
release:
8+
description: 'Release version'
9+
required: true
10+
type: string
11+
drd_release:
12+
description: 'DRD Release version'
13+
required: true
14+
type: string
15+
sp_release:
16+
description: 'Status Provisioner Release version'
17+
required: true
18+
type: string
19+
permissions:
20+
contents: write
21+
packages: write
22+
run-name: ${{ github.repository }} Release ${{ github.event.inputs.release }}
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
env:
27+
drd_release: ${{ inputs.drd_release }}
28+
sp_release: ${{ inputs.sp_release }}
29+
jobs:
30+
check-tag:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Check if tag exists
34+
id: check_tag
35+
uses: netcracker/qubership-workflow-hub/actions/tag-action@main
36+
with:
37+
tag-name: '${{ inputs.release }}'
38+
ref: ${{ github.ref }}
39+
create-tag: false
40+
check-tag: true
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
load-docker-build-components:
45+
runs-on: ubuntu-latest
46+
outputs:
47+
component: ${{ steps.load_component.outputs.components }}
48+
platforms: ${{ steps.load_component.outputs.platforms }}
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
52+
53+
- name: Load Docker Configuration
54+
id: load_component
55+
run: |
56+
verify=$(cat "$GITHUB_WORKSPACE/.github/docker-build-config.json" | jq '
57+
def verify_structure:
58+
.components as $components
59+
| .platforms as $platforms
60+
| ($components | type == "array")
61+
and (all($components[]; has("name") and has("file") and has("context")))
62+
and ($platforms | type == "string");
63+
verify_structure
64+
| if . then true else false end
65+
')
66+
if [ ${verify} == 'true' ]; then
67+
echo "✅ $GITHUB_WORKSPACE/.github/docker-build-config.json file is valid"
68+
components=$(jq -c ".components" "$GITHUB_WORKSPACE/.github/docker-build-config.json")
69+
platforms=$(jq -c ".platforms" "$GITHUB_WORKSPACE/.github/docker-build-config.json")
70+
else
71+
echo "❗ $GITHUB_WORKSPACE/.github/docker-build-config.json file is invalid"
72+
echo "❗ $GITHUB_WORKSPACE/.github/docker-build-config.json file is invalid" >> $GITHUB_STEP_SUMMARY
73+
exit 1
74+
fi
75+
echo "components=${components}" >> $GITHUB_OUTPUT
76+
echo "platforms=${platforms}" >> $GITHUB_OUTPUT
77+
78+
docker-check-build:
79+
needs: [load-docker-build-components, check-tag]
80+
runs-on: ubuntu-latest
81+
strategy:
82+
fail-fast: true
83+
matrix:
84+
component: ${{ fromJson(needs.load-docker-build-components.outputs.component) }}
85+
steps:
86+
- name: Get version for current component
87+
id: get-version
88+
run: |
89+
echo "IMAGE=${{ matrix.component.name }}" >> $GITHUB_ENV
90+
- name: Docker build
91+
uses: netcracker/qubership-workflow-hub/actions/docker-action@main
92+
with:
93+
ref: ${{ github.ref }}
94+
download-artifact: false
95+
dry-run: true
96+
component: ${{ toJson(matrix.component) }}
97+
platforms: ${{ needs.load-docker-build-components.outputs.platforms }}
98+
tags: "${{ env.IMAGE_VERSION }}"
99+
env:
100+
GITHUB_TOKEN: ${{ github.token }}
101+
chart-release-prepare:
102+
needs: [check-tag, load-docker-build-components, docker-check-build]
103+
runs-on: ubuntu-latest
104+
outputs:
105+
images-versions: ${{ steps.update-versions.outputs.images-versions }}
106+
steps:
107+
- name: Checkout code
108+
uses: actions/checkout@v4
109+
with:
110+
fetch-depth: 0
111+
- name: "Update versions in values"
112+
id: update-versions
113+
uses: netcracker/qubership-workflow-hub/actions/helm-charts-release@main
114+
with:
115+
release-version: ${{ inputs.release }}
116+
config-file: .github/helm-charts-release-config.yaml
117+
env:
118+
${{ insert }}: ${{ vars }}
119+
- name: "Debug"
120+
run: |
121+
echo "Images versions: ${{ steps.update-versions.outputs.images-versions }}"
122+
tag:
123+
needs: [chart-release-prepare]
124+
runs-on: ubuntu-latest
125+
steps:
126+
- name: Create release tag
127+
uses: netcracker/qubership-workflow-hub/actions/tag-action@main
128+
with:
129+
tag-name: "${{ inputs.release }}"
130+
ref: "release-${{ inputs.release }}"
131+
create-tag: true
132+
check-tag: false
133+
docker-build:
134+
needs: [tag, chart-release-prepare, load-docker-build-components]
135+
runs-on: ubuntu-latest
136+
strategy:
137+
fail-fast: true
138+
matrix:
139+
component: ${{ fromJson(needs.load-docker-build-components.outputs.component) }}
140+
steps:
141+
- name: Get version for current component
142+
id: get-version
143+
run: |
144+
echo "IMAGE_VERSION=${{ fromJson(needs.chart-release-prepare.outputs.images-versions)[matrix.component.name] || inputs.release }}" >> $GITHUB_ENV
145+
146+
- name: Docker build
147+
uses: netcracker/qubership-workflow-hub/actions/docker-action@main
148+
with:
149+
ref: ${{ inputs.release }}
150+
download-artifact: false
151+
dry-run: false
152+
component: ${{ toJson(matrix.component) }}
153+
platforms: ${{ needs.load-docker-build-components.outputs.platforms }}
154+
tags: "${{ env.IMAGE_VERSION }},latest"
155+
env:
156+
GITHUB_TOKEN: ${{ github.token }}
157+
158+
charts-release:
159+
needs: [tag, docker-build]
160+
continue-on-error: true
161+
runs-on: ubuntu-latest
162+
steps:
163+
- name: Checkout code
164+
uses: actions/checkout@v4
165+
with:
166+
fetch-depth: 0
167+
ref: release-${{ inputs.release }}
168+
169+
- name: Configure Git
170+
run: |
171+
git config user.name "$GITHUB_ACTOR"
172+
git config user.email "[email protected]"
173+
174+
- name: Run chart-releaser
175+
uses: netcracker/chart-releaser-action@main
176+
with:
177+
charts_dir: charts/helm
178+
release_name_template: "{{ .Version }}"
179+
env:
180+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
181+
182+
- name: "Release-drafter"
183+
uses: netcracker/release-drafter@master
184+
with:
185+
config-name: release-drafter-config.yml
186+
publish: true
187+
name: ${{ inputs.release }}
188+
tag: ${{ inputs.release }}
189+
version: ${{ inputs.release }}
190+
env:
191+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
192+
upload-assets:
193+
needs: [charts-release]
194+
runs-on: ubuntu-latest
195+
steps:
196+
- name: Checkout code
197+
uses: actions/checkout@v4
198+
with:
199+
ref: ${{ inputs.release }}
200+
201+
- name: Archive and Upload Assets
202+
uses: netcracker/qubership-workflow-hub/actions/archive-and-upload-assets@main
203+
with:
204+
config-path: './.github/assets-config.yml'
205+
dist-path: './dist'
206+
upload: true
207+
ref: ${{ inputs.release }}
208+
env:
209+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)