From 58b99952831509f43b84c95630187a069c54978a Mon Sep 17 00:00:00 2001 From: Jonathan Boniface Date: Thu, 1 Oct 2026 13:47:48 +0100 Subject: [PATCH] Let the orchestrator create the Argo CD Application and hub route for the lab score-lab.yaml names the team and repository; the lab deploy workflow targets an environment of type lab, where the catalog resolves the workload to an Application and the ingress to the hub route. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/deploy-labs.yaml | 54 ++++++------------------ deploy/lab/deployment-demo-vivek-11.yaml | 2 + score-lab.yaml | 5 +++ 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/.gitea/workflows/deploy-labs.yaml b/.gitea/workflows/deploy-labs.yaml index 500304d..7778c1d 100644 --- a/.gitea/workflows/deploy-labs.yaml +++ b/.gitea/workflows/deploy-labs.yaml @@ -1,18 +1,9 @@ name: Deploy to Orchestrator (lab) -# Dispatch only until the lab path is proven. deploy.yml already deploys on every build. +# Creates or updates the Argo CD Application and the hub route for the lab, from score-lab.yaml. +# Run after "Build and Push to ACR (lab)", which renders deploy/lab. Dispatch only. on: - workflow_dispatch: - inputs: - environment: - description: 'Target environment' - required: true - default: 'dev' - type: choice - options: - - dev - - staging - - prod + workflow_dispatch: {} env: PO_API_URL: https://api.dev.orchestrator.crucible.kyndemo.live @@ -31,6 +22,10 @@ env: # the workflow below builds the whole thing on first deploy and needs no repository change. # Its own project, NOT demo-vivek-11. Sharing it would reuse deploy.yml's runner rule (the dev # apps runner) and overwrite the dev workload with this file. + # + # Bound to the lab HUB's runner: what the orchestrator creates here is the Argo CD Application + # and the public route, and both live on the hub. Argo CD delivers the workload to the spoke + # from deploy/lab. PROJECT_ID: demo-vivek-11-lab # The runner a project's workloads execute on. This is NOT cosmetic: the Kubernetes and # Helm providers are ambient, so a workload lands in whichever cluster its runner lives in, @@ -78,27 +73,11 @@ jobs: install -m 755 /tmp/octl /usr/local/bin/octl octl --version - - name: Derive environment + - name: Set environment run: | - # The environment is now a STAGE of this application -- dev, staging, prod -- because - # the project is the application. It used to be the component id, which was the only - # option while every app shared one project and had to be distinguishable inside it. - DISPATCH_ENV="${{ github.event.inputs.environment }}" - if [ -n "$DISPATCH_ENV" ]; then - ENV_ID="$DISPATCH_ENV" - else - # On a workflow_run the branch is the triggering run's, not this job's checkout. - BRANCH="${{ github.event.workflow_run.head_branch }}" - BRANCH="${BRANCH:-${GITHUB_REF_NAME}}" - case "$BRANCH" in - staging) ENV_ID=staging ;; - prod|main|master) ENV_ID=prod ;; - *) ENV_ID=dev ;; - esac - echo "Branch '$BRANCH' maps to environment '$ENV_ID'" - fi - echo "ENV_ID=$ENV_ID" >> $GITHUB_ENV - echo "Deploying $PROJECT_ID to environment: $ENV_ID" + # One environment, of type `lab`. The type is what selects the Argo CD implementations: + # the workload becomes an Application and workload-ingress becomes the hub route. + echo "ENV_ID=lab" >> $GITHUB_ENV - name: Ensure the project and its runner binding exist run: | @@ -127,16 +106,9 @@ jobs: - name: Ensure the environment exists run: | set -euo pipefail - # Project and environment ids are POSITIONAL; only env_type_id and display_name go - # through --set. `dev` and `stable` are the only environment TYPES that exist, so - # staging rides on the dev type -- the type governs policy, the id governs identity. - case "$ENV_ID" in - prod) ENV_TYPE=stable ;; - *) ENV_TYPE=dev ;; - esac octl create environment "$PROJECT_ID" "$ENV_ID" \ - --set env_type_id="$ENV_TYPE" \ - --set display_name="$ENV_ID" || \ + --set env_type_id=lab \ + --set display_name="Lab" || \ octl get environment "$PROJECT_ID" "$ENV_ID" - name: Deploy the Score workload diff --git a/deploy/lab/deployment-demo-vivek-11.yaml b/deploy/lab/deployment-demo-vivek-11.yaml index 0069b8a..2331695 100644 --- a/deploy/lab/deployment-demo-vivek-11.yaml +++ b/deploy/lab/deployment-demo-vivek-11.yaml @@ -18,6 +18,8 @@ spec: template: metadata: annotations: + crucible.kyndryl.com/repo-url: https://gitea.kyndemo.live/validate/demo-vivek-11.git + crucible.kyndryl.com/team: demo k8s.score.dev/workload-name: demo-vivek-11 labels: app.kubernetes.io/instance: demo-vivek-11 diff --git a/score-lab.yaml b/score-lab.yaml index 92bd595..ed9d5b8 100644 --- a/score-lab.yaml +++ b/score-lab.yaml @@ -3,6 +3,11 @@ metadata: name: demo-vivek-11 labels: app: demo-vivek-11 + # Read by the orchestrator to create the Argo CD Application: which team owns it, and the + # repository whose deploy/lab folder holds the rendered manifests. + annotations: + crucible.kyndryl.com/team: demo + crucible.kyndryl.com/repo-url: https://gitea.kyndemo.live/validate/demo-vivek-11.git containers: main: