修复 Helm:解决 CI 流水线故障与模板边界场景

- 修复 S3 存储模式下卷挂载条件渲染
- CI 多行参数不再被 YAML 尾随换行符截断
- 移除未使用的 database.architecture 字段
- 简化 Helm Chart 发布工作流

Signed-off-by: jangrui <admin@jangrui.com>
This commit is contained in:
jangrui 2026-05-18 16:54:00 +08:00 committed by jangrui
parent 6ed5fb34dc
commit 5909bc1a1a
7 changed files with 75 additions and 186 deletions

View file

@ -67,25 +67,25 @@ jobs:
args: ""
- name: external-db-redis
description: 外置 PostgreSQL + Redis
args: >
args: >-
--set database.mode=external
--set redis.mode=external
- name: external-sentinel
description: 外置 DB + Redis 哨兵模式
args: >
args: >-
--set database.mode=external
--set redis.mode=external
--set redis.external.sentinel.enabled=true
--set redis.external.sentinel.nodes="{10.0.0.1:26379,10.0.0.2:26379}"
- name: ingress-tls-certmanager
description: Ingress + TLS + cert-manager
args: >
args: >-
--set ingress.enabled=true
--set ingress.tls.enabled=true
--set ingress.certManager.enabled=true
- name: s3-storage
description: S3 存储
args: >
args: >-
--set storage.provider=s3
--set storage.s3.bucket=test-bucket
--set storage.s3.endpoint=s3.amazonaws.com
@ -96,12 +96,9 @@ jobs:
- name: scanner-disabled
description: 禁用 Scanner
args: --set scanner.enabled=false
- name: db-cluster
description: PostgreSQL cluster 模式
args: --set database.architecture=cluster
- name: hpa-pdb
description: HPA + PDB 开启
args: >
args: >-
--set server.autoscaling.enabled=true
--set web.autoscaling.enabled=true
--set scanner.autoscaling.enabled=true

61
.github/workflows/publish-chart.yml vendored Normal file
View file

@ -0,0 +1,61 @@
name: Publish Helm Chart
on:
release:
types: [published]
workflow_dispatch:
concurrency:
group: publish-chart-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
release:
runs-on: ubuntu-latest
defaults:
run:
working-directory: charts/skillhub
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: latest
- name: Parse version from tag
id: ver
run: |
REF="${{ github.ref_name }}"
# 兼容 v0.2.9、chart-v0.2.9、helm-v0.2.9 三种标签格式
if [[ "$REF" =~ ^(helm|chart)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
VER="${BASH_REMATCH[2]}"
else
VER="${REF#v}"
fi
echo "version=$VER" >> "$GITHUB_OUTPUT"
- name: Lint chart
run: helm lint .
- name: Package and push
run: |
helm package . \
--version "${{ steps.ver.outputs.version }}" \
--app-version "${{ steps.ver.outputs.version }}" \
--destination /tmp/helm-charts
helm push /tmp/helm-charts/skillhub-${{ steps.ver.outputs.version }}.tgz \
oci://ghcr.io/${{ github.repository_owner }}/charts
- name: Upload chart artifact
uses: actions/upload-artifact@v4
with:
name: skillhub-${{ steps.ver.outputs.version }}.tgz
path: /tmp/helm-charts/skillhub-${{ steps.ver.outputs.version }}.tgz
retention-days: 90

View file

@ -1,81 +0,0 @@
name: Publish Helm Chart
on:
release:
types: [published]
workflow_dispatch:
concurrency:
group: publish-helm-chart-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
package:
name: Package and Publish
runs-on: ubuntu-latest
defaults:
run:
working-directory: charts/skillhub
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: latest
- name: Extract chart version from tag
id: chartver
run: |
REF="${{ github.ref_name }}"
# Support helm-vX.Y.Z, chart-vX.Y.Z, or just vX.Y.Z tags
if [[ "$REF" =~ ^(helm|chart)-v?([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
VERSION="${BASH_REMATCH[2]}"
elif [[ "$REF" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
VERSION="${BASH_REMATCH[1]}"
else
# Fallback: use chart.yaml version
VERSION=$(helm show chart . | grep '^version:' | awk '{print $2}')
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Packaging chart version: $VERSION"
- name: Lint chart
run: helm lint
- name: Package chart
run: |
helm package . --version "${{ steps.chartver.outputs.version }}" \
--destination /tmp/helm-charts
echo "Packaged:"
ls -la /tmp/helm-charts/
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push chart to GHCR OCI
run: |
helm push /tmp/helm-charts/skillhub-${{ steps.chartver.outputs.version }}.tgz \
oci://ghcr.io/${{ github.repository_owner }}/charts
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: /tmp/helm-charts/skillhub-${{ steps.chartver.outputs.version }}.tgz
- name: Upload chart artifact
uses: actions/upload-artifact@v4
with:
name: skillhub-${{ steps.chartver.outputs.version }}.tgz
path: /tmp/helm-charts/skillhub-${{ steps.chartver.outputs.version }}.tgz
retention-days: 90

View file

@ -1,89 +0,0 @@
name: Release Helm Chart
on:
push:
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: release-helm-chart
cancel-in-progress: true
permissions:
contents: write
packages: write
jobs:
release:
if: ${{ !startsWith(github.ref_name, 'chart-v') }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: latest
- name: Extract version
id: version
run: |
REF="${{ github.ref_name }}"
APP="${REF#v}"
echo "app=$APP" >> "$GITHUB_OUTPUT"
- name: Update Chart.yaml appVersion
id: chart
working-directory: charts/skillhub
run: |
CHART_VER=$(helm show chart . | grep '^version:' | awk '{print $2}')
echo "chartVersion=$CHART_VER" >> "$GITHUB_OUTPUT"
echo "appVersion=${{ steps.version.outputs.app }}" >> "$GITHUB_OUTPUT"
sed -i "s/^appVersion:.*/appVersion: ${{ steps.version.outputs.app }}/" Chart.yaml
- name: Validate chart
working-directory: charts/skillhub
run: helm lint
- name: Commit and push to main
run: |
git config user.name "skillhub-bot"
git config user.email "bot@skillhub.dev"
git checkout -b release-tmp
git add charts/skillhub/Chart.yaml
git commit -m "chore: update appVersion to ${{ steps.version.outputs.app }}"
git push origin HEAD:main
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package and publish chart
working-directory: charts/skillhub
run: |
helm package . --version "${{ steps.chart.outputs.chartVersion }}" \
--destination /tmp/helm-charts
helm push /tmp/helm-charts/skillhub-${{ steps.chart.outputs.chartVersion }}.tgz \
oci://ghcr.io/${{ github.repository_owner }}/charts
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: /tmp/helm-charts/skillhub-${{ steps.chart.outputs.chartVersion }}.tgz
- name: Upload chart artifact
uses: actions/upload-artifact@v4
with:
name: skillhub-${{ steps.chart.outputs.chartVersion }}.tgz
path: /tmp/helm-charts/skillhub-${{ steps.chart.outputs.chartVersion }}.tgz
retention-days: 90

View file

@ -2,8 +2,8 @@ apiVersion: v2
name: skillhub
description: Self-hosted, open-source agent skill registry for enterprises.
type: application
version: 0.1.0
appVersion: 0.2.8
version: 0.2.9
appVersion: 0.2.9
keywords:
- skillhub
- ai

View file

@ -216,9 +216,11 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if eq .Values.storage.provider "local" }}
volumeMounts:
- name: skillhub-storage
mountPath: /var/lib/skillhub/storage
{{- end }}
resources:
{{- toYaml .Values.server.resources | nindent 12 }}
@ -230,10 +232,12 @@ spec:
livenessProbe:
{{- toYaml .Values.server.probes.liveness | nindent 12 }}
{{- if eq .Values.storage.provider "local" }}
volumes:
- name: skillhub-storage
persistentVolumeClaim:
claimName: {{ include "skillhub.fullname" . }}-storage-pvc
{{- end }}
{{- with .Values.server.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

View file

@ -201,14 +201,11 @@ scanner:
# ============================================================================
# 数据库配置PostgreSQL
# ============================================================================
# mode: internal内置| external外置
# architecture: standalone单实例| cluster高可用集群
# - standalone + internal: 部署单实例 PostgreSQL
# - standalone + external: 连接外置单节点 PostgreSQL
# - cluster 时建议使用 external 模式
# mode: internal内置单实例| external外置
# 内置模式部署单实例 PostgreSQL。
# 如需高可用集群,请使用 external 模式连接外部集群。
database:
mode: internal
architecture: standalone
internal:
image: postgres:16-alpine