Skip to content

Commit

Permalink
chore(examples): add argo-workflows example (#18)
Browse files Browse the repository at this point in the history
* chore(examples): add argo-workflows example

* Update argo-workflows-template.yaml

* Update argo-workflows-template.yaml
  • Loading branch information
aslafy-z authored Sep 9, 2021
1 parent eec1388 commit f791145
Showing 1 changed file with 114 additions and 0 deletions.
114 changes: 114 additions & 0 deletions examples/argo-workflows-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: github-notifier
spec:
entrypoint: generic-github-notifier
templates:
- name: generic-github-notifier
inputs:
parameters:
- name: organization
- name: repository
- name: revision
- name: context
value: 'argo-workflows'
- name: state
- name: target_url
- name: description
container:
image: cloudposse/github-status-updater:0.5.0
env:
- name: GITHUB_ACTION
value: 'update_state'
- name: GITHUB_STATE
value: '{{inputs.parameters.state}}'
- name: GITHUB_TARGET_URL
value: '{{inputs.parameters.target_url}}'
- name: GITHUB_DESCRIPTION
value: '{{inputs.parameters.description}}'
- name: GITHUB_CONTEXT
value: '{{inputs.parameters.context}}'
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
key: 'github-automation-token'
name: 'github-automation-secret'
- name: GITHUB_OWNER
value: '{{inputs.parameters.organization}}'
- name: GITHUB_REPO
value: '{{inputs.parameters.repository}}'
- name: GITHUB_REF
value: '{{inputs.parameters.revision}}'
- name: GITHUB_BASE_URL
value: https://private-github-instance/api/v3/
- name: GITHUB_UPLOAD_URL
value: https://private-github-instance/api/uploads
- name: GITHUB_INSECURE
value: 'false'
resources:
requests:
cpu: 1m
memory: 8Mi
activeDeadlineSeconds: 300

---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: build-template
spec:
arguments:
parameters:
- name: revision
value: master
entrypoint: main
templates:
- name: main
dag:
tasks:
- name: notify-github-pending
templateRef:
name: github-notifier
template: generic-github-notifier
arguments:
parameters:
- name: repository
value: 'my-repo'
- name: revision
value: '{{workflow.parameters.revision}}'
- name: state
value: 'pending'
- name: target_url
value: 'https://argo-workflows.example.com/workflows/{{workflow.namespace}}/{{workflow.name}}'
- name: description
value: 'pending'
- name: organisation
value: 'my-org'

- name: build-task
template: build-task

- name: notify-github-result
templateRef:
name: github-notifier
template: generic-github-notifier
arguments:
parameters:
- name: repository
value: 'my-repo'
- name: revision
value: '{{workflow.parameters.revision}}'
- name: state
value: "{{= tasks['build-task'].status == 'Succeeded' ? 'success' : 'failure'}}"
- name: target_url
value: 'https://argo-workflows.example.com/workflows/{{workflow.namespace}}/{{workflow.name}}'
- name: description
value: "{{= tasks['build-task'].status == 'Succeeded' ? 'build succeed' : 'build failed'}}"
- name: organisation
value: 'my-org'
depends: build-task || build-task.Failed

- name: build-task
# implement your build task here

0 comments on commit f791145

Please sign in to comment.