-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDispatchfile.cue
105 lines (98 loc) · 2.08 KB
/
Dispatchfile.cue
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
99
100
101
102
103
104
105
resource "src-repo": {
type: "git"
param url: "$(context.git.url)"
param revision: "$(context.git.commit)"
}
resource "gitops-repo": {
type: "git"
param url: "https://github.com/mesosphere/devx-dispatch-gitops-demo"
}
resource "docker-image": {
type: "image"
param url: "mesosphere/devx-dispatch-demo"
}
task "unit-test": {
inputs: ["src-repo"]
steps: [
{
name: "go-test"
image: "golang:1.13.0-buster"
command: ["go", "test", "./..."]
workingDir: "/workspace/src-repo"
env: [
{
name: "SLEEP_DURATION"
value: "5s"
}
]
}
]
}
task "build-image": {
inputs: ["src-repo"]
outputs: ["docker-image"]
deps: ["unit-test"]
steps: [
{
name: "build-and-push"
image: "gcr.io/kaniko-project/executor"
args: [
"--destination=$(outputs.resources.docker-image.url)",
"--context=/workspace/src-repo",
"--oci-layout-path=/builder/home/image-outputs/docker-image",
"--dockerfile=/workspace/src-repo/Dockerfile"
],
env: [
{
name: "DOCKER_CONFIG"
value: "/builder/home/.docker"
}
]
}
]
}
task "integration-test": {
inputs: ["docker-image"]
steps:[
{
name: "run-test"
image: "$(inputs.resources.docker-image.url)@$(inputs.resources.docker-image.digest)"
command: ["/hello-app.test"]
env: [
{
name: "SLEEP_DURATION"
value: "5s"
}
]
}
]
}
task "deploy": {
inputs: ["docker-image", "gitops-repo"]
deps: ["integration-test"]
steps: [
{
name: "update-gitops-repo"
image: "mesosphere/update-gitops-repo:v1.0"
workingDir: "/workspace/gitops-repo"
args: [
"-git-revision=$(context.git.commit)",
"-substitute=imageName=$(inputs.resources.docker-image.url)@$(inputs.resources.docker-image.digest)"
]
}
]
}
actions: [
{
tasks: ["deploy"]
on push: {
branches: ["master"]
}
},
{
tasks: ["integration-test"]
on pull_request: {
chatops: ["test"]
}
}
]