040-sensor-github.yaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. apiVersion: v1
  2. kind: PersistentVolume
  3. metadata:
  4. name: argo-pv-workflow
  5. labels:
  6. type: local
  7. # argowf: argo-pv-workflow
  8. spec:
  9. storageClassName: standard
  10. capacity:
  11. storage: 10Gi
  12. accessModes:
  13. - ReadWriteMany
  14. hostPath:
  15. path: "/kbctl"
  16. persistentVolumeReclaimPolicy: Delete
  17. # volumeMode: Filesystem
  18. nodeAffinity:
  19. required:
  20. nodeSelectorTerms:
  21. - matchExpressions:
  22. - key: kubernetes.io/hostname
  23. operator: In
  24. values:
  25. - k8s
  26. ---
  27. apiVersion: argoproj.io/v1alpha1
  28. kind: Sensor
  29. metadata:
  30. name: github
  31. spec:
  32. template:
  33. serviceAccountName: argo-events-sa
  34. dependencies:
  35. - name: test-dep
  36. gatewayName: github
  37. eventName: example
  38. subscription:
  39. http:
  40. port: 9300
  41. triggers:
  42. - template:
  43. name: github-workflow-trigger
  44. k8s:
  45. group: argoproj.io
  46. version: v1alpha1
  47. resource: workflows
  48. operation: create
  49. source:
  50. resource:
  51. #-------------------------------------------
  52. apiVersion: argoproj.io/v1alpha1
  53. kind: Workflow
  54. metadata:
  55. generateName: ci-output-artifact-
  56. spec:
  57. serviceAccountName: workflow
  58. entrypoint: ci-example
  59. # a temporary volume, named workdir, will be used as a working
  60. # directory for this workflow. This volume is passed around
  61. # from step to step.
  62. volumeClaimTemplates:
  63. - metadata:
  64. name: workdir
  65. spec:
  66. storageClassName: standard
  67. accessModes:
  68. - ReadWriteOnce
  69. # selector:
  70. # matchLabels:
  71. # argowf: argo-pv-workflow
  72. resources:
  73. requests:
  74. storage: 1Gi
  75. templates:
  76. - name: ci-example
  77. steps:
  78. - - name: build
  79. template: build-golang-example
  80. # the test step expands into three parallel steps running
  81. # different operating system images. each mounts the workdir
  82. # and runs the compiled binary from the build step.
  83. - - name: test
  84. template: run-hello
  85. arguments:
  86. parameters:
  87. - name: os-image
  88. value: "{{item.image}}:{{item.tag}}"
  89. withItems:
  90. - { image: "debian", tag: "9.1" }
  91. - { image: "alpine", tag: "3.6" }
  92. - { image: "ubuntu", tag: "17.10" }
  93. - - name: release
  94. template: release-artifact
  95. - name: build-golang-example
  96. inputs:
  97. artifacts:
  98. - name: code
  99. path: /go/src/github.com/golang/example
  100. git:
  101. repo: https://github.com/golang/example.git
  102. container:
  103. image: golang:1.8
  104. command: [sh, -c]
  105. args: [
  106. "
  107. cd /go/src/github.com/golang/example/hello &&
  108. go build -v .
  109. ",
  110. ]
  111. volumeMounts:
  112. - name: workdir
  113. mountPath: /go
  114. - name: run-hello
  115. inputs:
  116. parameters:
  117. - name: os-image
  118. container:
  119. image: "{{inputs.parameters.os-image}}"
  120. command: [sh, -c]
  121. args: [
  122. "
  123. uname -a ;
  124. cat /etc/os-release ;
  125. /go/src/github.com/golang/example/hello/hello
  126. ",
  127. ]
  128. volumeMounts:
  129. - name: workdir
  130. mountPath: /go
  131. - name: release-artifact
  132. container:
  133. image: alpine:3.8
  134. volumeMounts:
  135. - name: workdir
  136. mountPath: /go
  137. outputs:
  138. artifacts:
  139. - name: release
  140. path: /go
  141. # apiVersion: argoproj.io/v1alpha1
  142. # kind: Workflow
  143. # metadata:
  144. # generateName: github-
  145. # # generateName: ci-workflow-
  146. # spec:
  147. # serviceAccountName: workflow
  148. # entrypoint: whalesay
  149. # # entrypoint: ci-workflow
  150. # # workflowTemplateRef:
  151. # # name: ci-workflow
  152. # arguments:
  153. # parameters:
  154. # - name: message
  155. # # value will get overridden by the event payload
  156. # value: hello world
  157. # templates:
  158. # - name: whalesay
  159. # inputs:
  160. # parameters:
  161. # - name: message
  162. # container:
  163. # image: docker/whalesay:latest
  164. # command: [cowsay]
  165. # args: ["{{inputs.parameters.message}}"]
  166. # parameters:
  167. # - src:
  168. # dependencyName: test-dep
  169. # dest: spec.arguments.parameters.0.value
  170. #-------------------------------------------
  171. # - template:
  172. # name: github-workflow-trigger
  173. # k8s:
  174. # group: argoproj.io
  175. # version: v1alpha1
  176. # resource: workflows
  177. # operation: create
  178. # source:
  179. # resource:
  180. # apiVersion: argoproj.io/v1alpha1
  181. # kind: Workflow
  182. # metadata:
  183. # generateName: github-
  184. # spec:
  185. # serviceAccountName: workflow
  186. # entrypoint: whalesay
  187. # arguments:
  188. # parameters:
  189. # - name: message
  190. # # value will get overridden by the event payload
  191. # value: hello world
  192. # templates:
  193. # - name: whalesay
  194. # inputs:
  195. # parameters:
  196. # - name: message
  197. # container:
  198. # image: docker/whalesay:latest
  199. # command: [cowsay]
  200. # args: ["{{inputs.parameters.message}}"]
  201. # parameters:
  202. # - src:
  203. # dependencyName: test-dep
  204. # dest: spec.arguments.parameters.0.value
  205. # --- daqui pra baixo
  206. # apiVersion: argoproj.io/v1alpha1
  207. # kind: Sensor
  208. # metadata:
  209. # name: github
  210. # namespace: argo-events
  211. # spec:
  212. # template:
  213. # serviceAccountName: argo-events-sa
  214. # dependencies:
  215. # - name: test-dep
  216. # gatewayName: github
  217. # eventName: example
  218. # subscription:
  219. # http:
  220. # port: 9300
  221. # triggers:
  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. # # triggers:
  257. # # - template:
  258. # # name: github-workflow-trigger
  259. # # k8s:
  260. # # group: argoproj.io
  261. # # version: v1alpha1
  262. # # resource: workflows
  263. # # operation: create
  264. # # source:
  265. # # resource:
  266. # # apiVersion: argoproj.io/v1alpha1
  267. # # kind: Workflow
  268. # # metadata:
  269. # # generateName: ci-workflow-
  270. # # spec:
  271. # # # ttlStrategy:
  272. # # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
  273. # # # secondsAfterSuccess: 5 # Time to live after workflow is successful
  274. # # # secondsAfterFailure: 5 # Time to live after workflow fails
  275. # # serviceAccountName: workflow
  276. # # # entrypoint: ci-workflow
  277. # # # entrypoint is the name of the template used as the starting point of the workflow
  278. # # entrypoint: ci-workflow
  279. # # workflowTemplateRef:
  280. # # name: ci-workflow
  281. # # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
  282. # # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
  283. # # arguments:
  284. # # parameters:
  285. # # - name: revision
  286. # # value: master
  287. # # # a temporary volume, named workdir, will be used as a working directory
  288. # # # for this workflow. This volume is passed around from step to step.
  289. # # volumeClaimTemplates:
  290. # # - metadata:
  291. # # name: workdir
  292. # # spec:
  293. # # accessModes: ["ReadWriteOnce"]
  294. # # resources:
  295. # # requests:
  296. # # storage: 1Gi
  297. # # parameters:
  298. # # - src:
  299. # # dependencyName: test-dep
  300. # # dest: spec.arguments.parameters.0.value