This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.drone.jsonnet
92 lines (88 loc) · 2.02 KB
/
.drone.jsonnet
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
# defines a secret resource that points to external
# docker credentials.
local SecretDocker = {
kind: "secret",
type: "external",
external_data: {
"username": {
"path": "drone/docker",
"name": "username",
},
"password": {
"path": "drone/docker",
"name": "password",
},
},
};
# returns a Pipeline resource that builds, tests and
# publishes Docker images for the Linux architecture.
local PipelineLinux(os="linux", arch="amd64", variant="") = {
kind: "pipeline",
name: "build-" + os + "-" + arch,
platform: {
os: os,
arch: arch,
},
steps: [
# this step is responsible for building
# and testing the drone docker binary.
{
name: "build",
image: "golang:1.11",
commands: [
"go test -v",
"./scripts/build_"+os+"_"+arch+".sh",
],
},
# this step is responsible for building
# and testing the drone docker image.
{
name: "publish",
image: "plugins/docker",
settings: {
auto_tag: true,
auto_tag_suffix: os + "-" + arch,
dockerfile: "docker/Dockerfile." + os + "." + arch,
repo: "drone/docker",
username: "drone",
password: { "from_secret": "password" },
},
when: {
event: [ "push", "tag" ],
},
},
],
};
# returns a Pipeline resource that pushes a Docker
# manifest for the server and aganet.
local PipelineManifest = {
kind: "pipeline",
name: "manifest",
depends_on: [
"build-linux-arm",
"build-linux-arm64",
"build-linux-amd64",
],
steps: [
{
name: "publish",
image: "plugins/manifest:1",
settings: {
username: { "from_secret": "username" },
password: { "from_secret": "password" },
spec: "docker/manifest.tmpl",
ignore_missing: true,
},
when: {
event: [ "push" ]
}
},
],
};
[
PipelineLinux("linux", "amd64"),
PipelineLinux("linux", "arm64"),
PipelineLinux("linux", "arm"),
PipelineManifest,
SecretDocker,
]