-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci.yaml
98 lines (93 loc) · 2.74 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
88
89
90
91
92
93
94
95
96
97
98
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: cerbos-ci-
spec:
entrypoint: main
#`argo submit ci.yaml -p branch=main repoPath=/cerbos repo=https://github.com/cerbos/cerbos-argo-workflow.git`
arguments:
parameters:
- name: repo
value: https://github.com/cerbos/cerbos-argo-workflow.git
- name: branch
value: main
- name: repoPath
value: /
- name: cerbosVersion
value: latest
- name: cerbosHost
value: cerbos.default.svc.cluster.local:3593
- name: cerbosAdminUser
value: cerbos
- name: cerbosAdminPass
value: cerbosAdmin
# 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: 512Mi
templates:
- name: main
dag:
tasks:
- name: clone
template: clone
- name: validate
template: validate
dependencies:
- clone
- name: test
template: test
dependencies:
- validate
- name: reload-cerbos
template: reload-cerbos
dependencies:
- test
- name: clone
container:
volumeMounts:
- mountPath: /src
name: workdir
image: golang:1.18
workingDir: /src
command: [sh, -euxc]
args:
- |
git clone -v -b "{{workflow.parameters.branch}}" --single-branch --depth 1 {{workflow.parameters.repo}} .
- name: validate
container:
volumeMounts:
- mountPath: /src
name: workdir
image: ghcr.io/cerbos/cerbos:{{workflow.parameters.cerbosVersion}}
workingDir: /src
args:
["compile", "--skip-tests", "/src{{workflow.parameters.repoPath}}"]
- name: test
container:
volumeMounts:
- mountPath: /src
name: workdir
image: ghcr.io/cerbos/cerbos:{{workflow.parameters.cerbosVersion}}
workingDir: /src
args: ["compile", "/src{{workflow.parameters.repoPath}}"]
- name: reload-cerbos
container:
image: ghcr.io/cerbos/cerbosctl:{{workflow.parameters.cerbosVersion}}
args:
[
"--server={{workflow.parameters.cerbosHost}}",
"--username={{workflow.parameters.cerbosAdminUser}}",
"--password={{workflow.parameters.cerbosAdminPass}}",
"--insecure",
"--plaintext",
"store",
"reload",
"--wait",
]