040-sensor-github.yaml 6.9 KB

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