diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4df7306 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +# Runs when this chart tree is the root of the GitHub repository (e.g. fluid-pub/chart-workload). + +name: Helm chart CI + +on: + pull_request: + push: + branches: + - main + - develop + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Helm + uses: azure/setup-helm@v4 + + - name: Helm lint + run: helm lint . diff --git a/.github/workflows/release-oci-on-semver-tag.yml b/.github/workflows/release-oci-on-semver-tag.yml new file mode 100644 index 0000000..8cd4184 --- /dev/null +++ b/.github/workflows/release-oci-on-semver-tag.yml @@ -0,0 +1,59 @@ +# Semver tags without `v` (e.g. 0.1.0). Tag must equal `version` in Chart.yaml. +name: Helm OCI release + +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+-*" + +permissions: + contents: read + packages: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Helm + uses: azure/setup-helm@v4 + + - name: Verify tag matches Chart.yaml version + run: | + set -euo pipefail + TAG="${GITHUB_REF_NAME}" + CHART_LINE="$(grep -E '^version:[[:space:]]' Chart.yaml | head -1)" + CHART_VER="$(echo "$CHART_LINE" | sed -E 's/^version:[[:space:]]*//; s/[[:space:]]+#.*$//')" + CHART_VER="${CHART_VER%\"}" + CHART_VER="${CHART_VER#\"}" + CHART_VER="${CHART_VER%\'}" + CHART_VER="${CHART_VER#\'}" + CHART_VER="$(echo "$CHART_VER" | sed 's/[[:space:]]*$//')" + if [ "$TAG" != "$CHART_VER" ]; then + echo "::error::Git tag \"$TAG\" must equal Chart.yaml version field \"$CHART_VER\"" + exit 1 + fi + echo "Tag \"$TAG\" matches Chart.yaml version." + + - name: Helm lint + run: helm lint . + + - name: Package chart + run: helm package . + + - name: Log in to GHCR (Helm OCI) + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin + + - name: Push chart to GHCR + run: | + set -euo pipefail + shopt -s nullglob + tgz=(./*.tgz) + if [ "${#tgz[@]}" -ne 1 ]; then + echo "::error::Expected exactly one packaged .tgz, got: ${tgz[*]:-none}" + exit 1 + fi + helm push "${tgz[0]}" "oci://ghcr.io/${{ github.repository_owner }}/fluid-workload" diff --git a/Chart.yaml b/Chart.yaml index 6225ea9..a3376d5 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -3,4 +3,3 @@ name: fluid-workload description: Generic Helm chart for Fluid agents and probes type: application version: 0.1.0 -appVersion: "0.1.0" diff --git a/README.md b/README.md index f95ba4f..1ce3103 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # Helm chart — fluid-workload +In the **`fluid`** monorepo this chart lives under `code/charts/fluid-workload/`; standalone Git (**`fluid-pub/chart-workload`**) uses the same layout at the repository root. + +**Release (standalone repo)** — **`helm lint`** runs on PRs and `main` / `develop`; pushing a semver tag **without `v`** runs **`helm push … oci://ghcr.io//fluid-workload`** when the tag equals **`version`** in **`Chart.yaml`**. + +**Install / pull from GHCR** — Helm OCI on GitHub stores the chart under a path that repeats the chart **`name:`** (see the package page `fluid-workload/fluid-workload`). Use **`--version`** with the full OCI prefix, for example: + +```text +helm pull oci://ghcr.io/fluid-pub/fluid-workload/fluid-workload --version 0.1.0 +``` + +or the equivalent tag form **`oci://ghcr.io/fluid-pub/fluid-workload/fluid-workload:0.1.0`**. The shorter reference **`oci://ghcr.io/fluid-pub/fluid-workload`** (without the second **`fluid-workload`**) does **not** resolve with **`helm pull` / `helm install`** against this registry layout. + Generic chart for **one** Fluid agent or probe image: ConfigMap-mounted YAML config, optional Secret-mounted credentials, extra env. ## Typical values diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 51b3080..946db1a 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -28,7 +28,7 @@ spec: {{- end }} containers: - name: workload - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.service.enabled }} ports: diff --git a/values.yaml b/values.yaml index cb24036..df2e845 100644 --- a/values.yaml +++ b/values.yaml @@ -5,6 +5,7 @@ workload: # Label-only hint for selectors / docs (e.g. agent, probe) kind: workload +# Example image; replace with your agent or probe image and tag at install time. image: repository: ghcr.io/fluid-pub/fluid-agent-example tag: "0.1.0"