040-sensor-github.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. # apiVersion: argoproj.io/v1alpha1
  2. # kind: WorkflowTemplate
  3. # metadata:
  4. # name: ci-workflow
  5. # spec:
  6. # inputs:
  7. # parameters:
  8. # - name: revision
  9. # steps:
  10. # - - name: build
  11. # template: build-golang-example
  12. # arguments:
  13. # parameters:
  14. # - name: revision
  15. # value: "{{inputs.parameters.revision}}"
  16. # # the test step expands into three parallel steps running
  17. # # different operating system images. each mounts the workdir
  18. # # and runs the compiled binary from the build step.
  19. # - - name: test
  20. # template: run-hello
  21. # arguments:
  22. # parameters:
  23. # - name: os-image
  24. # value: "{{item.image}}:{{item.tag}}"
  25. # withItems:
  26. # - { image: "debian", tag: "9.1" }
  27. # - { image: "alpine", tag: "3.6" }
  28. # - { image: "ubuntu", tag: "17.10" }
  29. # ---
  30. # apiVersion: argoproj.io/v1alpha1
  31. # kind: WorkflowTemplate
  32. # metadata:
  33. # name: build-golang-example
  34. # spec:
  35. # inputs:
  36. # parameters:
  37. # - name: revision
  38. # artifacts:
  39. # - name: code
  40. # path: /go/src/github.com/golang/example
  41. # git:
  42. # repo: https://github.com/golang/example.git
  43. # revision: "{{inputs.parameters.revision}}"
  44. # container:
  45. # image: golang:1.8
  46. # command: [sh, -c]
  47. # args: [
  48. # "
  49. # cd /go/src/github.com/golang/example/hello &&
  50. # git status &&
  51. # go build -v .
  52. # ",
  53. # ]
  54. # volumeMounts:
  55. # - name: workdir
  56. # mountPath: /go
  57. # ---
  58. # apiVersion: argoproj.io/v1alpha1
  59. # kind: WorkflowTemplate
  60. # metadata:
  61. # name: run-hello
  62. # spec:
  63. # inputs:
  64. # parameters:
  65. # - name: os-image
  66. # container:
  67. # image: "{{inputs.parameters.os-image}}"
  68. # command: [sh, -c]
  69. # args: [
  70. # "
  71. # uname -a ;
  72. # cat /etc/os-release ;
  73. # /go/src/github.com/golang/example/hello/hello
  74. # ",
  75. # ]
  76. # volumeMounts:
  77. # - name: workdir
  78. # mountPath: /go
  79. # ---
  80. apiVersion: argoproj.io/v1alpha1
  81. kind: Sensor
  82. metadata:
  83. name: github
  84. spec:
  85. template:
  86. serviceAccountName: argo-events-sa
  87. dependencies:
  88. - name: test-dep
  89. gatewayName: github
  90. eventName: example
  91. subscription:
  92. http:
  93. port: 9300
  94. triggers:
  95. - template:
  96. name: github-workflow-trigger
  97. k8s:
  98. group: argoproj.io
  99. version: v1alpha1
  100. resource: workflows
  101. operation: create
  102. source:
  103. resource:
  104. #-------------------------------------------
  105. apiVersion: argoproj.io/v1alpha1
  106. kind: Workflow
  107. metadata:
  108. generateName: ci-output-artifact-
  109. spec:
  110. entrypoint: ci-example
  111. # a temporary volume, named workdir, will be used as a working
  112. # directory for this workflow. This volume is passed around
  113. # from step to step.
  114. volumeClaimTemplates:
  115. - metadata:
  116. name: workdir
  117. spec:
  118. accessModes: [ "ReadWriteOnce" ]
  119. resources:
  120. requests:
  121. storage: 1Gi
  122. templates:
  123. - name: ci-example
  124. steps:
  125. - - name: build
  126. template: build-golang-example
  127. # the test step expands into three parallel steps running
  128. # different operating system images. each mounts the workdir
  129. # and runs the compiled binary from the build step.
  130. - - name: test
  131. template: run-hello
  132. arguments:
  133. parameters:
  134. - name: os-image
  135. value: "{{item.image}}:{{item.tag}}"
  136. withItems:
  137. - { image: 'debian', tag: '9.1' }
  138. - { image: 'alpine', tag: '3.6' }
  139. - { image: 'ubuntu', tag: '17.10' }
  140. - - name: release
  141. template: release-artifact
  142. - name: build-golang-example
  143. inputs:
  144. artifacts:
  145. - name: code
  146. path: /go/src/github.com/golang/example
  147. git:
  148. repo: https://github.com/golang/example.git
  149. container:
  150. image: golang:1.8
  151. command: [sh, -c]
  152. args: ["
  153. cd /go/src/github.com/golang/example/hello &&
  154. go build -v .
  155. "]
  156. volumeMounts:
  157. - name: workdir
  158. mountPath: /go
  159. - name: run-hello
  160. inputs:
  161. parameters:
  162. - name: os-image
  163. container:
  164. image: "{{inputs.parameters.os-image}}"
  165. command: [sh, -c]
  166. args: ["
  167. uname -a ;
  168. cat /etc/os-release ;
  169. /go/src/github.com/golang/example/hello/hello
  170. "]
  171. volumeMounts:
  172. - name: workdir
  173. mountPath: /go
  174. - name: release-artifact
  175. container:
  176. image: alpine:3.8
  177. volumeMounts:
  178. - name: workdir
  179. mountPath: /go
  180. outputs:
  181. artifacts:
  182. - name: release
  183. path: /go
  184. # apiVersion: argoproj.io/v1alpha1
  185. # kind: Workflow
  186. # metadata:
  187. # generateName: github-
  188. # # generateName: ci-workflow-
  189. # spec:
  190. # serviceAccountName: workflow
  191. # entrypoint: whalesay
  192. # # entrypoint: ci-workflow
  193. # # workflowTemplateRef:
  194. # # name: ci-workflow
  195. # arguments:
  196. # parameters:
  197. # - name: message
  198. # # value will get overridden by the event payload
  199. # value: hello world
  200. # templates:
  201. # - name: whalesay
  202. # inputs:
  203. # parameters:
  204. # - name: message
  205. # container:
  206. # image: docker/whalesay:latest
  207. # command: [cowsay]
  208. # args: ["{{inputs.parameters.message}}"]
  209. # parameters:
  210. # - src:
  211. # dependencyName: test-dep
  212. # dest: spec.arguments.parameters.0.value
  213. #-------------------------------------------
  214. # - template:
  215. # name: github-workflow-trigger
  216. # k8s:
  217. # group: argoproj.io
  218. # version: v1alpha1
  219. # resource: workflows
  220. # operation: create
  221. # source:
  222. # resource:
  223. # apiVersion: argoproj.io/v1alpha1
  224. # kind: Workflow
  225. # metadata:
  226. # generateName: github-
  227. # spec:
  228. # serviceAccountName: workflow
  229. # entrypoint: whalesay
  230. # arguments:
  231. # parameters:
  232. # - name: message
  233. # # value will get overridden by the event payload
  234. # value: hello world
  235. # templates:
  236. # - name: whalesay
  237. # inputs:
  238. # parameters:
  239. # - name: message
  240. # container:
  241. # image: docker/whalesay:latest
  242. # command: [cowsay]
  243. # args: ["{{inputs.parameters.message}}"]
  244. # parameters:
  245. # - src:
  246. # dependencyName: test-dep
  247. # dest: spec.arguments.parameters.0.value
  248. # --- daqui pra baixo
  249. # apiVersion: argoproj.io/v1alpha1
  250. # kind: Sensor
  251. # metadata:
  252. # name: github
  253. # namespace: argo-events
  254. # spec:
  255. # template:
  256. # serviceAccountName: argo-events-sa
  257. # dependencies:
  258. # - name: test-dep
  259. # gatewayName: github
  260. # eventName: example
  261. # subscription:
  262. # http:
  263. # port: 9300
  264. # triggers:
  265. # - template:
  266. # name: github-workflow-trigger
  267. # k8s:
  268. # group: argoproj.io
  269. # version: v1alpha1
  270. # resource: workflows
  271. # operation: create
  272. # source:
  273. # resource:
  274. # apiVersion: argoproj.io/v1alpha1
  275. # kind: Workflow
  276. # metadata:
  277. # generateName: github-
  278. # spec:
  279. # # serviceAccountName: workflow
  280. # entrypoint: whalesay
  281. # arguments:
  282. # parameters:
  283. # - name: message
  284. # # value will get overridden by the event payload
  285. # value: hello world
  286. # templates:
  287. # - name: whalesay
  288. # inputs:
  289. # parameters:
  290. # - name: message
  291. # container:
  292. # image: docker/whalesay:latest
  293. # command: [cowsay]
  294. # args: ["{{inputs.parameters.message}}"]
  295. # parameters:
  296. # - src:
  297. # dependencyName: test-dep
  298. # dest: spec.arguments.parameters.0.value
  299. # # triggers:
  300. # # - template:
  301. # # name: github-workflow-trigger
  302. # # k8s:
  303. # # group: argoproj.io
  304. # # version: v1alpha1
  305. # # resource: workflows
  306. # # operation: create
  307. # # source:
  308. # # resource:
  309. # # apiVersion: argoproj.io/v1alpha1
  310. # # kind: Workflow
  311. # # metadata:
  312. # # generateName: ci-workflow-
  313. # # spec:
  314. # # # ttlStrategy:
  315. # # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
  316. # # # secondsAfterSuccess: 5 # Time to live after workflow is successful
  317. # # # secondsAfterFailure: 5 # Time to live after workflow fails
  318. # # serviceAccountName: workflow
  319. # # # entrypoint: ci-workflow
  320. # # # entrypoint is the name of the template used as the starting point of the workflow
  321. # # entrypoint: ci-workflow
  322. # # workflowTemplateRef:
  323. # # name: ci-workflow
  324. # # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
  325. # # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
  326. # # arguments:
  327. # # parameters:
  328. # # - name: revision
  329. # # value: master
  330. # # # a temporary volume, named workdir, will be used as a working directory
  331. # # # for this workflow. This volume is passed around from step to step.
  332. # # volumeClaimTemplates:
  333. # # - metadata:
  334. # # name: workdir
  335. # # spec:
  336. # # accessModes: ["ReadWriteOnce"]
  337. # # resources:
  338. # # requests:
  339. # # storage: 1Gi
  340. # # parameters:
  341. # # - src:
  342. # # dependencyName: test-dep
  343. # # dest: spec.arguments.parameters.0.value