From bee6f51eadade69f125359e08b55795b28cf0f9b Mon Sep 17 00:00:00 2001 From: "Petti, Ken" Date: Fri, 27 Mar 2020 14:05:05 -0400 Subject: [PATCH] updating workflow --- .../templates/front-end-dep.yaml | 2 +- .../templates/front-end-int-svc.yaml | 2 +- .../templates/front-end-svc.yaml | 2 +- .../templates/tests/failure.yaml | 2 +- helm-socks-frontend/templates/tests/hook.yaml | 21 --------- .../templates/tests/success.yaml | 23 ---------- .../templates/tests/workflow.yaml | 46 +++++++++++++++++++ 7 files changed, 50 insertions(+), 48 deletions(-) delete mode 100644 helm-socks-frontend/templates/tests/hook.yaml delete mode 100644 helm-socks-frontend/templates/tests/success.yaml create mode 100644 helm-socks-frontend/templates/tests/workflow.yaml diff --git a/helm-socks-frontend/templates/front-end-dep.yaml b/helm-socks-frontend/templates/front-end-dep.yaml index b2f75ad..92fdc69 100644 --- a/helm-socks-frontend/templates/front-end-dep.yaml +++ b/helm-socks-frontend/templates/front-end-dep.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "helm-socks-frontend.fullname" . }} + name: {{ include "helm-socks-frontend.name" . }} labels: {{- include "helm-socks-frontend.labels" . | nindent 4 }} spec: diff --git a/helm-socks-frontend/templates/front-end-int-svc.yaml b/helm-socks-frontend/templates/front-end-int-svc.yaml index 08a17e6..ca5ec1b 100644 --- a/helm-socks-frontend/templates/front-end-int-svc.yaml +++ b/helm-socks-frontend/templates/front-end-int-svc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "helm-socks-frontend.fullname" . }}-int + name: {{ include "helm-socks-frontend.name" . }}-int labels: {{- include "helm-socks-frontend.labels" . | nindent 4 }} spec: diff --git a/helm-socks-frontend/templates/front-end-svc.yaml b/helm-socks-frontend/templates/front-end-svc.yaml index 47d575a..3d03e90 100644 --- a/helm-socks-frontend/templates/front-end-svc.yaml +++ b/helm-socks-frontend/templates/front-end-svc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "helm-socks-frontend.fullname" . }} + name: {{ include "helm-socks-frontend.name" . }} labels: {{- include "helm-socks-frontend.labels" . | nindent 4 }} annotations: diff --git a/helm-socks-frontend/templates/tests/failure.yaml b/helm-socks-frontend/templates/tests/failure.yaml index 3f000d1..bea3e4e 100644 --- a/helm-socks-frontend/templates/tests/failure.yaml +++ b/helm-socks-frontend/templates/tests/failure.yaml @@ -1,7 +1,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: "{{ include "helm-socks-frontend.fullname" . }}-credentials-test-failure" + name: "{{ include "helm-socks-frontend.name" . }}-credentials-test-failure" annotations: argocd.argoproj.io/hook: SyncFail argocd.argoproj.io/hook-delete-policy: HookSucceeded diff --git a/helm-socks-frontend/templates/tests/hook.yaml b/helm-socks-frontend/templates/tests/hook.yaml deleted file mode 100644 index 9d3af57..0000000 --- a/helm-socks-frontend/templates/tests/hook.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: "{{ include "helm-socks-frontend.fullname" . }}-credentials-test" - annotations: - argocd.argoproj.io/hook: PostSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded -spec: - template: - spec: - containers: - - name: check-service-up - image: appropriate/curl - command: - - 'curl' - - '-X' - - 'GET' - - 'sock-shop-front-end-helm-socks-frontend-int' - restartPolicy: Never - - diff --git a/helm-socks-frontend/templates/tests/success.yaml b/helm-socks-frontend/templates/tests/success.yaml deleted file mode 100644 index 9f64d94..0000000 --- a/helm-socks-frontend/templates/tests/success.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: "{{ include "helm-socks-frontend.fullname" . }}-credentials-test-success" - annotations: - argocd.argoproj.io/hook: PostSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded -spec: - template: - spec: - containers: - - name: check-service-up - image: appropriate/curl - command: - - 'curl' - - '-X' - - 'POST' - - '-H "Content-Type: application/json"' - - '-d "{"status":"success"}"' - - 'https://webhook.site/c1d94793-b1b1-424b-b412-3f429a6825bb' - restartPolicy: Never - - diff --git a/helm-socks-frontend/templates/tests/workflow.yaml b/helm-socks-frontend/templates/tests/workflow.yaml new file mode 100644 index 0000000..20ba4a5 --- /dev/null +++ b/helm-socks-frontend/templates/tests/workflow.yaml @@ -0,0 +1,46 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: integration-handlers- +spec: + entrypoint: check-service-up + onExit: exit-handler + + # exit handler related templates + # After the completion of the entrypoint template, the status of the + # workflow is made available in the global variable {{workflow.status}}. + # {{workflow.status}} will be one of: Succeeded, Failed, Error + + templates: + - name: check-service-up + container: + image: appropriate/curl + command: + - 'curl' + - '-X' + - 'GET' + - 'sock-shop-front-end-helm-socks-frontend-int' + + - name: exit-handler + steps: + - - name: notify + template: send-status-webhook + arguments: + parameters: + - name: status + value: "{{workflow.status}}" + + - name: send-status-webhook + inputs: + parameters: + - name: status + container: + image: appropriate/curl + command: + - 'curl' + - '-X' + - 'POST' + - '-H "Content-Type: application/json"' + - '-d "{"status":"{{ inputs.parameters.status }}"}"' + - 'https://webhook.site/c1d94793-b1b1-424b-b412-3f429a6825bb' +