040-sensor-github.yaml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. #-------------------------------------------
  26. apiVersion: argoproj.io/v1alpha1
  27. kind: Workflow
  28. metadata:
  29. generateName: ci-output-artifact-
  30. spec:
  31. # serviceAccountName: workflow
  32. entrypoint: ci-example
  33. # a temporary volume, named workdir, will be used as a working
  34. # directory for this workflow. This volume is passed around
  35. # from step to step.
  36. volumeClaimTemplates:
  37. - metadata:
  38. name: workdir
  39. spec:
  40. storageClassName: standard
  41. accessModes:
  42. - ReadWriteOnce
  43. # selector:
  44. # matchLabels:
  45. # argowf: argo-pv-workflow
  46. resources:
  47. requests:
  48. storage: 1Gi
  49. templates:
  50. - name: ci-example
  51. steps:
  52. - - name: build
  53. template: build-golang-example
  54. # the test step expands into three parallel steps running
  55. # different operating system images. each mounts the workdir
  56. # and runs the compiled binary from the build step.
  57. - - name: test
  58. template: run-hello
  59. arguments:
  60. parameters:
  61. - name: os-image
  62. value: "{{item.image}}:{{item.tag}}"
  63. withItems:
  64. - { image: "debian", tag: "9.1" }
  65. - { image: "alpine", tag: "3.6" }
  66. - { image: "ubuntu", tag: "17.10" }
  67. - - name: release
  68. template: release-artifact
  69. - name: build-golang-example
  70. inputs:
  71. artifacts:
  72. - name: code
  73. path: /go/src/github.com/golang/example
  74. git:
  75. repo: https://github.com/golang/example.git
  76. container:
  77. image: golang:1.8
  78. command: [sh, -c]
  79. args: [
  80. "
  81. cd /go/src/github.com/golang/example/hello &&
  82. go build -v .
  83. ",
  84. ]
  85. volumeMounts:
  86. - name: workdir
  87. mountPath: /go
  88. - name: run-hello
  89. inputs:
  90. parameters:
  91. - name: os-image
  92. container:
  93. image: "{{inputs.parameters.os-image}}"
  94. command: [sh, -c]
  95. args: [
  96. "
  97. uname -a ;
  98. cat /etc/os-release ;
  99. /go/src/github.com/golang/example/hello/hello
  100. ",
  101. ]
  102. volumeMounts:
  103. - name: workdir
  104. mountPath: /go
  105. - name: release-artifact
  106. container:
  107. image: alpine:3.8
  108. volumeMounts:
  109. - name: workdir
  110. mountPath: /go
  111. outputs:
  112. artifacts:
  113. - name: release
  114. path: /go
  115. # apiVersion: argoproj.io/v1alpha1
  116. # kind: Workflow
  117. # metadata:
  118. # generateName: github-
  119. # # generateName: ci-workflow-
  120. # spec:
  121. # serviceAccountName: workflow
  122. # entrypoint: whalesay
  123. # # entrypoint: ci-workflow
  124. # # workflowTemplateRef:
  125. # # name: ci-workflow
  126. # arguments:
  127. # parameters:
  128. # - name: message
  129. # # value will get overridden by the event payload
  130. # value: hello world
  131. # templates:
  132. # - name: whalesay
  133. # inputs:
  134. # parameters:
  135. # - name: message
  136. # container:
  137. # image: docker/whalesay:latest
  138. # command: [cowsay]
  139. # args: ["{{inputs.parameters.message}}"]
  140. # parameters:
  141. # - src:
  142. # dependencyName: test-dep
  143. # dest: spec.arguments.parameters.0.value
  144. #-------------------------------------------
  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. # --- daqui pra baixo
  180. # apiVersion: argoproj.io/v1alpha1
  181. # kind: Sensor
  182. # metadata:
  183. # name: github
  184. # namespace: argo-events
  185. # spec:
  186. # template:
  187. # serviceAccountName: argo-events-sa
  188. # dependencies:
  189. # - name: test-dep
  190. # gatewayName: github
  191. # eventName: example
  192. # subscription:
  193. # http:
  194. # port: 9300
  195. # triggers:
  196. # - template:
  197. # name: github-workflow-trigger
  198. # k8s:
  199. # group: argoproj.io
  200. # version: v1alpha1
  201. # resource: workflows
  202. # operation: create
  203. # source:
  204. # resource:
  205. # apiVersion: argoproj.io/v1alpha1
  206. # kind: Workflow
  207. # metadata:
  208. # generateName: github-
  209. # spec:
  210. # # serviceAccountName: workflow
  211. # entrypoint: whalesay
  212. # arguments:
  213. # parameters:
  214. # - name: message
  215. # # value will get overridden by the event payload
  216. # value: hello world
  217. # templates:
  218. # - name: whalesay
  219. # inputs:
  220. # parameters:
  221. # - name: message
  222. # container:
  223. # image: docker/whalesay:latest
  224. # command: [cowsay]
  225. # args: ["{{inputs.parameters.message}}"]
  226. # parameters:
  227. # - src:
  228. # dependencyName: test-dep
  229. # dest: spec.arguments.parameters.0.value
  230. # # triggers:
  231. # # - template:
  232. # # name: github-workflow-trigger
  233. # # k8s:
  234. # # group: argoproj.io
  235. # # version: v1alpha1
  236. # # resource: workflows
  237. # # operation: create
  238. # # source:
  239. # # resource:
  240. # # apiVersion: argoproj.io/v1alpha1
  241. # # kind: Workflow
  242. # # metadata:
  243. # # generateName: ci-workflow-
  244. # # spec:
  245. # # # ttlStrategy:
  246. # # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
  247. # # # secondsAfterSuccess: 5 # Time to live after workflow is successful
  248. # # # secondsAfterFailure: 5 # Time to live after workflow fails
  249. # # serviceAccountName: workflow
  250. # # # entrypoint: ci-workflow
  251. # # # entrypoint is the name of the template used as the starting point of the workflow
  252. # # entrypoint: ci-workflow
  253. # # workflowTemplateRef:
  254. # # name: ci-workflow
  255. # # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
  256. # # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
  257. # # arguments:
  258. # # parameters:
  259. # # - name: revision
  260. # # value: master
  261. # # # a temporary volume, named workdir, will be used as a working directory
  262. # # # for this workflow. This volume is passed around from step to step.
  263. # # volumeClaimTemplates:
  264. # # - metadata:
  265. # # name: workdir
  266. # # spec:
  267. # # accessModes: ["ReadWriteOnce"]
  268. # # resources:
  269. # # requests:
  270. # # storage: 1Gi
  271. # # parameters:
  272. # # - src:
  273. # # dependencyName: test-dep
  274. # # dest: spec.arguments.parameters.0.value