From be189707715ef0dfc6e9d6e632311a976276af76 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 13:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96Helm=20Chart?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=92=8C=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++++++ helm-chart/.helmignore | 3 ++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 helm-chart/.gitlab-ci.yml diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml new file mode 100644 index 00000000..fec489e9 --- /dev/null +++ b/helm-chart/.gitlab-ci.yml @@ -0,0 +1,36 @@ +stages: + - build + - package + +# 将Helm Chart版本作为tag,构建并推送镜像 +build-adapter-cm-generator: + stage: build + image: reg.mikumikumi.xyz/base/kaniko-builder:latest + rules: + - changes: + - helm-chart/files/** + - helm-chart/templates/** + - helm-chart/Chart.yaml + - helm-chart/values.yaml + variables: + BUILD_CONTEXT: helm-chart/adapter-cm-generator + BUILD_DESTINATION: reg.mikumikumi.xyz/maibot/adapter-cm-generator + script: + - export BUILD_CONTEXT=helm-chart/adapter-cm-generator + - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) + - export BUILD_ARGS="--destination ${TMP_DST}:${CHART_VERSION} --destination ${TMP_DST}:latest" + - build + +# 打包并推送helm chart +package-helm-chart: + stage: package + image: reg.mikumikumi.xyz/mirror/helm:latest + rules: + - changes: + - helm-chart/adapter-cm-generator/** + script: + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) + - helm registry login reg.mikumikumi.xyz --username ${HARBOR_USERNAME} --password ${HARBOR_PASSWORD} + - helm package helm-chart + - helm push maibot-${CHART_VERSION}.tgz oci://reg.mikumikumi.xyz/maibot diff --git a/helm-chart/.helmignore b/helm-chart/.helmignore index 015ae876..8cb2bba7 100644 --- a/helm-chart/.helmignore +++ b/helm-chart/.helmignore @@ -1 +1,2 @@ -adapter-cm-generator \ No newline at end of file +adapter-cm-generator +.gitlab-ci.yml \ No newline at end of file