Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .ci/pipelines/env_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ REPO_NAME="${REPO_NAME:-rhdh}"
PULL_NUMBER="${PULL_NUMBER:-}"
BUILD_ID="${BUILD_ID:-unknown-build}"
RELEASE_BRANCH_NAME="${RELEASE_BRANCH_NAME:-main}"

# Canonical version stem derived from RELEASE_BRANCH_NAME.
# 'release-1.10' -> '1.10', 'main' -> 'next'
# Used as the default tag for branch-aware image references (e.g., catalog index).
if [[ "$RELEASE_BRANCH_NAME" == "main" ]]; then
RELEASE_VERSION="next"
else
RELEASE_VERSION="${RELEASE_BRANCH_NAME#release-}"
fi

K8S_CLUSTER_TOKEN="${K8S_CLUSTER_TOKEN:-}"
K8S_CLUSTER_URL="${K8S_CLUSTER_URL:-}"
SHARED_DIR="${SHARED_DIR:-$DIR/shared_dir}"
Expand Down Expand Up @@ -47,6 +57,19 @@ IMAGE_REGISTRY="${IMAGE_REGISTRY:-quay.io}"
IMAGE_REPO="${IMAGE_REPO:-${QUAY_REPO:-rhdh-community/rhdh}}"
QUAY_REPO="${IMAGE_REPO}" # Keep QUAY_REPO in sync for backward compatibility

# Catalog index image reference.
# Override via Gangway for RC (e.g., --catalog-index-image quay.io/rhdh/plugin-catalog-index:1.9-60) or
# GA verification (e.g., --catalog-index-image registry.access.redhat.com/rhdh/plugin-catalog-index:1.9.4).
CATALOG_INDEX_IMAGE="${CATALOG_INDEX_IMAGE:-}"
if [[ -n "${CATALOG_INDEX_IMAGE}" ]]; then
# Derived components for Helm chart (requires separate registry/repository/tag)
CATALOG_INDEX_TAG="${CATALOG_INDEX_IMAGE##*:}"
_CI_WITHOUT_TAG="${CATALOG_INDEX_IMAGE%:*}"
CATALOG_INDEX_REGISTRY="${_CI_WITHOUT_TAG%%/*}"
CATALOG_INDEX_REPO="${_CI_WITHOUT_TAG#*/}"
unset _CI_WITHOUT_TAG
fi

# =============================================================================
# Release and Namespace Configuration
# These can be overridden by CI environment or local configuration
Expand Down
15 changes: 7 additions & 8 deletions .ci/pipelines/install-methods/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,15 @@ install_rhdh_operator() {
fi
chmod +x /tmp/install-rhdh-catalog-source.sh

if [[ "$RELEASE_BRANCH_NAME" == "main" ]]; then
if [[ "$RELEASE_VERSION" == "next" ]]; then
log::info "Installing RHDH operator with '--next' flag"
if ! common::retry "$max_attempts" 10 bash -x /tmp/install-rhdh-catalog-source.sh --next --install-operator rhdh; then
log::error "Failed install RHDH Operator after ${max_attempts} attempts."
return 1
fi
else
local operator_version="${RELEASE_BRANCH_NAME#release-}"
if [[ -z "$operator_version" ]]; then
log::error "Failed to extract operator version from RELEASE_BRANCH_NAME: '$RELEASE_BRANCH_NAME'"
return 1
fi
log::info "Installing RHDH operator with '-v $operator_version' flag"
if ! common::retry "$max_attempts" 10 bash -x /tmp/install-rhdh-catalog-source.sh -v "$operator_version" --install-operator rhdh; then
log::info "Installing RHDH operator with '-v $RELEASE_VERSION' flag"
if ! common::retry "$max_attempts" 10 bash -x /tmp/install-rhdh-catalog-source.sh -v "$RELEASE_VERSION" --install-operator rhdh; then
log::error "Failed install RHDH Operator after ${max_attempts} attempts."
return 1
fi
Expand Down Expand Up @@ -78,6 +73,10 @@ deploy_rhdh_operator() {
k8s_wait::crd "backstages.rhdh.redhat.com" 60 5 || return 1

rendered_yaml=$(envsubst < "$backstage_crd_path")
if [[ -n "${CATALOG_INDEX_IMAGE:-}" ]]; then
# Dynamically inject CATALOG_INDEX_IMAGE environment variable if specified
rendered_yaml=$(echo "$rendered_yaml" | yq eval '.spec.application.extraEnvs.envs += [{"name": "CATALOG_INDEX_IMAGE", "value": "'"$CATALOG_INDEX_IMAGE"'", "containers": ["install-dynamic-plugins"]}]' -)
fi
log::info "Applying Backstage CR from: $backstage_crd_path"
log::debug "$rendered_yaml"
echo "$rendered_yaml" | oc apply -f - -n "$namespace"
Expand Down
9 changes: 8 additions & 1 deletion .ci/pipelines/lib/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ helm::uninstall() {
# ==============================================================================

# Get common Helm set parameters for image configuration
# Uses global variables: IMAGE_REGISTRY, IMAGE_REPO, TAG_NAME
# Uses global variables: IMAGE_REGISTRY, IMAGE_REPO, TAG_NAME,
# CATALOG_INDEX_REGISTRY, CATALOG_INDEX_REPO, CATALOG_INDEX_TAG (from env_variables.sh)
# Returns:
# Prints the Helm --set parameters string
helm::get_image_params() {
Expand All @@ -227,6 +228,12 @@ helm::get_image_params() {
# Add image tag
params+="--set upstream.backstage.image.tag=${TAG_NAME} "

if [[ -n "${CATALOG_INDEX_IMAGE:-}" ]]; then
params+="--set global.catalogIndex.image.registry=${CATALOG_INDEX_REGISTRY} "
params+="--set global.catalogIndex.image.repository=${CATALOG_INDEX_REPO} "
params+="--set global.catalogIndex.image.tag=${CATALOG_INDEX_TAG} "
fi

echo "${params}"
return 0
}
Expand Down
4 changes: 0 additions & 4 deletions .ci/pipelines/resources/rhdh-operator/rhdh-start-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ spec:
value: "0"
- name: NODE_ENV
value: "production"
- name: CATALOG_INDEX_IMAGE
value: "quay.io/rhdh/plugin-catalog-index:1.10"
containers:
- install-dynamic-plugins
secrets:
- name: rhdh-secrets
extraFiles:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ spec:
value: "0"
- name: NODE_ENV
value: "production"
- name: CATALOG_INDEX_IMAGE
value: "quay.io/rhdh/plugin-catalog-index:1.10"
containers:
- install-dynamic-plugins
secrets:
- name: rhdh-secrets
extraFiles:
Expand Down
7 changes: 7 additions & 0 deletions .ci/pipelines/resources/rhdh-operator/rhdh-start-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ spec:
- name: postgres-crt
key: postgres-crt.pem
extraEnvs:
envs:
- name: NODE_OPTIONS
value: "--no-node-snapshot"
- name: NODE_ENV
value: "production"
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
secrets:
- name: postgres-cred
route:
Expand Down
4 changes: 0 additions & 4 deletions .ci/pipelines/resources/rhdh-operator/rhdh-start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ spec:
value: "production"
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
- name: CATALOG_INDEX_IMAGE
value: "quay.io/rhdh/plugin-catalog-index:1.10"
containers:
- install-dynamic-plugins
secrets:
- name: rhdh-secrets
- name: redis-secret
4 changes: 0 additions & 4 deletions .ci/pipelines/resources/rhdh-operator/rhdh-start_K8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ spec:
value: "production"
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
- name: CATALOG_INDEX_IMAGE
value: "quay.io/rhdh/plugin-catalog-index:1.10"
containers:
- install-dynamic-plugins
secrets:
- name: rhdh-secrets
- name: redis-secret
45 changes: 41 additions & 4 deletions .ci/pipelines/trigger-nightly-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@
# ./trigger-nightly-job.sh \
# --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly \
# --image-repo rhdh/rhdh-hub-rhel9 \
# --tag 1.9-123
# --tag 1.9-227 \
# --catalog-index-tag 1.9 \
# --chart-version 1.9-227-CI
#
# # Trigger GA verification (released images from registry.access.redhat.com):
# ./trigger-nightly-job.sh \
# --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly \
# --image-registry registry.redhat.io --image-repo rhdh/rhdh-hub-rhel9 --tag 1.9.4 \
# --catalog-index-registry registry.access.redhat.com --catalog-index-tag 1.9.4
#
# # Trigger against a fork:
# ./trigger-nightly-job.sh \
Expand Down Expand Up @@ -57,6 +65,8 @@ TAG_NAME=""
GITHUB_ORG_NAME=""
GITHUB_REPOSITORY_NAME=""
RELEASE_BRANCH_NAME=""
CATALOG_INDEX_IMAGE=""
CHART_VERSION=""
SKIP_SEND_ALERT="true"
DRY_RUN=false

Expand All @@ -72,10 +82,12 @@ Required:
Optional overrides (passed as env var overrides to the job):
-I, --image-registry IMAGE_REGISTRY Override the image registry (default: quay.io).
-q, --image-repo IMAGE_REPO Override the image repository (e.g. rhdh/rhdh-hub-rhel9). Requires --tag to be set.
-t, --tag TAG_NAME Override the image tag (e.g. 1.9-123).
-t, --tag TAG_NAME Override the image tag (e.g. 1.9-227).
-o, --org GITHUB_ORG_NAME Override the GitHub org (default in job: redhat-developer).
-r, --repo GITHUB_REPO_NAME Override the GitHub repo name (default in job: rhdh).
-b, --branch BRANCH Override the branch name.
--catalog-index-image IMAGE Override the catalog index image (default: quay.io/rhdh/plugin-catalog-index:<version>).
--chart-version VERSION Override the Helm chart version (e.g. 1.9-227-CI).
-S, --send-alerts Send Slack alerts (default: alerts are skipped).

Other:
Expand All @@ -86,8 +98,15 @@ Examples:
# Basic trigger:
$(basename "$0") --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly

# Trigger with custom image:
$(basename "$0") --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly --image-registry quay.io --image-repo rhdh/rhdh-hub-rhel9 --tag 1.9-123
# RC verification (productized image + matching catalog index + chart):
$(basename "$0") --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly \\
--image-repo rhdh/rhdh-hub-rhel9 --tag 1.9-227 \\
--catalog-index-image quay.io/rhdh/plugin-catalog-index:1.9 --chart-version 1.9-227-CI

# GA verification (released images from Red Hat registries):
$(basename "$0") --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly \\
--image-registry registry.redhat.io --image-repo rhdh/rhdh-hub-rhel9 --tag 1.9.4 \\
--catalog-index-image registry.access.redhat.com/rhdh/plugin-catalog-index:1.9.4

# Trigger against a fork, with Slack alerts enabled:
$(basename "$0") --job periodic-ci-redhat-developer-rhdh-main-e2e-ocp-helm-nightly --org my-org --repo my-fork --branch release-1.9 --send-alerts
Expand Down Expand Up @@ -160,6 +179,22 @@ parse_args() {
RELEASE_BRANCH_NAME="$2"
shift 2
;;
--catalog-index-image)
[[ $# -ge 2 ]] || {
log::error "--catalog-index-image requires an argument"
exit 1
}
CATALOG_INDEX_IMAGE="$2"
shift 2
;;
--chart-version)
[[ $# -ge 2 ]] || {
log::error "--chart-version requires an argument"
exit 1
}
CHART_VERSION="$2"
shift 2
;;
-S | --send-alerts)
SKIP_SEND_ALERT="false"
shift
Expand Down Expand Up @@ -208,6 +243,8 @@ build_payload() {
[[ -n "${GITHUB_ORG_NAME}" ]] && jq_args+=(--arg MULTISTAGE_PARAM_OVERRIDE_GITHUB_ORG_NAME "${GITHUB_ORG_NAME}")
[[ -n "${GITHUB_REPOSITORY_NAME}" ]] && jq_args+=(--arg MULTISTAGE_PARAM_OVERRIDE_GITHUB_REPOSITORY_NAME "${GITHUB_REPOSITORY_NAME}")
[[ -n "${RELEASE_BRANCH_NAME}" ]] && jq_args+=(--arg MULTISTAGE_PARAM_OVERRIDE_RELEASE_BRANCH_NAME "${RELEASE_BRANCH_NAME}")
[[ -n "${CATALOG_INDEX_IMAGE}" ]] && jq_args+=(--arg MULTISTAGE_PARAM_OVERRIDE_CATALOG_INDEX_IMAGE "${CATALOG_INDEX_IMAGE}")
[[ -n "${CHART_VERSION}" ]] && jq_args+=(--arg MULTISTAGE_PARAM_OVERRIDE_CHART_VERSION "${CHART_VERSION}")
jq_args+=(--arg MULTISTAGE_PARAM_OVERRIDE_SKIP_SEND_ALERT "${SKIP_SEND_ALERT}")

jq -n --arg job "${JOB_NAME}" "${jq_args[@]}" \
Expand Down
121 changes: 5 additions & 116 deletions .claude/commands/trigger-nightly-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,121 +5,10 @@ description: >-
---
# Trigger Nightly Job

Trigger RHDH nightly ProwJobs via `.ci/pipelines/trigger-nightly-job.sh`.
This command delegates to the **prow-trigger-nightly** skill maintained in the [rhdh-skills](https://github.com/redhat-developer/rhdh-skills) repository.

## Flow
## Agent Behavior

1. Fetch available jobs and let the user pick one
2. Ask about image override and additional options (fork, alerts)
3. Show the command, confirm, execute, report results

## Step 1: Fetch Jobs and Select

Fetch configured nightly jobs:

```bash
curl -s 'https://prow.ci.openshift.org/configured-jobs/redhat-developer/rhdh' | grep -oE '"name":"periodic-ci-[^"]*-nightly"' | sed 's/"name":"//;s/"//' | sort
```

Present the jobs in a table with columns: short name and which branches have it. Derive the short name from the job name part after the branch segment (e.g. `e2e-ocp-helm-nightly` → "OCP Helm"):

| Job | main | release-1.9 | release-1.8 |
|-----|------|-------------|-------------|
| OCP Helm | x | x | x |
| AKS Helm | x | x | |

Then ask the user to describe which job and branch they want in natural language.

### Natural Language Mapping

Map the user's description to the matching full job name from the fetched list. If no branch is mentioned, default to `main`:
- "ocp helm" / "openshift helm" → `e2e-ocp-helm-nightly` (not upgrade, not versioned)
- "operator" / "ocp operator" → `e2e-ocp-operator-nightly` (not auth-providers)
- "helm upgrade" / "upgrade test" → `e2e-ocp-helm-upgrade-nightly`
- "auth providers" / "authentication" → `e2e-ocp-operator-auth-providers-nightly`
- "4.17", "4.19", "4.20", "4.21" → `e2e-ocp-v4-{VERSION}-helm-nightly`
- "aks helm" / "azure helm" → `e2e-aks-helm-nightly`
- "aks operator" / "azure operator" → `e2e-aks-operator-nightly`
- "eks helm" / "aws helm" → `e2e-eks-helm-nightly`
- "eks operator" / "aws operator" → `e2e-eks-operator-nightly`
- "gke helm" / "google helm" → `e2e-gke-helm-nightly`
- "gke operator" / "google operator" → `e2e-gke-operator-nightly`
- "osd" / "osd gcp" → `e2e-osd-gcp-helm-nightly` or `e2e-osd-gcp-operator-nightly`
- Branch: "1.9", "release 1.9", "1.8 branch" → match from that branch
- Multiple: "all AKS jobs", "all Operator jobs on main" → offer to trigger them in sequence

### Shared Cluster Constraint (GKE / OSD-GCP only)

GKE and OSD-GCP each share a single cluster — never run two jobs on the same platform simultaneously. Before triggering, warn the user and check:

```bash
curl -s 'https://prow.ci.openshift.org/api/v1/prowjobs?state=triggered&state=pending' 2>/dev/null | jq -r '.items[]?.spec.job // empty' | grep -i '<PLATFORM>' || echo "No running jobs found (note: check may not be fully reliable)"
```

If inconclusive, the user can check: `https://prow.ci.openshift.org/?type=periodic&job=*<PLATFORM>*nightly*`

## Step 2: Options

Present all options together. The user picks by number — multiple selections allowed (e.g. "2, 5"):

**Image override:**
1. **Default image** — no image flags, use whatever the job is configured with
2. **Custom tag only** — override just the tag, keep default registry and repo
3. **Custom repo + tag** — override image repository and tag, keep default registry (`quay.io`)
4. **Fully custom image** — override registry, repo, and tag

**Additional options:**
5. **Fork override** — run against a fork instead of `redhat-developer/rhdh`
6. **Send Slack alerts** — notify at # `--send-alerts`

Constraint: `--image-repo` requires `--tag`, but `--tag` works on its own.

### Follow-up based on selections

**If 2 or 3 selected (quay.io registry)** — fetch available tags and present as numbered options:

```bash
curl -s 'https://quay.io/api/v1/repository/<REPO>/tag/?limit=20&onlyActiveTags=true&filter_tag_name=like:1.' | jq -r '.tags[].name | select(test("^[0-9]+\\.[0-9]+(-[0-9]+)?$"))' | sort -V | tail -20
```

Where `<REPO>` is the image repository (default: `rhdh/rhdh-hub-rhel9`). Present numbered results with a final option to enter a custom tag (e.g. `next`, `latest`). For option 3, also ask for the image repository.

**If 4 selected (non-quay registry)** — ask for all three values (tag fetching not available):
- Registry (e.g. `brew.registry.redhat.io`)
- Image repo (e.g. `rhdh/rhdh-hub-rhel9`)
- Tag (e.g. `1.9`)

**If 5 selected** — ask for:
- GitHub org (`--org`): e.g. `my-github-user`
- Repo name (`--repo`): e.g. `rhdh`
- Branch (`--branch`): e.g. `my-feature-branch`

## Step 3: Confirm and Execute

Show the full command and present final options:

```bash
.ci/pipelines/trigger-nightly-job.sh \
--job <FULL_JOB_NAME> \
[--image-registry <REGISTRY>] \
[--image-repo <REPO>] \
[--tag <TAG>] \
[--org <ORG>] \
[--repo <REPO>] \
[--branch <BRANCH>] \
[--send-alerts] \
[--dry-run]
```

1. **Execute** — run the command as shown
2. **Change something** — go back and modify parameters

After execution, show the API response. If a job URL or ID is returned, display it prominently. On error, help diagnose (common issues: expired token, invalid job name).

## Reference

- Script flags: `-j/--job`, `-I/--image-registry`, `-q/--image-repo`, `-t/--tag`, `-o/--org`, `-r/--repo`, `-b/--branch`, `-S/--send-alerts`, `-n/--dry-run`
- Dedicated kubeconfig at `~/.config/openshift-ci/kubeconfig` — won't interfere with your current cluster context
- If auth is needed, the script opens a browser for SSO login
- Jobs list: https://prow.ci.openshift.org/configured-jobs/redhat-developer/rhdh
- Image tags: https://quay.io/repository/rhdh/rhdh-hub-rhel9?tab=tags
1. **Check if the skill is already installed.** Look for a skill named `prow-trigger-nightly` in the available skills list.
2. **If installed**, invoke it immediately with the user's request.
3. **If not installed**, read the [rhdh-skill repository](https://github.com/redhat-developer/rhdh-skill) to find installation instructions, guide the user through setup, then invoke the skill.
Loading
Loading