From fd1a88b1b34f395d3ba443b9b3800b6428612ac1 Mon Sep 17 00:00:00 2001 From: eding Date: Wed, 16 Sep 2026 19:21:04 +0200 Subject: [PATCH] feat: render central app delivery resources --- cmd/fresh.go | 4 +- docs/operations.md | 21 +-- .../templates/delivery-pipeline.yaml.tmpl | 36 +++-- internal/bootstrap/bootstrap.go | 59 +------ internal/bootstrap/bootstrap_test.go | 23 +-- internal/bootstrap/onboard.go | 150 +++--------------- internal/bootstrap/onboard_test.go | 104 +----------- internal/forgejo/repo.go | 71 --------- 8 files changed, 82 insertions(+), 386 deletions(-) diff --git a/cmd/fresh.go b/cmd/fresh.go index 04ef9f0..ca261d9 100644 --- a/cmd/fresh.go +++ b/cmd/fresh.go @@ -32,7 +32,7 @@ var appCmd = &cobra.Command{ var appOnboardCmd = &cobra.Command{ Use: "onboard", - Short: "Validate an application checkout and add its source-owned delivery contract.", + Short: "Validate an application checkout and add its centrally-owned delivery contract.", RunE: runAppOnboard, } @@ -50,7 +50,7 @@ func init() { rootCmd.AddCommand(appCmd) appCmd.AddCommand(appOnboardCmd) appOnboardCmd.Flags().StringVar(&onboardConfigPath, "config", "", "Path to private bootstrap config YAML") - appOnboardCmd.Flags().StringVar(&onboardFrom, "from", "", "Clean application checkout to scaffold") + appOnboardCmd.Flags().StringVar(&onboardFrom, "from", "", "Clean application checkout to validate") appOnboardCmd.Flags().StringVar(&onboardAppName, "app-name", "", "Application name override") appOnboardCmd.Flags().StringVar(&onboardAppRepoURL, "app-repo-url", "", "Application repository URL override") appOnboardCmd.Flags().StringVar(&onboardImageRepository, "image-repository", "", "OCI image repository override") diff --git a/docs/operations.md b/docs/operations.md index ef18b36..8938b85 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -43,12 +43,15 @@ creates the Gateway, Tekton, and Tekton Triggers platform resources using go run . bootstrap init --config --organization --create-organization ``` -The source-owned onboarding implementation is being retired. Do not onboard a -new application until the central delivery renderer is available. See -[Delivery Ownership](architecture/delivery-ownership.md) for the approved -architecture and migration rules. +The source-owned onboarding implementation is retired. Central onboarding +creates a reviewed cluster registration only; it never writes `.tekton` or +`.maidn` resources to an application repository. Before merging that +registration, a platform operator must create and protect the corresponding +`maidn/platform-` package through a reviewed platform PR. See [Delivery +Ownership](architecture/delivery-ownership.md) for the approved architecture +and migration rules. -The future onboarding command uses a clean checkout on `delivery.appRepoRef`. +The onboarding command uses a clean checkout on `delivery.appRepoRef`. The app repository URL must be the canonical source owner, such as `Maidn/.git`; `test-org-2` is execution state only. Per-app static build values remain command-line overrides rather than private defaults: @@ -61,10 +64,10 @@ go run . app onboard --config --from ``` For a runtime build, set `--build-strategy runtime`; static-only output options -remain harmless. Central onboarding will create reviewed platform-branch and -cluster-registration changes. The cluster repository will own -`base/tekton/apps/.yaml`; the application repository will remain a build -input only. The generic EventListener dispatches by Forgejo repository name. +remain harmless. Central onboarding creates the reviewed cluster-registration +change after the platform package exists. The cluster repository owns +`base/tekton/apps/.yaml`; the application repository remains a build input +only. The generic EventListener dispatches by Forgejo repository name. Existing source-owned registrations are migrated in separate reviewed cluster repository PRs. Never overwrite an unmanaged registration. diff --git a/internal/assets/templates/delivery-pipeline.yaml.tmpl b/internal/assets/templates/delivery-pipeline.yaml.tmpl index 9b5bf39..97d9137 100644 --- a/internal/assets/templates/delivery-pipeline.yaml.tmpl +++ b/internal/assets/templates/delivery-pipeline.yaml.tmpl @@ -27,9 +27,9 @@ spec: - name: environment - name: pr-number default: "" - - name: app-url + - name: platform-url default: "" - - name: app-revision + - name: platform-revision default: "" - name: forgejo-base-url default: "" @@ -57,10 +57,10 @@ spec: value: $(params.environment) - name: PR_NUMBER value: $(params.pr-number) - - name: APP_URL - value: $(params.app-url) - - name: APP_REVISION - value: $(params.app-revision) + - name: PLATFORM_URL + value: $(params.platform-url) + - name: PLATFORM_REVISION + value: $(params.platform-revision) - name: FORGEJO_BASE_URL value: $(params.forgejo-base-url) - name: FORGEJO_OWNER @@ -102,8 +102,8 @@ spec: cd /tmp/manifests if [ "$ENVIRONMENT" = preview ]; then valid_pr_number "$PR_NUMBER" - valid_url "$APP_URL" - valid_revision "$APP_REVISION" + valid_url "$PLATFORM_URL" + valid_revision "$PLATFORM_REVISION" app_dir="apps/previews/$APP_NAME-pr-$PR_NUMBER" marker="$app_dir/ownership.yaml" if [ -e "$app_dir" ]; then @@ -129,11 +129,11 @@ spec: EOF cmp -s "$expected_marker" "$marker" || fail fi - git clone "$APP_URL" /tmp/app - git -C /tmp/app checkout "$APP_REVISION" - [ -f /tmp/app/preview/values.yaml ] || fail + git clone "$PLATFORM_URL" /tmp/platform + git -C /tmp/platform checkout "$PLATFORM_REVISION" + [ -f /tmp/platform/preview/values.yaml ] || fail mkdir -p "$app_dir" - cp /tmp/app/preview/values.yaml "$app_dir/values.yaml" + cp /tmp/platform/preview/values.yaml "$app_dir/values.yaml" sed -i "s/PLACEHOLDER_PR/$PR_NUMBER/g" "$app_dir/values.yaml" cat > "$marker" <