From 7d1cf8ae6dabaed9e1930226dce0cee1b97e87f8 Mon Sep 17 00:00:00 2001 From: eding Date: Sat, 12 Sep 2026 22:30:31 +0200 Subject: [PATCH] fix: build static apps on local workspace --- .../templates/delivery-pipeline.yaml.tmpl | 46 ++++--------------- internal/bootstrap/bootstrap_test.go | 10 ++-- 2 files changed, 16 insertions(+), 40 deletions(-) diff --git a/internal/assets/templates/delivery-pipeline.yaml.tmpl b/internal/assets/templates/delivery-pipeline.yaml.tmpl index 9e23fca..403edf9 100644 --- a/internal/assets/templates/delivery-pipeline.yaml.tmpl +++ b/internal/assets/templates/delivery-pipeline.yaml.tmpl @@ -629,57 +629,31 @@ spec: - name: manifests-repo default: {{ quote .ManifestsRepo }} workspaces: - - name: source + - name: artifact tasks: - - name: clone + - name: build-layer when: - input: $(params.event-action) operator: notin values: [closed] taskRef: - name: maidn-git-clone + name: maidn-node-static-image params: - name: url value: {{ quote .AppRepoURL }} - name: revision value: $(params.git-revision) - workspaces: - - name: source - workspace: source - - name: build-layer - runAfter: [clone] - when: - - input: $(params.event-action) - operator: notin - values: [closed] - taskRef: - name: maidn-node-static-build - params: + - name: image + value: $(params.image) - name: output-directory value: {{ quote .BuildOutputDirectory }} - name: build-configuration value: {{ quote .BuildConfiguration }} workspaces: - - name: source - workspace: source - - name: push - runAfter: [build-layer] - when: - - input: $(params.event-action) - operator: notin - values: [closed] - taskRef: - name: maidn-node-static-push - params: - - name: image - value: $(params.image) - - name: revision - value: $(params.git-revision) - workspaces: - - name: source - workspace: source + - name: artifact + workspace: artifact - name: update-preview - runAfter: [push] + runAfter: [build-layer] when: - input: $(params.event-type) operator: in @@ -711,7 +685,7 @@ spec: - name: app-revision value: $(params.git-revision) - name: update-staging - runAfter: [push] + runAfter: [build-layer] when: - input: $(params.event-type) operator: in @@ -779,7 +753,7 @@ spec: - name: tag value: $(params.git-revision) - name: promote-production - runAfter: [push] + runAfter: [build-layer] when: - input: $(params.event-type) operator: in diff --git a/internal/bootstrap/bootstrap_test.go b/internal/bootstrap/bootstrap_test.go index 24a8696..79bc66d 100644 --- a/internal/bootstrap/bootstrap_test.go +++ b/internal/bootstrap/bootstrap_test.go @@ -108,7 +108,7 @@ func TestRemoveDuplicateAppDeliverySource(t *testing.T) { } } -func TestGeneratedDeliveryIsGenericAndUsesSafePreviewCleanupContract(t *testing.T) { +func TestGeneratedDeliveryUsesCombinedStaticBuildArtifactContract(t *testing.T) { cfg := config.Config{ Git: config.GitConfig{BaseURL: "https://git.example.test", Owner: "platform"}, Flux: config.FluxConfig{Branch: "main", ManifestsRepo: "manifests"}, @@ -118,13 +118,15 @@ func TestGeneratedDeliveryIsGenericAndUsesSafePreviewCleanupContract(t *testing. if err != nil { t.Fatal(err) } - for _, expected := range []string{"maidn-git-clone", "maidn-node-static-build", "maidn-node-static-push", "runAfter: [clone]", "runAfter: [build-layer]", "maidn-preview-orphan-reconciler", "valid_pr_number()", "valid_commit()", "values: [promotion]", "values: [\"production\"]", "cmp -s \"$expected_marker\" \"$marker\"", "values: [closed]"} { + for _, expected := range []string{"name: build-layer", "maidn-node-static-image", "name: url\n value: \"https://git.example.test/apps/web-ui.git\"", "name: revision\n value: $(params.git-revision)", "name: image\n value: $(params.image)", "name: artifact\n workspace: artifact", "runAfter: [build-layer]", "maidn-preview-orphan-reconciler", "valid_pr_number()", "valid_commit()", "values: [promotion]", "values: [\"production\"]", "cmp -s \"$expected_marker\" \"$marker\"", "values: [closed]"} { if !strings.Contains(string(content), expected) { t.Fatalf("generated delivery does not contain %q", expected) } } - if strings.Contains(string(content), "easycsr") || strings.Contains(string(content), "test-org") || strings.Contains(string(content), "git rm -r") { - t.Fatal("generated delivery contains a non-generic or unsafe literal") + for _, unexpected := range []string{"maidn-git-clone", "maidn-node-static-build", "maidn-node-static-push", "runAfter: [clone]", "name: source", "workspace: source", "easycsr", "test-org", "git rm -r"} { + if strings.Contains(string(content), unexpected) { + t.Fatalf("generated delivery contains unexpected %q", unexpected) + } } }