040-sensor-github.yaml 6.9 KB

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