mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-06 23:23:23 +09:00
feat(installer): add Artifact Hub publication and linting (#5565)
## What this PR does Adds chart metadata and installation instructions for the installer package on Artifact Hub. Stable release finalization publishes the repository metadata and excludes nightly versions from indexing. PR checks run the Artifact Hub linter only when the installer chart or its lint workflow changes. Closes #4760. The currently indexed chart has no README. The README will appear with a new chart release. No registry content was published manually. Validation: Helm lint, template rendering, 15 installer unit tests, 25 publication and toolchain BATS checks, and Artifact Hub lint with the pinned CI image. The installer has no `make generate` target. Zizmor reports no findings; actionlint reports the same unsupported `queue` field and shell quoting findings as the base branch. ### Screenshots Not applicable. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note feat(installer): add Artifact Hub metadata and a README for cozy-installer, and publish repository metadata during stable releases. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * The Cozystack installer Helm chart is listed on Artifact Hub, making it easier to find and explore. * Stable releases publish the chart’s Artifact Hub metadata. * Added chart details and installation guidance, including supported cluster variants and configuration options. * Installer chart metadata is checked during relevant pull requests. * **Documentation** * Updated the project README and release pipeline guide with Artifact Hub information. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
8 files changed
+189
-2
No files matched your search
@@ -0,0 +1,29 @@
|
||||
name: Artifact Hub metadata
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
paths:
|
||||
- 'packages/core/installer/**'
|
||||
- '.github/workflows/artifacthub.yaml'
|
||||
|
||||
concurrency:
|
||||
group: artifacthub-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
artifacthub:
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: artifacthub/ah:v1.24.0@sha256:97a90dba76f9cf550f0f93187222505ba104e3af72ab4a7bbe63b370aebaa6e7
|
||||
options: --user root
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Lint installer metadata
|
||||
run: ah lint --kind helm --path packages/core/installer
|
||||
@@ -497,6 +497,21 @@ jobs:
|
||||
"docker://${REGISTRY}/cozy-installer:latest"
|
||||
fi
|
||||
|
||||
- name: Set up ORAS
|
||||
if: ${{ !contains(steps.get_tag.outputs.tag, '-') }}
|
||||
uses: oras-project/setup-oras@ac735097e22fe643015b0d19645f7c9a69942128 # v2.0.4
|
||||
with:
|
||||
version: "1.4.0"
|
||||
|
||||
- name: Publish Artifact Hub metadata
|
||||
if: ${{ !contains(steps.get_tag.outputs.tag, '-') }}
|
||||
working-directory: packages/core/installer
|
||||
run: |
|
||||
oras push "${REGISTRY}/cozy-installer:artifacthub.io" \
|
||||
--annotation org.opencontainers.image.source=https://github.com/cozystack/cozystack \
|
||||
--config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
|
||||
artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
|
||||
|
||||
# Last on purpose: the release page is what announces this version, so it
|
||||
# goes public only once the stable images and chart it points at exist. A
|
||||
# failed retag leaves the draft in place, where a re-run finds it again.
|
||||
|
||||
@@ -37,7 +37,7 @@ You can install only the Cozystack components you need on an existing Kubernetes
|
||||
|
||||
The documentation is located on the [cozystack.io](https://cozystack.io) website.
|
||||
|
||||
Read the [Getting Started](https://cozystack.io/docs/v1.6/getting-started/) section for a quick start.
|
||||
Read the [Getting Started](https://cozystack.io/docs/v1.6/getting-started/) section for a quick start. The `cozy-installer` Helm chart is registered on [Artifact Hub](https://artifacthub.io/packages/helm/cozystack/cozy-installer).
|
||||
|
||||
If you encounter any difficulties, start with the [troubleshooting guide](https://cozystack.io/docs/v1.6/operations/troubleshooting/) and work your way through the process that we've outlined.
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ Fires on merge of a PR that is merged, carries the `release` label, and is autho
|
||||
3. **Cut the `api/apps/v1alpha1/vX.Y.Z` Go-module tag** (write-once, stable only) at the same commit, so Go consumers of `api/apps/v1alpha1` get the release. Moved here from `tags.yaml`, whose `prepare-release` body is skipped for a promoted stable (the draft already exists).
|
||||
4. **Ensure the maintenance branch `release-X.Y` exists** at the tag commit. Since the rc freeze creates it, this is normally a no-op fast-forward — the merge commit is already the branch tip. Still created if missing; updated fast-forward-only — a non-fast-forward update warns and is left for a maintainer rather than being force-updated.
|
||||
5. **Resolve the draft release** and decide whether it becomes `latest`, before anything is written to the registry, so a missing draft fails the job while no stable image name exists yet. `make_latest` is computed against published-non-prerelease tags: prereleases stay `false`; tags older than the current max stay `false`.
|
||||
6. **Retag the verified packages candidate and rc container images to stable** by digest (`hack/promote-retag.sh`, no container rebuild) and **publish the stable `cozy-installer` chart**. `:latest` (on both the images and the chart) moves only when this release's `make_latest` was `true` — the decision step 5 made, so the release's `latest` and the images' `:latest` agree within a run. The chart is packaged with `platformVersion` stamped into its default values so the documented `helm --install --version X.Y.Z` path reports the stable version.
|
||||
6. **Retag the verified packages candidate and rc container images to stable** by digest (`hack/promote-retag.sh`, no container rebuild) and **publish the stable `cozy-installer` chart**. `:latest` (on both the images and the chart) moves only when this release's `make_latest` was `true` — the decision step 5 made, so the release's `latest` and the images' `:latest` agree within a run. The chart is packaged with `platformVersion` stamped into its default values so the documented `helm --install --version X.Y.Z` path reports the stable version. Finalize then publishes `packages/core/installer/artifacthub-repo.yml` to the chart repository's `artifacthub.io` tag for Artifact Hub publisher verification and nightly-version exclusion.
|
||||
7. **Publish the draft release**, with `docs/releasenotes/vX.Y.Z.md`, or without it `docs/changelogs/vX.Y.Z.md`, from the merge commit as its body (absent or whitespace-only files warn and leave the draft's body in place, rather than publishing blank notes, and a body over 100000 bytes is published as a link, see [Phase 6](#phase-6--update-releasenotesyaml-sync-github-release-body)). It runs last on purpose: the release page is what announces the version, so it goes public only once the images and chart it points at exist, and a failed retag leaves the draft in place for a re-run. For an older patch tag cut after a newer minor, the current max is force-restored to `latest` if necessary, so `latest` is not downgraded.
|
||||
|
||||
### Phase 6 — `update-releasenotes.yaml` (sync GitHub Release body)
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BATS_TEST_FILENAME:-$0}")/.." && pwd)"
|
||||
FINALIZE="$REPO_ROOT/.github/workflows/pull-requests-release.yaml"
|
||||
|
||||
setup() {
|
||||
strict_setup
|
||||
mkdir -p "$BATS_TEST_TMPDIR/bin"
|
||||
yq --exit-status '.jobs.finalize.steps[] | select(.name == "Publish Artifact Hub metadata") | .run' "$FINALIZE" > "$BATS_TEST_TMPDIR/publish.sh"
|
||||
WORKDIR="$REPO_ROOT/$(yq --exit-status '.jobs.finalize.steps[] | select(.name == "Publish Artifact Hub metadata") | .working-directory' "$FINALIZE")"
|
||||
cat > "$BATS_TEST_TMPDIR/bin/oras" <<'SH'
|
||||
#!/bin/sh
|
||||
printf '%s\n' "$@" > "$ORAS_ARGS"
|
||||
pwd > "$ORAS_CWD"
|
||||
exit "${ORAS_STATUS:-0}"
|
||||
SH
|
||||
chmod +x "$BATS_TEST_TMPDIR/bin/oras"
|
||||
export PATH="$BATS_TEST_TMPDIR/bin:$PATH"
|
||||
export ORAS_ARGS="$BATS_TEST_TMPDIR/args" ORAS_CWD="$BATS_TEST_TMPDIR/cwd"
|
||||
}
|
||||
|
||||
@test "metadata publication targets the chart repository with Artifact Hub media types" {
|
||||
export REGISTRY=ghcr.io/example/charts
|
||||
(cd "$WORKDIR" && bash "$BATS_TEST_TMPDIR/publish.sh")
|
||||
expected="$(printf '%s\n' push ghcr.io/example/charts/cozy-installer:artifacthub.io --annotation org.opencontainers.image.source=https://github.com/cozystack/cozystack --config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml)"
|
||||
[ "$(cat "$ORAS_ARGS")" = "$expected" ]
|
||||
[ "$(cat "$ORAS_CWD")" = "$REPO_ROOT/packages/core/installer" ]
|
||||
[ -f "$(cat "$ORAS_CWD")/artifacthub-repo.yml" ]
|
||||
}
|
||||
|
||||
@test "PR checks lint the installer metadata and propagate lint failures" {
|
||||
workflow="$REPO_ROOT/.github/workflows/artifacthub.yaml"
|
||||
yq --exit-status '.jobs.artifacthub.steps[] | select(.name == "Lint installer metadata") | .run' "$workflow" > "$BATS_TEST_TMPDIR/lint.sh"
|
||||
cat > "$BATS_TEST_TMPDIR/bin/ah" <<'SH'
|
||||
#!/bin/sh
|
||||
printf '%s\n' "$@" > "$ORAS_ARGS"
|
||||
exit "${AH_STATUS:-0}"
|
||||
SH
|
||||
chmod +x "$BATS_TEST_TMPDIR/bin/ah"
|
||||
(cd "$REPO_ROOT" && bash "$BATS_TEST_TMPDIR/lint.sh")
|
||||
[ "$(cat "$ORAS_ARGS")" = "$(printf '%s\n' lint --kind helm --path packages/core/installer)" ]
|
||||
export AH_STATUS=42
|
||||
run bash "$BATS_TEST_TMPDIR/lint.sh"
|
||||
[ "$status" -eq 42 ]
|
||||
}
|
||||
|
||||
@test "Artifact Hub checks are limited to installer and workflow changes" {
|
||||
paths="$(yq --exit-status '.on.pull_request.paths[]' "$REPO_ROOT/.github/workflows/artifacthub.yaml")"
|
||||
[ "$paths" = "$(printf '%s\n' 'packages/core/installer/**' '.github/workflows/artifacthub.yaml')" ]
|
||||
}
|
||||
|
||||
@test "the installer chart ships a README for Artifact Hub" {
|
||||
chart="$REPO_ROOT/packages/core/installer"
|
||||
version="$(yq '.version' "$chart/Chart.yaml")"
|
||||
helm package "$chart" --destination "$BATS_TEST_TMPDIR"
|
||||
tar --extract --gzip --file "$BATS_TEST_TMPDIR/cozy-installer-$version.tgz" --to-stdout cozy-installer/README.md > "$BATS_TEST_TMPDIR/README.md"
|
||||
[ -s "$BATS_TEST_TMPDIR/README.md" ]
|
||||
}
|
||||
|
||||
@test "a failed metadata push fails the release step" {
|
||||
export REGISTRY=ghcr.io/example/charts ORAS_STATUS=42
|
||||
run bash -c 'cd "$1" && bash "$2"' -- "$REPO_ROOT" "$BATS_TEST_TMPDIR/publish.sh"
|
||||
[ "$status" -eq 42 ]
|
||||
}
|
||||
|
||||
@test "metadata publication runs only for stable releases before announcing the release" {
|
||||
condition="$(yq '.jobs.finalize.steps[] | select(.name == "Publish Artifact Hub metadata") | .if' "$FINALIZE")"
|
||||
[ "$condition" = "\${{ !contains(steps.get_tag.outputs.tag, '-') }}" ]
|
||||
names="$(yq '.jobs.finalize.steps[].name' "$FINALIZE")"
|
||||
chart="$(printf '%s\n' "$names" | grep --line-number '^Publish stable cozy-installer chart$' | awk -F: '{print $1}')"
|
||||
metadata="$(printf '%s\n' "$names" | grep --line-number '^Publish Artifact Hub metadata$' | awk -F: '{print $1}')"
|
||||
release="$(printf '%s\n' "$names" | grep --line-number '^Publish draft release$' | awk -F: '{print $1}')"
|
||||
[ "$chart" -lt "$metadata" ]
|
||||
[ "$metadata" -lt "$release" ]
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
apiVersion: v2
|
||||
name: cozy-installer
|
||||
description: Install Cozystack, an open-source platform for building clouds with managed Kubernetes, virtual machines, and databases.
|
||||
type: application
|
||||
home: https://cozystack.io
|
||||
icon: https://raw.githubusercontent.com/cncf/artwork/main/projects/cozystack/icon/color/cozystack-icon-color.svg
|
||||
sources:
|
||||
- https://github.com/cozystack/cozystack
|
||||
keywords:
|
||||
- cozystack
|
||||
- cloud
|
||||
- kubernetes
|
||||
- virtualization
|
||||
- database
|
||||
annotations:
|
||||
artifacthub.io/license: Apache-2.0
|
||||
artifacthub.io/links: |
|
||||
- name: Documentation
|
||||
url: https://cozystack.io/docs/
|
||||
- name: Installation
|
||||
url: https://cozystack.io/docs/v1.6/install/kubernetes/generic/
|
||||
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
|
||||
@@ -0,0 +1,38 @@
|
||||
# Cozystack installer
|
||||
|
||||
[Cozystack](https://cozystack.io) is an open-source platform for building clouds with managed Kubernetes clusters, virtual machines, databases, and object storage. This chart deploys the Cozystack operator, which bootstraps the platform's package management.
|
||||
|
||||
## Before installing
|
||||
|
||||
Follow the [installation documentation](https://cozystack.io/docs/) to prepare your Kubernetes cluster and nodes. Cozystack manages cluster networking and storage; this is not an application chart for an arbitrary existing cluster.
|
||||
|
||||
## Install the operator
|
||||
|
||||
Chart versions are listed on [Artifact Hub](https://artifacthub.io/packages/helm/cozystack/cozy-installer).
|
||||
|
||||
The example below is for a prepared Talos cluster. Set `KUBE_CONTEXT` to the target cluster's kubeconfig context and `COZYSTACK_VERSION` to the chart version you want to install.
|
||||
|
||||
```bash
|
||||
KUBE_CONTEXT="<TARGET_CONTEXT>"
|
||||
COZYSTACK_VERSION="<CHART_VERSION>"
|
||||
|
||||
helm upgrade --install cozystack \
|
||||
oci://ghcr.io/cozystack/cozystack/cozy-installer \
|
||||
--kube-context "$KUBE_CONTEXT" \
|
||||
--namespace cozy-system \
|
||||
--create-namespace \
|
||||
--version "$COZYSTACK_VERSION" \
|
||||
--set cozystackOperator.variant=talos
|
||||
```
|
||||
|
||||
The operator variants are `talos` (default), `generic`, and `hosted`. For `generic`, also set `cozystack.apiServerHost` to the control-plane node's internal IP address and `cozystack.apiServerPort` to its API port (default `6443`). Follow the installation guide for your environment rather than using the Talos example unchanged.
|
||||
|
||||
## Configure the platform
|
||||
|
||||
Pass `--context "$KUBE_CONTEXT"` to every `kubectl` command in the linked guide, so configuration is applied to the same cluster as the Helm install.
|
||||
|
||||
Installing the operator does not configure the complete platform. Create the platform `Package` and configure networking, publishing, and storage as described in the [getting started guide](https://cozystack.io/docs/v1.6/getting-started/).
|
||||
|
||||
## Source and license
|
||||
|
||||
The source is available in [cozystack/cozystack](https://github.com/cozystack/cozystack). Cozystack is licensed under [Apache-2.0](https://github.com/cozystack/cozystack/blob/main/LICENSE).
|
||||
@@ -0,0 +1,9 @@
|
||||
repositoryID: d26e335a-6ba0-4ca2-a970-7eef5f4f40e2
|
||||
owners:
|
||||
- name: Timur Tukaev
|
||||
email: 6355522@gmail.com
|
||||
- name: Andrei Kvapil
|
||||
email: kvapss@gmail.com
|
||||
ignore:
|
||||
- name: cozy-installer
|
||||
version: '^0\.0\.0-nightly'
|
||||
Reference in new issue
Block a user