-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
ci.yaml
87 lines (84 loc) · 2.37 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: ci-example-
spec:
# entrypoint is the name of the template used as the starting point of the workflow
entrypoint: ci-example
# the 'ci-example' template accepts an parameter 'revision', with a default of 'cfe12d6'.
# this can be overridden via argo CLI (e.g. `argo submit ci.yaml -p revision=0dea2d0`)
arguments:
parameters:
- name: revision
value: cfe12d6
# a temporary volume, named workdir, will be used as a working directory
# for this workflow. This volume is passed around from step to step.
volumeClaimTemplates:
- metadata:
name: workdir
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
templates:
- name: ci-example
inputs:
parameters:
- name: revision
steps:
- - name: build
template: build-golang-example
arguments:
parameters:
- name: revision
value: "{{inputs.parameters.revision}}"
# the test step expands into three parallel steps running
# different operating system images. each mounts the workdir
# and runs the compiled binary from the build step.
- - name: test
template: run-hello
arguments:
parameters:
- name: os-image
value: "{{item.image}}:{{item.tag}}"
withItems:
- { image: 'debian', tag: '9.1' }
- { image: 'alpine', tag: '3.6' }
- { image: 'ubuntu', tag: '17.10' }
- name: build-golang-example
inputs:
parameters:
- name: revision
artifacts:
- name: code
path: /go/src/github.com/golang/example
git:
repo: https://github.com/golang/example.git
revision: "{{inputs.parameters.revision}}"
container:
image: golang:1.8
command: [sh, -c]
args: ["
cd /go/src/github.com/golang/example/hello &&
git status &&
go build -v .
"]
volumeMounts:
- name: workdir
mountPath: /go
- name: run-hello
inputs:
parameters:
- name: os-image
container:
image: "{{inputs.parameters.os-image}}"
command: [sh, -c]
args: ["
uname -a ;
cat /etc/os-release ;
/go/src/github.com/golang/example/hello/hello
"]
volumeMounts:
- name: workdir
mountPath: /go