Skip to content

Commit

Permalink
feat: approval step in publish-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
MDavidson17 committed Sep 7, 2023
1 parent 7084d91 commit fef4cc9
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions workflows/imagery/publish-copy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ spec:
- name: group-size
dag:
tasks:
- name: approval
template: approval
when: "{{=sprig.regexMatch('s3://linz-(elevation|imagery)/', workflow.parameters.target)}}"

- name: create-manifest-github
template: create-manifest
arguments:
parameters:
- name: source
value: "{{inputs.parameters.source}}"
- name: target
value: "{{workflow.parameters.target}}"
value: "{{tasks.approval.outputs.parameters.target}}"
- name: include
value: "{{inputs.parameters.include}}"
- name: exclude
Expand All @@ -68,6 +72,8 @@ spec:
- name: version-argo-tasks
value: "{{workflow.parameters.version-argo-tasks}}"
when: "{{=sprig.regexMatch('s3://linz-(elevation|imagery)/', workflow.parameters.target)}}"
depends: "approval"

- name: create-manifest
template: create-manifest
arguments:
Expand All @@ -86,7 +92,8 @@ spec:
value: "{{inputs.parameters.group-size}}"
- name: version-argo-tasks
value: "{{workflow.parameters.version-argo-tasks}}"
depends: "create-manifest-github.Skipped"
depends: "create-manifest-github.Skipped && approval"

- name: copy-with-github
template: copy
arguments:
Expand All @@ -99,6 +106,7 @@ spec:
value: "{{workflow.parameters.version-argo-tasks}}"
depends: "create-manifest-github.Succeeded"
withParam: "{{tasks.create-manifest-github.outputs.parameters.files}}"

- name: copy
template: copy
arguments:
Expand All @@ -111,17 +119,36 @@ spec:
value: "{{workflow.parameters.version-argo-tasks}}"
depends: "create-manifest"
withParam: "{{tasks.create-manifest.outputs.parameters.files}}"

- name: push-to-github
template: push-to-github
arguments:
parameters:
- name: source
value: "{{inputs.parameters.source}}"
- name: target
value: "{{tasks.approval.outputs.parameters.target}}"
depends: "copy-with-github"
# END

- name: approval
suspend: {}
inputs:
parameters:
- name: target
value: "{{workflow.parameters.target}}"
description: "Confirm the correct target path?"
outputs:
parameters:
- name: target
valueFrom:
supplied: {}

- name: create-manifest
inputs:
parameters:
- name: source
- name: target
- name: include
- name: exclude
- name: group
Expand All @@ -147,7 +174,7 @@ spec:
"--output",
"/tmp/file_list.json",
"--target",
"{{=sprig.trim(workflow.parameters.target)}}",
"{{=sprig.trim(inputs.parameters.target)}}",
"{{=sprig.trim(inputs.parameters.source)}}",
"--transform",
"{{=sprig.trim(workflow.parameters.transform)}}",
Expand All @@ -157,6 +184,7 @@ spec:
- name: files
valueFrom:
path: /tmp/file_list.json

- name: copy
retryStrategy:
limit: "2"
Expand All @@ -179,21 +207,23 @@ spec:
"{{workflow.parameters.copy-option}}",
"{{inputs.parameters.file}}",
]

- name: push-to-github
retryStrategy:
limit: "2"
inputs:
parameters:
- name: source
- name: target
container:
image: "019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/eks:argo-tasks-{{=sprig.trim(workflow.parameters['version-argo-tasks'])}}"
env:
- name: AWS_ROLE_CONFIG_PATH
value: s3://linz-bucket-config/config.json
- name: GIT_AUTHOR_NAME
value: "{{=sprig.regexFind('(elevation|imagery)', workflow.parameters.target)}}[bot]"
value: "{{=sprig.regexFind('(elevation|imagery)', inputs.parameters.target)}}[bot]"
- name: GIT_AUTHOR_EMAIL
value: "{{=sprig.regexFind('(elevation|imagery)', workflow.parameters.target)}}@linz.govt.nz"
value: "{{=sprig.regexFind('(elevation|imagery)', inputs.parameters.target)}}@linz.govt.nz"
volumeMounts:
- name: secret-volume
mountPath: "/root/.ssh/"
Expand All @@ -205,12 +235,12 @@ spec:
"--source",
"{{=sprig.trim(inputs.parameters.source)}}",
"--target",
"{{=sprig.trim(workflow.parameters.target)}}",
"{{=sprig.trim(inputs.parameters.target)}}",
"--repo-name",
"linz/{{=sprig.regexFind('(elevation|imagery)', workflow.parameters.target)}}",
"linz/{{=sprig.regexFind('(elevation|imagery)', inputs.parameters.target)}}",
]
volumes:
- name: secret-volume
secret:
secretName: "github-linz-{{=sprig.regexFind('(elevation|imagery)', workflow.parameters.target)}}"
secretName: "github-linz-{{=sprig.regexFind('(elevation|imagery)', tasks.approval.outputs.parameters.target)}}"
defaultMode: 384

0 comments on commit fef4cc9

Please sign in to comment.