040-sensor-github.yaml 7.0 KB

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