030-sensor-github.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # apiVersion: argoproj.io/v1alpha1
  2. # kind: WorkflowTemplate
  3. # metadata:
  4. # name: ci-workflow
  5. # spec:
  6. # inputs:
  7. # parameters:
  8. # - name: revision
  9. # steps:
  10. # - - name: build
  11. # template: build-golang-example
  12. # arguments:
  13. # parameters:
  14. # - name: revision
  15. # value: "{{inputs.parameters.revision}}"
  16. # # the test step expands into three parallel steps running
  17. # # different operating system images. each mounts the workdir
  18. # # and runs the compiled binary from the build step.
  19. # - - name: test
  20. # template: run-hello
  21. # arguments:
  22. # parameters:
  23. # - name: os-image
  24. # value: "{{item.image}}:{{item.tag}}"
  25. # withItems:
  26. # - { image: "debian", tag: "9.1" }
  27. # - { image: "alpine", tag: "3.6" }
  28. # - { image: "ubuntu", tag: "17.10" }
  29. # ---
  30. # apiVersion: argoproj.io/v1alpha1
  31. # kind: WorkflowTemplate
  32. # metadata:
  33. # name: build-golang-example
  34. # spec:
  35. # inputs:
  36. # parameters:
  37. # - name: revision
  38. # artifacts:
  39. # - name: code
  40. # path: /go/src/github.com/golang/example
  41. # git:
  42. # repo: https://github.com/golang/example.git
  43. # revision: "{{inputs.parameters.revision}}"
  44. # container:
  45. # image: golang:1.8
  46. # command: [sh, -c]
  47. # args: [
  48. # "
  49. # cd /go/src/github.com/golang/example/hello &&
  50. # git status &&
  51. # go build -v .
  52. # ",
  53. # ]
  54. # volumeMounts:
  55. # - name: workdir
  56. # mountPath: /go
  57. # ---
  58. # apiVersion: argoproj.io/v1alpha1
  59. # kind: WorkflowTemplate
  60. # metadata:
  61. # name: run-hello
  62. # spec:
  63. # inputs:
  64. # parameters:
  65. # - name: os-image
  66. # container:
  67. # image: "{{inputs.parameters.os-image}}"
  68. # command: [sh, -c]
  69. # args: [
  70. # "
  71. # uname -a ;
  72. # cat /etc/os-release ;
  73. # /go/src/github.com/golang/example/hello/hello
  74. # ",
  75. # ]
  76. # volumeMounts:
  77. # - name: workdir
  78. # mountPath: /go
  79. # ---
  80. apiVersion: argoproj.io/v1alpha1
  81. kind: Sensor
  82. metadata:
  83. name: github
  84. namespace: argo-events
  85. spec:
  86. template:
  87. serviceAccountName: argo-events-sa
  88. dependencies:
  89. - name: test-dep
  90. gatewayName: github
  91. eventName: example
  92. subscription:
  93. http:
  94. port: 9300
  95. triggers:
  96. - template:
  97. name: github-workflow-trigger
  98. k8s:
  99. group: argoproj.io
  100. version: v1alpha1
  101. resource: workflows
  102. operation: create
  103. source:
  104. resource:
  105. apiVersion: argoproj.io/v1alpha1
  106. kind: Workflow
  107. metadata:
  108. generateName: github-
  109. spec:
  110. entrypoint: whalesay
  111. arguments:
  112. parameters:
  113. - name: message
  114. # value will get overridden by the event payload
  115. value: hello world
  116. templates:
  117. - name: whalesay
  118. inputs:
  119. parameters:
  120. - name: message
  121. container:
  122. image: docker/whalesay:latest
  123. command: [cowsay]
  124. args: ["{{inputs.parameters.message}}"]
  125. parameters:
  126. - src:
  127. dependencyName: test-dep
  128. dest: spec.arguments.parameters.0.value
  129. # triggers:
  130. # - template:
  131. # name: github-workflow-trigger
  132. # k8s:
  133. # group: argoproj.io
  134. # version: v1alpha1
  135. # resource: workflows
  136. # operation: create
  137. # source:
  138. # resource:
  139. # apiVersion: argoproj.io/v1alpha1
  140. # kind: Workflow
  141. # metadata:
  142. # generateName: ci-workflow-
  143. # spec:
  144. # # ttlStrategy:
  145. # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
  146. # # secondsAfterSuccess: 5 # Time to live after workflow is successful
  147. # # secondsAfterFailure: 5 # Time to live after workflow fails
  148. # serviceAccountName: workflow
  149. # # entrypoint: ci-workflow
  150. # # entrypoint is the name of the template used as the starting point of the workflow
  151. # entrypoint: ci-workflow
  152. # workflowTemplateRef:
  153. # name: ci-workflow
  154. # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
  155. # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
  156. # arguments:
  157. # parameters:
  158. # - name: revision
  159. # value: master
  160. # # a temporary volume, named workdir, will be used as a working directory
  161. # # for this workflow. This volume is passed around from step to step.
  162. # volumeClaimTemplates:
  163. # - metadata:
  164. # name: workdir
  165. # spec:
  166. # accessModes: ["ReadWriteOnce"]
  167. # resources:
  168. # requests:
  169. # storage: 1Gi
  170. # parameters:
  171. # - src:
  172. # dependencyName: test-dep
  173. # dest: spec.arguments.parameters.0.value