040-sensor-github.yaml 12 KB

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