040-sensor-github.yaml 6.9 KB

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