123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- apiVersion: argoproj.io/v1alpha1
- kind: WorkflowTemplate
- metadata:
- name: ci-workflow
- spec:
- inputs:
- parameters:
- - name: revision
- steps:
- - - name: build
- template: build-golang-example
- arguments:
- parameters:
- - name: revision
- value: "{{inputs.parameters.revision}}"
- # the test step expands into three parallel steps running
- # different operating system images. each mounts the workdir
- # and runs the compiled binary from the build step.
- - - name: test
- template: run-hello
- arguments:
- parameters:
- - name: os-image
- value: "{{item.image}}:{{item.tag}}"
- withItems:
- - { image: "debian", tag: "9.1" }
- - { image: "alpine", tag: "3.6" }
- - { image: "ubuntu", tag: "17.10" }
- ---
- apiVersion: argoproj.io/v1alpha1
- kind: WorkflowTemplate
- metadata:
- name: build-golang-example
- spec:
- inputs:
- parameters:
- - name: revision
- artifacts:
- - name: code
- path: /go/src/github.com/golang/example
- git:
- repo: https://github.com/golang/example.git
- revision: "{{inputs.parameters.revision}}"
- container:
- image: golang:1.8
- command: [sh, -c]
- args: [
- "
- cd /go/src/github.com/golang/example/hello &&
- git status &&
- go build -v .
- ",
- ]
- volumeMounts:
- - name: workdir
- mountPath: /go
- ---
- apiVersion: argoproj.io/v1alpha1
- kind: WorkflowTemplate
- metadata:
- name: run-hello
- spec:
- inputs:
- parameters:
- - name: os-image
- container:
- image: "{{inputs.parameters.os-image}}"
- command: [sh, -c]
- args: [
- "
- uname -a ;
- cat /etc/os-release ;
- /go/src/github.com/golang/example/hello/hello
- ",
- ]
- volumeMounts:
- - name: workdir
- mountPath: /go
- ---
- apiVersion: argoproj.io/v1alpha1
- kind: Sensor
- metadata:
- name: github
- spec:
- template:
- serviceAccountName: argo-events-sa
- dependencies:
- - name: test-dep
- gatewayName: github
- eventName: example
- subscription:
- http:
- port: 9300
- triggers:
- - template:
- name: github-workflow-trigger
- k8s:
- group: argoproj.io
- version: v1alpha1
- resource: workflows
- operation: create
- source:
- resource:
- apiVersion: argoproj.io/v1alpha1
- kind: Workflow
- metadata:
- # generateName: github-
- generateName: ci-workflow-
- spec:
- serviceAccountName: workflow
- # entrypoint: whalesay
- entrypoint: ci-workflow
- workflowTemplateRef:
- name: ci-workflow
- # arguments:
- # parameters:
- # - name: message
- # # value will get overridden by the event payload
- # value: hello world
- # templates:
- # - name: whalesay
- # inputs:
- # parameters:
- # - name: message
- # container:
- # image: docker/whalesay:latest
- # command: [cowsay]
- # args: ["{{inputs.parameters.message}}"]
- parameters:
- - src:
- dependencyName: test-dep
- dest: spec.arguments.parameters.0.value
- # - template:
- # name: github-workflow-trigger
- # k8s:
- # group: argoproj.io
- # version: v1alpha1
- # resource: workflows
- # operation: create
- # source:
- # resource:
- # apiVersion: argoproj.io/v1alpha1
- # kind: Workflow
- # metadata:
- # generateName: github-
- # spec:
- # serviceAccountName: workflow
- # entrypoint: whalesay
- # arguments:
- # parameters:
- # - name: message
- # # value will get overridden by the event payload
- # value: hello world
- # templates:
- # - name: whalesay
- # inputs:
- # parameters:
- # - name: message
- # container:
- # image: docker/whalesay:latest
- # command: [cowsay]
- # args: ["{{inputs.parameters.message}}"]
- # parameters:
- # - src:
- # dependencyName: test-dep
- # dest: spec.arguments.parameters.0.value
- # --- daqui pra baixo
- # apiVersion: argoproj.io/v1alpha1
- # kind: Sensor
- # metadata:
- # name: github
- # namespace: argo-events
- # spec:
- # template:
- # serviceAccountName: argo-events-sa
- # dependencies:
- # - name: test-dep
- # gatewayName: github
- # eventName: example
- # subscription:
- # http:
- # port: 9300
- # triggers:
- # - template:
- # name: github-workflow-trigger
- # k8s:
- # group: argoproj.io
- # version: v1alpha1
- # resource: workflows
- # operation: create
- # source:
- # resource:
- # apiVersion: argoproj.io/v1alpha1
- # kind: Workflow
- # metadata:
- # generateName: github-
- # spec:
- # # serviceAccountName: workflow
- # entrypoint: whalesay
- # arguments:
- # parameters:
- # - name: message
- # # value will get overridden by the event payload
- # value: hello world
- # templates:
- # - name: whalesay
- # inputs:
- # parameters:
- # - name: message
- # container:
- # image: docker/whalesay:latest
- # command: [cowsay]
- # args: ["{{inputs.parameters.message}}"]
- # parameters:
- # - src:
- # dependencyName: test-dep
- # dest: spec.arguments.parameters.0.value
- # # triggers:
- # # - template:
- # # name: github-workflow-trigger
- # # k8s:
- # # group: argoproj.io
- # # version: v1alpha1
- # # resource: workflows
- # # operation: create
- # # source:
- # # resource:
- # # apiVersion: argoproj.io/v1alpha1
- # # kind: Workflow
- # # metadata:
- # # generateName: ci-workflow-
- # # spec:
- # # # ttlStrategy:
- # # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
- # # # secondsAfterSuccess: 5 # Time to live after workflow is successful
- # # # secondsAfterFailure: 5 # Time to live after workflow fails
- # # serviceAccountName: workflow
- # # # entrypoint: ci-workflow
- # # # entrypoint is the name of the template used as the starting point of the workflow
- # # entrypoint: ci-workflow
- # # workflowTemplateRef:
- # # name: ci-workflow
- # # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
- # # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
- # # arguments:
- # # parameters:
- # # - name: revision
- # # value: master
- # # # a temporary volume, named workdir, will be used as a working directory
- # # # for this workflow. This volume is passed around from step to step.
- # # volumeClaimTemplates:
- # # - metadata:
- # # name: workdir
- # # spec:
- # # accessModes: ["ReadWriteOnce"]
- # # resources:
- # # requests:
- # # storage: 1Gi
- # # parameters:
- # # - src:
- # # dependencyName: test-dep
- # # dest: spec.arguments.parameters.0.value
|