Merge pull request 'fix: build static apps on local workspace' (#42) from fix/local-static-build-workspace into fix/openbao-mutation-timeouts
Reviewed-on: #42
This commit is contained in:
commit
ded0fc7ae9
|
|
@ -357,57 +357,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
|
||||
|
|
@ -439,7 +413,7 @@ spec:
|
|||
- name: app-revision
|
||||
value: $(params.git-revision)
|
||||
- name: update-staging
|
||||
runAfter: [push]
|
||||
runAfter: [build-layer]
|
||||
when:
|
||||
- input: $(params.event-type)
|
||||
operator: in
|
||||
|
|
@ -465,7 +439,7 @@ spec:
|
|||
- name: environment
|
||||
value: staging
|
||||
- name: promote-production
|
||||
runAfter: [push]
|
||||
runAfter: [build-layer]
|
||||
when:
|
||||
- input: $(params.event-type)
|
||||
operator: in
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ func renderAppDelivery(cfg config.Config) ([]byte, error) {
|
|||
if err := tmpl.Execute(&rendered, values); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rendered.Bytes(), nil
|
||||
return bytes.ReplaceAll(rendered.Bytes(), []byte("\r\n"), []byte("\n")), nil
|
||||
}
|
||||
|
||||
func deliveryRepository(baseURL, repositoryURL string) (string, error) {
|
||||
|
|
|
|||
|
|
@ -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