040-sensor-github.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. ---
  81. apiVersion: v1
  82. kind: PersistentVolume
  83. metadata:
  84. name: argo-pv-workflow
  85. labels:
  86. type: local
  87. argowf: argo-pv-workflow
  88. spec:
  89. storageClassName: standard
  90. capacity:
  91. storage: 10Gi
  92. accessModes:
  93. - ReadWriteOnce
  94. hostPath:
  95. path: "/kbctl"
  96. nodeAffinity:
  97. required:
  98. nodeSelectorTerms:
  99. - matchExpressions:
  100. - key: kubernetes.io/hostname
  101. operator: In
  102. values:
  103. - k8s
  104. ---
  105. apiVersion: argoproj.io/v1alpha1
  106. kind: Sensor
  107. metadata:
  108. name: github
  109. spec:
  110. template:
  111. serviceAccountName: argo-events-sa
  112. dependencies:
  113. - name: test-dep
  114. gatewayName: github
  115. eventName: example
  116. subscription:
  117. http:
  118. port: 9300
  119. triggers:
  120. - template:
  121. name: github-workflow-trigger
  122. k8s:
  123. group: argoproj.io
  124. version: v1alpha1
  125. resource: workflows
  126. operation: create
  127. source:
  128. resource:
  129. #-------------------------------------------
  130. apiVersion: argoproj.io/v1alpha1
  131. kind: Workflow
  132. metadata:
  133. generateName: ci-output-artifact-
  134. spec:
  135. entrypoint: ci-example
  136. # a temporary volume, named workdir, will be used as a working
  137. # directory for this workflow. This volume is passed around
  138. # from step to step.
  139. volumeClaimTemplates:
  140. - metadata:
  141. name: workdir
  142. spec:
  143. storageClassName: standard
  144. accessModes:
  145. - ReadWriteOnce
  146. selector:
  147. matchLabels:
  148. argowf: argo-pv-workflow
  149. resources:
  150. requests:
  151. storage: 1Gi
  152. templates:
  153. - name: ci-example
  154. steps:
  155. - - name: build
  156. template: build-golang-example
  157. # the test step expands into three parallel steps running
  158. # different operating system images. each mounts the workdir
  159. # and runs the compiled binary from the build step.
  160. - - name: test
  161. template: run-hello
  162. arguments:
  163. parameters:
  164. - name: os-image
  165. value: "{{item.image}}:{{item.tag}}"
  166. withItems:
  167. - { image: "debian", tag: "9.1" }
  168. - { image: "alpine", tag: "3.6" }
  169. - { image: "ubuntu", tag: "17.10" }
  170. - - name: release
  171. template: release-artifact
  172. - name: build-golang-example
  173. inputs:
  174. artifacts:
  175. - name: code
  176. path: /go/src/github.com/golang/example
  177. git:
  178. repo: https://github.com/golang/example.git
  179. container:
  180. image: golang:1.8
  181. command: [sh, -c]
  182. args: [
  183. "
  184. cd /go/src/github.com/golang/example/hello &&
  185. go build -v .
  186. ",
  187. ]
  188. volumeMounts:
  189. - name: workdir
  190. mountPath: /go
  191. - name: run-hello
  192. inputs:
  193. parameters:
  194. - name: os-image
  195. container:
  196. image: "{{inputs.parameters.os-image}}"
  197. command: [sh, -c]
  198. args: [
  199. "
  200. uname -a ;
  201. cat /etc/os-release ;
  202. /go/src/github.com/golang/example/hello/hello
  203. ",
  204. ]
  205. volumeMounts:
  206. - name: workdir
  207. mountPath: /go
  208. - name: release-artifact
  209. container:
  210. image: alpine:3.8
  211. volumeMounts:
  212. - name: workdir
  213. mountPath: /go
  214. outputs:
  215. artifacts:
  216. - name: release
  217. path: /go
  218. # apiVersion: argoproj.io/v1alpha1
  219. # kind: Workflow
  220. # metadata:
  221. # generateName: github-
  222. # # generateName: ci-workflow-
  223. # spec:
  224. # serviceAccountName: workflow
  225. # entrypoint: whalesay
  226. # # entrypoint: ci-workflow
  227. # # workflowTemplateRef:
  228. # # name: ci-workflow
  229. # arguments:
  230. # parameters:
  231. # - name: message
  232. # # value will get overridden by the event payload
  233. # value: hello world
  234. # templates:
  235. # - name: whalesay
  236. # inputs:
  237. # parameters:
  238. # - name: message
  239. # container:
  240. # image: docker/whalesay:latest
  241. # command: [cowsay]
  242. # args: ["{{inputs.parameters.message}}"]
  243. # parameters:
  244. # - src:
  245. # dependencyName: test-dep
  246. # dest: spec.arguments.parameters.0.value
  247. #-------------------------------------------
  248. # - template:
  249. # name: github-workflow-trigger
  250. # k8s:
  251. # group: argoproj.io
  252. # version: v1alpha1
  253. # resource: workflows
  254. # operation: create
  255. # source:
  256. # resource:
  257. # apiVersion: argoproj.io/v1alpha1
  258. # kind: Workflow
  259. # metadata:
  260. # generateName: github-
  261. # spec:
  262. # serviceAccountName: workflow
  263. # entrypoint: whalesay
  264. # arguments:
  265. # parameters:
  266. # - name: message
  267. # # value will get overridden by the event payload
  268. # value: hello world
  269. # templates:
  270. # - name: whalesay
  271. # inputs:
  272. # parameters:
  273. # - name: message
  274. # container:
  275. # image: docker/whalesay:latest
  276. # command: [cowsay]
  277. # args: ["{{inputs.parameters.message}}"]
  278. # parameters:
  279. # - src:
  280. # dependencyName: test-dep
  281. # dest: spec.arguments.parameters.0.value
  282. # --- daqui pra baixo
  283. # apiVersion: argoproj.io/v1alpha1
  284. # kind: Sensor
  285. # metadata:
  286. # name: github
  287. # namespace: argo-events
  288. # spec:
  289. # template:
  290. # serviceAccountName: argo-events-sa
  291. # dependencies:
  292. # - name: test-dep
  293. # gatewayName: github
  294. # eventName: example
  295. # subscription:
  296. # http:
  297. # port: 9300
  298. # triggers:
  299. # - template:
  300. # name: github-workflow-trigger
  301. # k8s:
  302. # group: argoproj.io
  303. # version: v1alpha1
  304. # resource: workflows
  305. # operation: create
  306. # source:
  307. # resource:
  308. # apiVersion: argoproj.io/v1alpha1
  309. # kind: Workflow
  310. # metadata:
  311. # generateName: github-
  312. # spec:
  313. # # serviceAccountName: workflow
  314. # entrypoint: whalesay
  315. # arguments:
  316. # parameters:
  317. # - name: message
  318. # # value will get overridden by the event payload
  319. # value: hello world
  320. # templates:
  321. # - name: whalesay
  322. # inputs:
  323. # parameters:
  324. # - name: message
  325. # container:
  326. # image: docker/whalesay:latest
  327. # command: [cowsay]
  328. # args: ["{{inputs.parameters.message}}"]
  329. # parameters:
  330. # - src:
  331. # dependencyName: test-dep
  332. # dest: spec.arguments.parameters.0.value
  333. # # triggers:
  334. # # - template:
  335. # # name: github-workflow-trigger
  336. # # k8s:
  337. # # group: argoproj.io
  338. # # version: v1alpha1
  339. # # resource: workflows
  340. # # operation: create
  341. # # source:
  342. # # resource:
  343. # # apiVersion: argoproj.io/v1alpha1
  344. # # kind: Workflow
  345. # # metadata:
  346. # # generateName: ci-workflow-
  347. # # spec:
  348. # # # ttlStrategy:
  349. # # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
  350. # # # secondsAfterSuccess: 5 # Time to live after workflow is successful
  351. # # # secondsAfterFailure: 5 # Time to live after workflow fails
  352. # # serviceAccountName: workflow
  353. # # # entrypoint: ci-workflow
  354. # # # entrypoint is the name of the template used as the starting point of the workflow
  355. # # entrypoint: ci-workflow
  356. # # workflowTemplateRef:
  357. # # name: ci-workflow
  358. # # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
  359. # # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
  360. # # arguments:
  361. # # parameters:
  362. # # - name: revision
  363. # # value: master
  364. # # # a temporary volume, named workdir, will be used as a working directory
  365. # # # for this workflow. This volume is passed around from step to step.
  366. # # volumeClaimTemplates:
  367. # # - metadata:
  368. # # name: workdir
  369. # # spec:
  370. # # accessModes: ["ReadWriteOnce"]
  371. # # resources:
  372. # # requests:
  373. # # storage: 1Gi
  374. # # parameters:
  375. # # - src:
  376. # # dependencyName: test-dep
  377. # # dest: spec.arguments.parameters.0.value