030-sensor-github.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. namespace: argo-events
  85. spec:
  86. template:
  87. serviceAccountName: argo-events-sa
  88. dependencies:
  89. - name: test-dep
  90. gatewayName: github
  91. eventName: example
  92. subscription:
  93. http:
  94. port: 9300
  95. triggers:
  96. - template:
  97. name: github-workflow-trigger
  98. k8s:
  99. group: argoproj.io
  100. version: v1alpha1
  101. resource: workflows
  102. operation: create
  103. source:
  104. resource:
  105. apiVersion: argoproj.io/v1alpha1
  106. kind: Workflow
  107. metadata:
  108. generateName: github-
  109. spec:
  110. # serviceAccountName: workflow
  111. entrypoint: whalesay
  112. arguments:
  113. parameters:
  114. - name: message
  115. # value will get overridden by the event payload
  116. value: hello world
  117. templates:
  118. - name: whalesay
  119. inputs:
  120. parameters:
  121. - name: message
  122. container:
  123. image: docker/whalesay:latest
  124. command: [cowsay]
  125. args: ["{{inputs.parameters.message}}"]
  126. parameters:
  127. - src:
  128. dependencyName: test-dep
  129. dest: spec.arguments.parameters.0.value
  130. # triggers:
  131. # - template:
  132. # name: github-workflow-trigger
  133. # k8s:
  134. # group: argoproj.io
  135. # version: v1alpha1
  136. # resource: workflows
  137. # operation: create
  138. # source:
  139. # resource:
  140. # apiVersion: argoproj.io/v1alpha1
  141. # kind: Workflow
  142. # metadata:
  143. # generateName: ci-workflow-
  144. # spec:
  145. # # ttlStrategy:
  146. # # secondsAfterCompletion: 10 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
  147. # # secondsAfterSuccess: 5 # Time to live after workflow is successful
  148. # # secondsAfterFailure: 5 # Time to live after workflow fails
  149. # serviceAccountName: workflow
  150. # # entrypoint: ci-workflow
  151. # # entrypoint is the name of the template used as the starting point of the workflow
  152. # entrypoint: ci-workflow
  153. # workflowTemplateRef:
  154. # name: ci-workflow
  155. # # the 'ci-workflow' template accepts an parameter 'revision', with a default of 'master'.
  156. # # this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
  157. # arguments:
  158. # parameters:
  159. # - name: revision
  160. # value: master
  161. # # a temporary volume, named workdir, will be used as a working directory
  162. # # for this workflow. This volume is passed around from step to step.
  163. # volumeClaimTemplates:
  164. # - metadata:
  165. # name: workdir
  166. # spec:
  167. # accessModes: ["ReadWriteOnce"]
  168. # resources:
  169. # requests:
  170. # storage: 1Gi
  171. # parameters:
  172. # - src:
  173. # dependencyName: test-dep
  174. # dest: spec.arguments.parameters.0.value