Skip to content

[CRDB-51639]: Add v2 chart packaging and multi-registry publishing, publish self-signer image to DockerHub.#617

Open
NishanthNalluri wants to merge 2 commits intomasterfrom
nishanth/publish-helm-charts-v2
Open

[CRDB-51639]: Add v2 chart packaging and multi-registry publishing, publish self-signer image to DockerHub.#617
NishanthNalluri wants to merge 2 commits intomasterfrom
nishanth/publish-helm-charts-v2

Conversation

@NishanthNalluri
Copy link
Copy Markdown
Contributor

@NishanthNalluri NishanthNalluri commented Apr 13, 2026

This PR extends the build and release pipeline to package and publish the latest operator and cockroachdb charts from cockroachdb-parent/charts/ to existing prod GCS bucket (in /v2/ path), Google Artifact Registry, and DockerHub as OCI artifacts.

The changes also include publishing the self-signer image to Dockerhub in addition to the existing GCR artifact.

@NishanthNalluri NishanthNalluri changed the title Nishanth/publish helm charts v2 build: Add v2 chart packaging and multi-registry publishing, publish self-signer image to DockerHub. Apr 13, 2026
@NishanthNalluri NishanthNalluri changed the title build: Add v2 chart packaging and multi-registry publishing, publish self-signer image to DockerHub. [CRDB-51639]: Add v2 chart packaging and multi-registry publishing, publish self-signer image to DockerHub. Apr 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the build/release tooling to package and publish “v2” Helm charts (operator + cockroachdb from cockroachdb-parent/charts/) to a /v2/ Helm repo path and to OCI registries, and adds DockerHub publishing for the self-signer image.

Changes:

  • Add build/v2-charts and release/v2 flows, including v2 chart packaging and /v2/index.yaml generation/merge.
  • Extend release publishing to upload v2 artifacts to GCS and push chart packages as OCI artifacts to GAR and DockerHub.
  • Publish the self-signer image to DockerHub in GitHub Actions in addition to GCR.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Makefile Adds v2 build/release targets; adds DockerHub self-signer push target and shared tag variable.
build/teamcity-make-and-publish-charts-release.sh Runs both legacy and v2 build+release steps in TeamCity.
build/release.sh Splits legacy vs v2 release logic; adds OCI pushes to GAR and DockerHub.
build/make.sh Adds v2 chart packaging, version-exists checks, and v2 index generation.
.github/workflows/build.yaml Adds DockerHub login and push steps for self-signer image.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/release.sh Outdated
Comment on lines +85 to +96
push_oci_gar() {
local gar_registry="${OCI_GAR_REGISTRY:-us-docker.pkg.dev/releases-prod/self-hosted/charts}"
local gar_host="${gar_registry%%/*}"

echo "Authenticating with GAR for OCI push (${gar_host})..."
gcloud auth print-access-token | helm registry login "${gar_host}" --username oauth2accesstoken --password-stdin

echo "Pushing charts to OCI registry: ${gar_registry}"
for chart_pkg in build/artifacts/v2/*.tgz; do
echo " Pushing ${chart_pkg}..."
helm push "${chart_pkg}" "oci://${gar_registry}" || {
echo " Warning: OCI push to GAR failed for ${chart_pkg}. The charts repository in GAR may need to be created."
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

release.sh now calls helm registry login / helm push, but the script does not ensure Helm is installed or on PATH (unlike build/make.sh, which installs Helm into ./bin). In TeamCity, build/make.sh runs in a separate process so its exported PATH won’t persist for build/release.sh, which can cause the v2 release to fail with helm: command not found. Consider invoking ./bin/helm explicitly (if present) or adding a small Helm installation/validation step in release.sh before OCI pushes.

Copilot uses AI. Check for mistakes.
Comment thread build/release.sh
Comment on lines +92 to +100
echo "Pushing charts to OCI registry: ${gar_registry}"
for chart_pkg in build/artifacts/v2/*.tgz; do
echo " Pushing ${chart_pkg}..."
helm push "${chart_pkg}" "oci://${gar_registry}" || {
echo " Warning: OCI push to GAR failed for ${chart_pkg}. The charts repository in GAR may need to be created."
echo " Expected path: oci://${gar_registry}"
}
done
}
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both OCI push loops swallow helm push failures (they only print a warning and continue). This means the release job can succeed even when charts are not actually published to the OCI registries, which contradicts the PR’s intent to publish to GAR/DockerHub. Consider failing the script on push errors (or making the behavior explicitly configurable via an env var).

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/build.yaml Outdated
Comment on lines +63 to +70
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Self-signer to DockerHub
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DockerHub login/push steps are gated only on DOCKERHUB_USERNAME being non-empty, but they also require DOCKERHUB_TOKEN. If the token secret is missing/empty, the workflow will attempt to login and fail. Update the if: condition to require both secrets (and optionally check both in one place to avoid duplication).

Suggested change
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Self-signer to DockerHub
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Self-signer to DockerHub
if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}

Copilot uses AI. Check for mistakes.
Comment thread build/make.sh
Comment on lines +56 to +73
# v2_chart_version_exists checks if a specific chart version already exists
# in the v2 Helm repository.
v2_chart_version_exists() {
local chart_name="$1"
local chart_dir="$2"

if [ "$is_prod" = true ] && ! chart_version_exists; then
echo "Skipping build: chart version already present in production."
exit 0
fi
helm repo add cockroachdb-v2 "https://${charts_hostname}/v2" --force-update 2>/dev/null || true
helm repo update cockroachdb-v2 2>/dev/null || true

local existing_version
existing_version=$(grep 'version:' "${chart_dir}/Chart.yaml" | awk '{print $2}')
# Use --devel to also match prerelease versions (e.g., 26.1.2-preview).
if helm search repo "cockroachdb-v2/${chart_name}" --devel --version "$existing_version" 2>/dev/null | grep -q "$existing_version"; then
echo "Chart ${chart_name} version $existing_version already exists in v2 repository."
return 0
fi
return 1
}
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chart_version_exists and the new v2_chart_version_exists use opposite success semantics (legacy returns non-zero when the version exists, v2 returns zero when the version exists). This inconsistency is easy to misuse and can lead to incorrect skip logic later. Consider aligning the return codes or renaming one of the functions to reflect its actual truthiness.

Copilot uses AI. Check for mistakes.
This commit extends the build and release pipeline to package and publish the operator
and cockroachdb charts from cockroachdb-parent/charts/ to existing prod GCS bucket (in /v2/ path),
Google Artifact Registry, and DockerHub as OCI artifacts.
This commit adds `build-and-push/self-signer-dockerhub` Makefile target and extend
build.yaml workflow to push `cockroach-self-signer-cert` image to DockerHub
alongside GCR. DockerHub steps are gated on DOCKERHUB_USERNAME secret.
@NishanthNalluri NishanthNalluri force-pushed the nishanth/publish-helm-charts-v2 branch from e049c05 to f00c322 Compare April 14, 2026 07:43
@NishanthNalluri NishanthNalluri marked this pull request as ready for review April 14, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants