040-sensor-github.yaml 9.9 KB

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