From 992d9ae7ff6b1f2723fe7a29fe90dde46935d99a Mon Sep 17 00:00:00 2001 From: Seth Nickell Date: Sun, 22 Mar 2026 21:12:48 -1000 Subject: [PATCH] Render CodeAI from Kargo stage branches --- apps/codeai/README.md | 8 +- apps/codeai/applicationset.yaml | 19 ++-- .../deployments/levelbuilder/deployment.yaml | 3 + .../levelbuilder/deployment.yaml.disabled | 5 - .../deployments/production/deployment.yaml | 3 + .../production/deployment.yaml.disabled | 5 - .../deployments/staging/deployment.yaml | 2 +- apps/codeai/deployments/test/deployment.yaml | 4 +- .../levelbuilder/deployment.patch.yaml | 1 - .../envTypes/levelbuilder/kustomization.yaml | 5 +- .../envTypes/production/kustomization.yaml | 5 +- .../envTypes/staging/deployment.patch.yaml | 1 - .../envTypes/staging/kustomization.yaml | 5 +- apps/codeai/envTypes/test/kustomization.yaml | 5 +- .../kargo/templates/deploy/kustomization.yaml | 6 ++ ...deai-service-health-analysis-template.yaml | 27 +++++ apps/kargo-project-codeai/project-config.yaml | 8 +- .../stages/levelbuilder.yaml | 77 ++++++++++++--- .../stages/production.yaml | 31 ++---- .../stages/review-infra-changes.yaml | 99 +++++++++++++++++++ apps/kargo-project-codeai/stages/staging.yaml | 75 +++++++++++--- apps/kargo-project-codeai/stages/test.yaml | 85 +++++++++++++--- apps/kargo-project-codeai/warehouse.yaml | 17 +++- 23 files changed, 384 insertions(+), 112 deletions(-) create mode 100644 apps/codeai/deployments/levelbuilder/deployment.yaml delete mode 100644 apps/codeai/deployments/levelbuilder/deployment.yaml.disabled create mode 100644 apps/codeai/deployments/production/deployment.yaml delete mode 100644 apps/codeai/deployments/production/deployment.yaml.disabled create mode 100644 apps/codeai/kargo/templates/deploy/kustomization.yaml create mode 100644 apps/kargo-project-codeai/codeai-service-health-analysis-template.yaml create mode 100644 apps/kargo-project-codeai/stages/review-infra-changes.yaml diff --git a/apps/codeai/README.md b/apps/codeai/README.md index 594080a..0b82f8a 100644 --- a/apps/codeai/README.md +++ b/apps/codeai/README.md @@ -1,3 +1,7 @@ -This app's deployment definitions live under `deployments/`. +This app's deployment metadata lives under `deployments/` on `main`. -Docker image tag writeback is done by the GitHub Actions workflow [`k8s-commit-image-ref-to-argocd.yml`](https://github.com/code-dot-org/code-dot-org/blob/staging/.github/workflows/k8s-commit-image-ref-to-argocd.yml). +Rendered manifests are generated by Kargo onto long-lived `stage/` +branches and deployed by Argo CD from `apps/codeai/deployments//deploy`. + +The checked-in `values.yaml` files are legacy context from the old Helm flow and +are no longer part of the active rendered-branch promotion path. diff --git a/apps/codeai/applicationset.yaml b/apps/codeai/applicationset.yaml index e367ef9..d1f0950 100644 --- a/apps/codeai/applicationset.yaml +++ b/apps/codeai/applicationset.yaml @@ -9,27 +9,24 @@ spec: repoURL: https://github.com/code-dot-org/k8s-gitops.git revision: main files: - - path: apps/codeai/deployments/*/deployment.yaml + - path: apps/codeai/deployments/staging/deployment.yaml + - path: apps/codeai/deployments/test/deployment.yaml + - path: apps/codeai/deployments/levelbuilder/deployment.yaml + - path: apps/codeai/deployments/production/deployment.yaml template: metadata: name: codeai-{{path.basename}} labels: app.kubernetes.io/managed-by: kargo kargo.akuity.io/project: kargo-project-codeai + annotations: + kargo.akuity.io/authorized-stage: kargo-project-codeai:{{path.basename}} spec: project: default sources: - - repoURL: https://github.com/code-dot-org/code-dot-org.git - targetRevision: '{{sourceRevision}}' - path: k8s/helm - helm: - releaseName: '{{path.basename}}' - valueFiles: - - $values/apps/codeai/envTypes/{{envType}}.values.yaml - - $values/apps/codeai/deployments/{{path.basename}}/values.yaml - repoURL: https://github.com/code-dot-org/k8s-gitops.git - targetRevision: main - ref: values + targetRevision: '{{branch}}' + path: apps/codeai/deployments/{{path.basename}}/deploy destination: server: https://kubernetes.default.svc namespace: '{{namespace}}' diff --git a/apps/codeai/deployments/levelbuilder/deployment.yaml b/apps/codeai/deployments/levelbuilder/deployment.yaml new file mode 100644 index 0000000..7e17090 --- /dev/null +++ b/apps/codeai/deployments/levelbuilder/deployment.yaml @@ -0,0 +1,3 @@ +envType: levelbuilder +namespace: levelbuilder +branch: stage/levelbuilder diff --git a/apps/codeai/deployments/levelbuilder/deployment.yaml.disabled b/apps/codeai/deployments/levelbuilder/deployment.yaml.disabled deleted file mode 100644 index 4d89839..0000000 --- a/apps/codeai/deployments/levelbuilder/deployment.yaml.disabled +++ /dev/null @@ -1,5 +0,0 @@ -envType: levelbuilder -namespace: levelbuilder -# FIXME: for quicker testing, avoid waiting on DTTs and DTPs, let alone DTLs. -# branch: levelbuilder -branch: staging diff --git a/apps/codeai/deployments/production/deployment.yaml b/apps/codeai/deployments/production/deployment.yaml new file mode 100644 index 0000000..de2d22b --- /dev/null +++ b/apps/codeai/deployments/production/deployment.yaml @@ -0,0 +1,3 @@ +envType: production +namespace: production +branch: stage/production diff --git a/apps/codeai/deployments/production/deployment.yaml.disabled b/apps/codeai/deployments/production/deployment.yaml.disabled deleted file mode 100644 index 37cafd5..0000000 --- a/apps/codeai/deployments/production/deployment.yaml.disabled +++ /dev/null @@ -1,5 +0,0 @@ -envType: production -namespace: production -# FIXME: for quicker testing, avoid waiting on DTTs and DTPs, let alone DTLs. -# branch: production -branch: staging diff --git a/apps/codeai/deployments/staging/deployment.yaml b/apps/codeai/deployments/staging/deployment.yaml index 30b6df2..5092bb2 100644 --- a/apps/codeai/deployments/staging/deployment.yaml +++ b/apps/codeai/deployments/staging/deployment.yaml @@ -1,3 +1,3 @@ envType: staging namespace: staging -branch: staging +branch: stage/staging diff --git a/apps/codeai/deployments/test/deployment.yaml b/apps/codeai/deployments/test/deployment.yaml index 2539d0c..b91b74f 100644 --- a/apps/codeai/deployments/test/deployment.yaml +++ b/apps/codeai/deployments/test/deployment.yaml @@ -1,5 +1,3 @@ envType: test namespace: test -# FIXME: for quicker testing, avoid waiting on DTTs and DTPs, let alone DTLs. -# branch: test -branch: staging +branch: stage/test diff --git a/apps/codeai/envTypes/levelbuilder/deployment.patch.yaml b/apps/codeai/envTypes/levelbuilder/deployment.patch.yaml index f4ddeb8..4039121 100644 --- a/apps/codeai/envTypes/levelbuilder/deployment.patch.yaml +++ b/apps/codeai/envTypes/levelbuilder/deployment.patch.yaml @@ -7,7 +7,6 @@ spec: spec: containers: - name: dashboard - image: ghcr.io/code-dot-org/code-dot-org:replace-me env: - name: RAILS_ENV value: levelbuilder diff --git a/apps/codeai/envTypes/levelbuilder/kustomization.yaml b/apps/codeai/envTypes/levelbuilder/kustomization.yaml index 1aeb2d5..26e1b95 100644 --- a/apps/codeai/envTypes/levelbuilder/kustomization.yaml +++ b/apps/codeai/envTypes/levelbuilder/kustomization.yaml @@ -9,6 +9,5 @@ labels: includeTemplates: true patches: - path: deployment.patch.yaml - # TODO: enable these when gitops envType values start setting dashboard_workers again. - # - path: locals.yml.patch.yaml - # - path: deployment.resources.patch.yaml + - path: locals.yml.patch.yaml + - path: deployment.resources.patch.yaml diff --git a/apps/codeai/envTypes/production/kustomization.yaml b/apps/codeai/envTypes/production/kustomization.yaml index 9c0a60c..db2a906 100644 --- a/apps/codeai/envTypes/production/kustomization.yaml +++ b/apps/codeai/envTypes/production/kustomization.yaml @@ -11,6 +11,5 @@ labels: includeTemplates: true patches: - path: deployment.patch.yaml - # TODO: enable these when gitops envType values start setting dashboard_workers again. - # - path: locals.yml.patch.yaml - # - path: deployment.resources.patch.yaml + - path: locals.yml.patch.yaml + - path: deployment.resources.patch.yaml diff --git a/apps/codeai/envTypes/staging/deployment.patch.yaml b/apps/codeai/envTypes/staging/deployment.patch.yaml index 47a3a9b..84baadc 100644 --- a/apps/codeai/envTypes/staging/deployment.patch.yaml +++ b/apps/codeai/envTypes/staging/deployment.patch.yaml @@ -7,7 +7,6 @@ spec: spec: containers: - name: dashboard - image: ghcr.io/code-dot-org/code-dot-org:replace-me env: - name: RAILS_ENV value: staging diff --git a/apps/codeai/envTypes/staging/kustomization.yaml b/apps/codeai/envTypes/staging/kustomization.yaml index dd52134..5f1512c 100644 --- a/apps/codeai/envTypes/staging/kustomization.yaml +++ b/apps/codeai/envTypes/staging/kustomization.yaml @@ -9,6 +9,5 @@ labels: includeTemplates: true patches: - path: deployment.patch.yaml - # TODO: enable these when gitops envType values start setting dashboard_workers again. - # - path: locals.yml.patch.yaml - # - path: deployment.resources.patch.yaml + - path: locals.yml.patch.yaml + - path: deployment.resources.patch.yaml diff --git a/apps/codeai/envTypes/test/kustomization.yaml b/apps/codeai/envTypes/test/kustomization.yaml index 1f434ef..6ce2910 100644 --- a/apps/codeai/envTypes/test/kustomization.yaml +++ b/apps/codeai/envTypes/test/kustomization.yaml @@ -9,6 +9,5 @@ labels: includeTemplates: true patches: - path: deployment.patch.yaml - # TODO: enable these when gitops envType values start setting dashboard_workers again. - # - path: locals.yml.patch.yaml - # - path: deployment.resources.patch.yaml + - path: locals.yml.patch.yaml + - path: deployment.resources.patch.yaml diff --git a/apps/codeai/kargo/templates/deploy/kustomization.yaml b/apps/codeai/kargo/templates/deploy/kustomization.yaml new file mode 100644 index 0000000..3f52129 --- /dev/null +++ b/apps/codeai/kargo/templates/deploy/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../src/k8s/kustomize/base +components: + - ../envType diff --git a/apps/kargo-project-codeai/codeai-service-health-analysis-template.yaml b/apps/kargo-project-codeai/codeai-service-health-analysis-template.yaml new file mode 100644 index 0000000..5742d3b --- /dev/null +++ b/apps/kargo-project-codeai/codeai-service-health-analysis-template.yaml @@ -0,0 +1,27 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AnalysisTemplate +metadata: + name: codeai-service-health + namespace: kargo-project-codeai +spec: + args: + - name: namespace + - name: serviceName + metrics: + - name: service-health + provider: + job: + spec: + backoffLimit: 0 + template: + spec: + restartPolicy: Never + containers: + - name: curl + image: curlimages/curl:8.12.1 + command: + - sh + - -ceu + - | + curl --fail --silent --show-error \ + "http://{{args.serviceName}}.{{args.namespace}}.svc.cluster.local:3000/health_check" >/dev/null diff --git a/apps/kargo-project-codeai/project-config.yaml b/apps/kargo-project-codeai/project-config.yaml index a303851..149da5c 100644 --- a/apps/kargo-project-codeai/project-config.yaml +++ b/apps/kargo-project-codeai/project-config.yaml @@ -8,8 +8,10 @@ spec: - stage: staging autoPromotionEnabled: true - stage: test - autoPromotionEnabled: false - - stage: production - autoPromotionEnabled: false + autoPromotionEnabled: true - stage: levelbuilder autoPromotionEnabled: false + - stage: review-infra-changes + autoPromotionEnabled: true + - stage: production + autoPromotionEnabled: true diff --git a/apps/kargo-project-codeai/stages/levelbuilder.yaml b/apps/kargo-project-codeai/stages/levelbuilder.yaml index 305d668..1f39c15 100644 --- a/apps/kargo-project-codeai/stages/levelbuilder.yaml +++ b/apps/kargo-project-codeai/stages/levelbuilder.yaml @@ -4,36 +4,87 @@ metadata: name: levelbuilder namespace: kargo-project-codeai spec: + vars: + - name: gitopsRepo + value: https://github.com/code-dot-org/k8s-gitops.git + - name: sourceRepo + value: https://github.com/code-dot-org/code-dot-org.git + - name: imageRepo + value: ghcr.io/code-dot-org/code-dot-org + - name: deployment + value: levelbuilder + - name: envType + value: levelbuilder + - name: targetBranch + value: stage/levelbuilder + - name: renderPath + value: apps/codeai/deployments/levelbuilder/deploy + - name: sourceCommit + value: ${{ commitFrom(vars.sourceRepo).ID }} requestedFreight: - origin: kind: Warehouse - name: kargo-project-codeai + name: codeai sources: stages: - test + autoPromotionOptions: + selectionPolicy: MatchUpstream promotionTemplate: spec: - vars: - - name: gitopsRepo - value: https://github.com/code-dot-org/k8s-gitops.git steps: - uses: git-clone config: repoURL: ${{ vars.gitopsRepo }} checkout: - branch: main - path: ./gitops - - uses: yaml-update + path: ./meta + - branch: ${{ vars.targetBranch }} + create: true + path: ./out + - uses: git-clone + config: + repoURL: ${{ vars.sourceRepo }} + checkout: + - commit: ${{ vars.sourceCommit }} + path: ./src + sparse: + - k8s/kustomize + - uses: git-clear + config: + path: ./out + - uses: copy + config: + inPath: ./meta/apps/codeai/kargo/templates/deploy + outPath: ./render/deploy + - uses: copy config: - path: ./gitops/apps/codeai/deployments/levelbuilder/values.yaml - updates: - - key: image - value: ghcr.io/code-dot-org/code-dot-org:${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} + inPath: ./meta/apps/codeai/envTypes/${{ vars.envType }} + outPath: ./render/envType + - uses: copy + config: + inPath: ./meta/apps/codeai/envTypes/components + outPath: ./render/components + - uses: kustomize-set-image + config: + path: ./render/deploy + images: + - image: code-dot-org + newName: ${{ vars.imageRepo }} + tag: ${{ imageFrom(vars.imageRepo).Tag }} + - uses: kustomize-build + config: + path: ./render/deploy + outPath: ./out/${{ vars.renderPath }} - uses: git-commit config: - path: ./gitops + path: ./out message: | - Promote levelbuilder to ${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} [skip ci] + Render ${{ vars.deployment }} for ${{ vars.sourceCommit }} / ${{ imageFrom(vars.imageRepo).Tag }} - uses: git-push config: - path: ./gitops + path: ./out + - uses: argocd-update + config: + apps: + - name: codeai-levelbuilder diff --git a/apps/kargo-project-codeai/stages/production.yaml b/apps/kargo-project-codeai/stages/production.yaml index eac25f5..720ca81 100644 --- a/apps/kargo-project-codeai/stages/production.yaml +++ b/apps/kargo-project-codeai/stages/production.yaml @@ -7,33 +7,16 @@ spec: requestedFreight: - origin: kind: Warehouse - name: kargo-project-codeai + name: codeai sources: stages: - - test + - review-infra-changes + autoPromotionOptions: + selectionPolicy: MatchUpstream promotionTemplate: spec: - vars: - - name: gitopsRepo - value: https://github.com/code-dot-org/k8s-gitops.git steps: - - uses: git-clone + - uses: argocd-update config: - repoURL: ${{ vars.gitopsRepo }} - checkout: - - branch: main - path: ./gitops - - uses: yaml-update - config: - path: ./gitops/apps/codeai/deployments/production/values.yaml - updates: - - key: image - value: ghcr.io/code-dot-org/code-dot-org:${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} - - uses: git-commit - config: - path: ./gitops - message: | - Promote production to ${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} [skip ci] - - uses: git-push - config: - path: ./gitops + apps: + - name: codeai-production diff --git a/apps/kargo-project-codeai/stages/review-infra-changes.yaml b/apps/kargo-project-codeai/stages/review-infra-changes.yaml new file mode 100644 index 0000000..498045b --- /dev/null +++ b/apps/kargo-project-codeai/stages/review-infra-changes.yaml @@ -0,0 +1,99 @@ +apiVersion: kargo.akuity.io/v1alpha1 +kind: Stage +metadata: + name: review-infra-changes + namespace: kargo-project-codeai +spec: + vars: + - name: gitopsRepo + value: https://github.com/code-dot-org/k8s-gitops.git + - name: sourceRepo + value: https://github.com/code-dot-org/code-dot-org.git + - name: imageRepo + value: ghcr.io/code-dot-org/code-dot-org + - name: deployment + value: production + - name: envType + value: production + - name: targetBranch + value: stage/production + - name: renderPath + value: apps/codeai/deployments/production/deploy + - name: sourceCommit + value: ${{ commitFrom(vars.sourceRepo).ID }} + requestedFreight: + - origin: + kind: Warehouse + name: codeai + sources: + stages: + - test + autoPromotionOptions: + selectionPolicy: MatchUpstream + promotionTemplate: + spec: + steps: + - uses: git-clone + config: + repoURL: ${{ vars.gitopsRepo }} + checkout: + - branch: main + path: ./meta + - branch: ${{ vars.targetBranch }} + create: true + path: ./out + - uses: git-clone + config: + repoURL: ${{ vars.sourceRepo }} + checkout: + - commit: ${{ vars.sourceCommit }} + path: ./src + sparse: + - k8s/kustomize + - uses: git-clear + config: + path: ./out + - uses: copy + config: + inPath: ./meta/apps/codeai/kargo/templates/deploy + outPath: ./render/deploy + - uses: copy + config: + inPath: ./meta/apps/codeai/envTypes/${{ vars.envType }} + outPath: ./render/envType + - uses: copy + config: + inPath: ./meta/apps/codeai/envTypes/components + outPath: ./render/components + - uses: kustomize-set-image + config: + path: ./render/deploy + images: + - image: code-dot-org + newName: ${{ vars.imageRepo }} + tag: ${{ imageFrom(vars.imageRepo).Tag }} + - uses: kustomize-build + config: + path: ./render/deploy + outPath: ./out/${{ vars.renderPath }} + - uses: git-commit + config: + path: ./out + message: | + Review ${{ vars.deployment }} render for ${{ vars.sourceCommit }} / ${{ imageFrom(vars.imageRepo).Tag }} + - uses: git-push + as: push + config: + path: ./out + generateTargetBranch: true + - uses: git-open-pr + as: open-pr + config: + repoURL: ${{ vars.gitopsRepo }} + sourceBranch: ${{ outputs.push.branch }} + targetBranch: ${{ vars.targetBranch }} + title: Review ${{ vars.deployment }} render + - uses: git-wait-for-pr + config: + repoURL: ${{ vars.gitopsRepo }} + prNumber: ${{ outputs['open-pr'].pr.id }} diff --git a/apps/kargo-project-codeai/stages/staging.yaml b/apps/kargo-project-codeai/stages/staging.yaml index c986f62..c55c764 100644 --- a/apps/kargo-project-codeai/stages/staging.yaml +++ b/apps/kargo-project-codeai/stages/staging.yaml @@ -4,35 +4,84 @@ metadata: name: staging namespace: kargo-project-codeai spec: + vars: + - name: gitopsRepo + value: https://github.com/code-dot-org/k8s-gitops.git + - name: sourceRepo + value: https://github.com/code-dot-org/code-dot-org.git + - name: imageRepo + value: ghcr.io/code-dot-org/code-dot-org + - name: deployment + value: staging + - name: envType + value: staging + - name: targetBranch + value: stage/staging + - name: renderPath + value: apps/codeai/deployments/staging/deploy + - name: sourceCommit + value: ${{ commitFrom(vars.sourceRepo).ID }} requestedFreight: - origin: kind: Warehouse - name: kargo-project-codeai + name: codeai sources: direct: true promotionTemplate: spec: - vars: - - name: gitopsRepo - value: https://github.com/code-dot-org/k8s-gitops.git steps: - uses: git-clone config: repoURL: ${{ vars.gitopsRepo }} checkout: - branch: main - path: ./gitops - - uses: yaml-update + path: ./meta + - branch: ${{ vars.targetBranch }} + create: true + path: ./out + - uses: git-clone + config: + repoURL: ${{ vars.sourceRepo }} + checkout: + - commit: ${{ vars.sourceCommit }} + path: ./src + sparse: + - k8s/kustomize + - uses: git-clear + config: + path: ./out + - uses: copy + config: + inPath: ./meta/apps/codeai/kargo/templates/deploy + outPath: ./render/deploy + - uses: copy config: - path: ./gitops/apps/codeai/deployments/staging/values.yaml - updates: - - key: image - value: ghcr.io/code-dot-org/code-dot-org:${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} + inPath: ./meta/apps/codeai/envTypes/${{ vars.envType }} + outPath: ./render/envType + - uses: copy + config: + inPath: ./meta/apps/codeai/envTypes/components + outPath: ./render/components + - uses: kustomize-set-image + config: + path: ./render/deploy + images: + - image: code-dot-org + newName: ${{ vars.imageRepo }} + tag: ${{ imageFrom(vars.imageRepo).Tag }} + - uses: kustomize-build + config: + path: ./render/deploy + outPath: ./out/${{ vars.renderPath }} - uses: git-commit config: - path: ./gitops + path: ./out message: | - Promote staging to ${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} [skip ci] + Render ${{ vars.deployment }} for ${{ vars.sourceCommit }} / ${{ imageFrom(vars.imageRepo).Tag }} - uses: git-push config: - path: ./gitops + path: ./out + - uses: argocd-update + config: + apps: + - name: codeai-staging diff --git a/apps/kargo-project-codeai/stages/test.yaml b/apps/kargo-project-codeai/stages/test.yaml index c029450..46006ae 100644 --- a/apps/kargo-project-codeai/stages/test.yaml +++ b/apps/kargo-project-codeai/stages/test.yaml @@ -4,36 +4,95 @@ metadata: name: test namespace: kargo-project-codeai spec: + vars: + - name: gitopsRepo + value: https://github.com/code-dot-org/k8s-gitops.git + - name: sourceRepo + value: https://github.com/code-dot-org/code-dot-org.git + - name: imageRepo + value: ghcr.io/code-dot-org/code-dot-org + - name: deployment + value: test + - name: envType + value: test + - name: targetBranch + value: stage/test + - name: renderPath + value: apps/codeai/deployments/test/deploy + - name: sourceCommit + value: ${{ commitFrom(vars.sourceRepo).ID }} requestedFreight: - origin: kind: Warehouse - name: kargo-project-codeai + name: codeai sources: stages: - staging + autoPromotionOptions: + selectionPolicy: MatchUpstream promotionTemplate: spec: - vars: - - name: gitopsRepo - value: https://github.com/code-dot-org/k8s-gitops.git steps: - uses: git-clone config: repoURL: ${{ vars.gitopsRepo }} checkout: - branch: main - path: ./gitops - - uses: yaml-update + path: ./meta + - branch: ${{ vars.targetBranch }} + create: true + path: ./out + - uses: git-clone + config: + repoURL: ${{ vars.sourceRepo }} + checkout: + - commit: ${{ vars.sourceCommit }} + path: ./src + sparse: + - k8s/kustomize + - uses: git-clear + config: + path: ./out + - uses: copy + config: + inPath: ./meta/apps/codeai/kargo/templates/deploy + outPath: ./render/deploy + - uses: copy config: - path: ./gitops/apps/codeai/deployments/test/values.yaml - updates: - - key: image - value: ghcr.io/code-dot-org/code-dot-org:${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} + inPath: ./meta/apps/codeai/envTypes/${{ vars.envType }} + outPath: ./render/envType + - uses: copy + config: + inPath: ./meta/apps/codeai/envTypes/components + outPath: ./render/components + - uses: kustomize-set-image + config: + path: ./render/deploy + images: + - image: code-dot-org + newName: ${{ vars.imageRepo }} + tag: ${{ imageFrom(vars.imageRepo).Tag }} + - uses: kustomize-build + config: + path: ./render/deploy + outPath: ./out/${{ vars.renderPath }} - uses: git-commit config: - path: ./gitops + path: ./out message: | - Promote test to ${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} [skip ci] + Render ${{ vars.deployment }} for ${{ vars.sourceCommit }} / ${{ imageFrom(vars.imageRepo).Tag }} - uses: git-push config: - path: ./gitops + path: ./out + - uses: argocd-update + config: + apps: + - name: codeai-test + verification: + analysisTemplates: + - name: codeai-service-health + args: + - name: namespace + value: test + - name: serviceName + value: test-cdo-dashboard diff --git a/apps/kargo-project-codeai/warehouse.yaml b/apps/kargo-project-codeai/warehouse.yaml index ff9ebe0..f051cd8 100644 --- a/apps/kargo-project-codeai/warehouse.yaml +++ b/apps/kargo-project-codeai/warehouse.yaml @@ -1,13 +1,20 @@ apiVersion: kargo.akuity.io/v1alpha1 kind: Warehouse metadata: - name: kargo-project-codeai + name: codeai namespace: kargo-project-codeai spec: + freightCreationPolicy: Automatic subscriptions: - image: repoURL: ghcr.io/code-dot-org/code-dot-org - ignoreTagsRegexes: - # Ignore single-platform images when we have a multiplatform option - - '.*-amd64$' - - '.*-arm64$' + allowTagsRegexes: + - ^git-[0-9a-f]{40}$ + - git: + repoURL: https://github.com/code-dot-org/code-dot-org.git + branch: staging + commitSelectionStrategy: NewestFromBranch + freightCreationCriteria: + expression: | + imageFrom('ghcr.io/code-dot-org/code-dot-org').Tag == + 'git-' + commitFrom('https://github.com/code-dot-org/code-dot-org.git').ID