File tree Expand file tree Collapse file tree
deploy/cert-manager-alidns-webhook Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868 run : |
6969 helm lint deploy/cert-manager-alidns-webhook
7070
71+ version-check :
72+ if : startsWith(github.ref, 'refs/tags/v')
73+ runs-on : ubuntu-latest
74+ timeout-minutes : 2
75+ steps :
76+ - name : Checkout
77+ uses : actions/checkout@v4
78+
79+ - name : Check release version sync
80+ run : ./scripts/check-version.sh
81+
7182 docker-release :
7283 if : startsWith(github.ref, 'refs/tags/v')
73- needs : [test, helm-lint]
84+ needs : [test, helm-lint, version-check ]
7485 uses : ./.github/workflows/docker-release.yaml
7586 secrets : inherit
7687 permissions :
8091
8192 helm-release :
8293 if : startsWith(github.ref, 'refs/tags/v')
83- needs : [test, helm-lint]
94+ needs : [test, helm-lint, version-check ]
8495 uses : ./.github/workflows/helm-release.yaml
8596 secrets : inherit
8697 permissions :
Original file line number Diff line number Diff line change 3333 - name : Package Helm Chart
3434 run : |
3535 cd deploy/cert-manager-alidns-webhook
36- helm package .
36+ VERSION=${GITHUB_REF_NAME#v}
37+ helm package . --version "${VERSION}" --app-version "${VERSION}"
3738
3839 - name : Login to GitHub Container Registry
3940 uses : docker/login-action@v3
Original file line number Diff line number Diff line change 1313- [ 开发环境] ( #开发环境 )
1414- [ 故障排查] ( #故障排查 )
1515- [ 测试指南] ( #测试指南 )
16+ - [ 发布流程] ( #发布流程 )
1617- [ 参考资源] ( #参考资源 )
1718
1819---
@@ -351,6 +352,39 @@ make test-all
351352
352353---
353354
355+ ## 发布流程
356+
357+ 发布使用 Git tag 作为唯一版本源,Chart 版本、appVersion 和镜像标签保持一致。
358+
359+ ### 版本约定
360+
361+ - Git tag: ` vX.Y.Z `
362+ - Helm chart: ` version: X.Y.Z `
363+ - Helm chart: ` appVersion: X.Y.Z `
364+ - Docker image tag: ` X.Y.Z `
365+
366+ ### 发布步骤
367+
368+ ``` bash
369+ # 1. 更新 Chart.yaml version/appVersion
370+ make release VERSION=0.1.3
371+
372+ # 2. 提交变更
373+ git add deploy/cert-manager-alidns-webhook/Chart.yaml
374+ git commit -m " release: v0.1.3"
375+
376+ # 3. 打 tag 并推送
377+ git tag -a v0.1.3 -m " release: v0.1.3"
378+ git push --follow-tags
379+ ```
380+
381+ ### 校验说明
382+
383+ - ` scripts/check-version.sh ` 会确保 tag 与 ` Chart.yaml ` 的 ` version/appVersion ` 完全一致
384+ - CI 在 tag 触发时强制执行校验,不一致会阻止发布
385+
386+ ---
387+
354388## 参考资源
355389
356390### 阿里云官方文档
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ clean:
5050build :
5151 docker build -t " $( IMAGE_NAME) :$( IMAGE_TAG) " .
5252
53+ .PHONY : release
54+ release :
55+ ./scripts/release.sh $(VERSION )
56+
5357.PHONY : rendered-manifest.yaml
5458rendered-manifest.yaml : $(OUT ) /rendered-manifest.yaml
5559
Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ kubectl delete configmap aliyun-config
270270| :------------------------------------ | :------------------------- | :------------------------------------- |
271271| ` groupName ` | API group name | ` alidns.crazygit.github.io ` |
272272| ` image.repository ` | Image repository | ` crazygit/cert-manager-alidns-webhook ` |
273- | ` image.tag ` | Image tag | ` latest ` |
273+ | ` image.tag ` | Image tag | ` "" ` (defaults to chart appVersion) |
274274| ` replicaCount ` | Replica count | ` 1 ` |
275275| ` aliyunAuth.regionID ` | Alibaba Cloud region ID | ` "" ` |
276276| ` aliyunAuth.accessKeyID ` | AccessKey ID | ` "" ` |
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ kubectl delete configmap aliyun-config
269269| :------------------------------------ | :---------------------------- | :------------------------------------- |
270270| ` groupName ` | API 组名 | ` alidns.crazygit.github.io ` |
271271| ` image.repository ` | 镜像仓库 | ` crazygit/cert-manager-alidns-webhook ` |
272- | ` image.tag ` | 镜像标签 | ` latest ` |
272+ | ` image.tag ` | 镜像标签 | ` "" ` (默认使用 chart 的 appVersion) |
273273| ` replicaCount ` | 副本数 | ` 1 ` |
274274| ` aliyunAuth.regionID ` | 阿里云区域 ID | ` "" ` |
275275| ` aliyunAuth.accessKeyID ` | AccessKey ID | ` "" ` |
Original file line number Diff line number Diff line change 11apiVersion : v1
2- appVersion : " v0 .1.2 "
2+ appVersion : " 0 .1.4 "
33description : |
44 AliDNS Webhook for cert-manager - A cert-manager webhook solver for Alibaba Cloud DNS.
55
@@ -8,7 +8,7 @@ description: |
88 ECS instance RAM role, and more via the Alibaba Cloud credentials-go default credential chain.
99
1010name : cert-manager-alidns-webhook
11- version : 0.1.2
11+ version : 0.1.4
1212keywords :
1313 - cert-manager
1414 - alidns
Original file line number Diff line number Diff line change 2323 serviceAccountName : {{ include "cert-manager-alidns-webhook.fullname" . }}
2424 containers :
2525 - name : {{ .Chart.Name }}
26- image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
26+ image : " {{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
2727 imagePullPolicy : {{ .Values.image.pullPolicy }}
2828 args :
2929 - --tls-cert-file=/tls/tls.crt
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ certManager:
1616
1717image :
1818 repository : ghcr.io/crazygit/cert-manager-alidns-webhook
19- tag : latest
19+ tag : " "
2020 pullPolicy : IfNotPresent
2121
2222nameOverride : " "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ CHART_PATH=" deploy/cert-manager-alidns-webhook/Chart.yaml"
5+
6+ version_input=" ${1:- } "
7+
8+ if [[ -n " ${version_input} " ]]; then
9+ version=" ${version_input# v} "
10+ elif [[ -n " ${GITHUB_REF_NAME:- } " ]]; then
11+ version=" ${GITHUB_REF_NAME# v} "
12+ else
13+ tag=" $( git describe --tags --exact-match 2> /dev/null || true) "
14+ if [[ -z " ${tag} " ]]; then
15+ echo " ERROR: no version provided and no exact git tag found." >&2
16+ exit 1
17+ fi
18+ version=" ${tag# v} "
19+ fi
20+
21+ chart_version=" $( awk -F: ' /^version:/{gsub(/[ "]/,"",$2); print $2; exit}' " ${CHART_PATH} " ) "
22+ app_version=" $( awk -F: ' /^appVersion:/{gsub(/[ "]/,"",$2); print $2; exit}' " ${CHART_PATH} " ) "
23+
24+ if [[ " ${chart_version} " != " ${version} " ]]; then
25+ echo " ERROR: Chart version (${chart_version} ) != release version (${version} )." >&2
26+ exit 1
27+ fi
28+
29+ if [[ " ${app_version} " != " ${version} " ]]; then
30+ echo " ERROR: Chart appVersion (${app_version} ) != release version (${version} )." >&2
31+ exit 1
32+ fi
33+
34+ echo " OK: version=${version} , chart.version=${chart_version} , chart.appVersion=${app_version} "
You can’t perform that action at this time.
0 commit comments