fix: build static apps on local workspace
This commit is contained in:
parent
4281e63750
commit
7d1cf8ae6d
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue