From 402d43e7862ef701e025daa37e3d349521094679 Mon Sep 17 00:00:00 2001 From: Trevor Nierman Date: Tue, 14 Jul 2026 14:15:38 -0400 Subject: [PATCH] Derive Konflux tenant and SA from existing pipelines (ROSA-730) Some repos (configure-alertmanager-operator, configure-goalert-operator) have non-standard Konflux tenant namespaces and service accounts from early onboarding. Instead of constructing these from the operator name, read them from the existing Konflux pipeline files in .tekton/ which are the source of truth. Falls back to the -tenant and build-pipeline- conventions if no existing pipelines exist. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../agentic-sdlc-check-pull-request.yaml.tmpl | 4 ++-- boilerplate/openshift/golang-osd-operator/update | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/boilerplate/openshift/golang-osd-operator/agentic-sdlc-check-pull-request.yaml.tmpl b/boilerplate/openshift/golang-osd-operator/agentic-sdlc-check-pull-request.yaml.tmpl index 97504756..2c13d9bb 100644 --- a/boilerplate/openshift/golang-osd-operator/agentic-sdlc-check-pull-request.yaml.tmpl +++ b/boilerplate/openshift/golang-osd-operator/agentic-sdlc-check-pull-request.yaml.tmpl @@ -16,10 +16,10 @@ metadata: appstudio.openshift.io/component: __OPERATOR_NAME__ pipelines.appstudio.openshift.io/type: test name: __OPERATOR_NAME__-agentic-sdlc-check - namespace: __OPERATOR_NAME__-tenant + namespace: __TENANT_NAMESPACE__ spec: taskRunTemplate: - serviceAccountName: build-pipeline-__OPERATOR_NAME__ + serviceAccountName: __SERVICE_ACCOUNT__ pipelineSpec: tasks: - name: clone-repository diff --git a/boilerplate/openshift/golang-osd-operator/update b/boilerplate/openshift/golang-osd-operator/update index ebba7ad5..96aab7cc 100755 --- a/boilerplate/openshift/golang-osd-operator/update +++ b/boilerplate/openshift/golang-osd-operator/update @@ -167,7 +167,11 @@ if [ -d "${REPO_ROOT}/.tekton" ]; then echo "Generating agentic SDLC conformance check pipeline: $(basename ${AGENTIC_CHECK})" DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/upstream/HEAD 2>/dev/null || git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo defaulting/to/master) DEFAULT_BRANCH=${DEFAULT_BRANCH##*/} - ${SED?} "s/__OPERATOR_NAME__/${OPERATOR_NAME}/g; s/__DEFAULT_BRANCH__/${DEFAULT_BRANCH}/g" ${HERE}/agentic-sdlc-check-pull-request.yaml.tmpl > "${AGENTIC_CHECK}" + TENANT_NAMESPACE=$(grep -h 'namespace:' "${REPO_ROOT}"/.tekton/*-pull-request.yaml 2>/dev/null | grep -v agentic | head -1 | awk '{print $2}') + TENANT_NAMESPACE=${TENANT_NAMESPACE:-${OPERATOR_NAME}-tenant} + SERVICE_ACCOUNT=$(grep -h 'serviceAccountName:' "${REPO_ROOT}"/.tekton/${OPERATOR_NAME}*-pull-request.yaml 2>/dev/null | grep -v agentic | grep -v pko | grep -v e2e | head -1 | awk '{print $2}') + SERVICE_ACCOUNT=${SERVICE_ACCOUNT:-build-pipeline-${OPERATOR_NAME}} + ${SED?} "s/__OPERATOR_NAME__/${OPERATOR_NAME}/g; s/__DEFAULT_BRANCH__/${DEFAULT_BRANCH}/g; s/__TENANT_NAMESPACE__/${TENANT_NAMESPACE}/g; s/__SERVICE_ACCOUNT__/${SERVICE_ACCOUNT}/g" ${HERE}/agentic-sdlc-check-pull-request.yaml.tmpl > "${AGENTIC_CHECK}" fi # Check for pipeline files in .tekton directory and centralize them