Skip to content

Commit e8ddf11

Browse files
drGrovejames8nguyen
authored andcommitted
Get drone builds into a working state
Issues with the configuration of drone caused it to throw an unmarshall error. Moved to jsonnet as it keeps things a little more locked in and easier to do more creative things in the future. Ticket: BG-18745
1 parent 1711aef commit e8ddf11

File tree

3 files changed

+192
-101
lines changed

3 files changed

+192
-101
lines changed

.drone.jsonnet

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/// High level setup
2+
3+
local pipeline(
4+
name,
5+
kind = "pipeline",
6+
type = "docker",
7+
clone = null,
8+
platform = null,
9+
workspace = null,
10+
services = [],
11+
steps = [],
12+
trigger = null,
13+
node = null,
14+
volumes = [],
15+
depends_on = [],
16+
) = {
17+
kind: kind,
18+
type: type,
19+
name: name,
20+
[if platform != null then 'platform']: platform,
21+
[if workspace != null then 'workspace']: workspace,
22+
[if clone != null then 'clone']: clone,
23+
[if services != [] then 'services']: services,
24+
[if steps != [] then 'steps']: steps,
25+
[if trigger != null then 'trigger']: trigger,
26+
[if node != null then 'node']: node,
27+
[if volumes != [] then 'volumes']: volumes,
28+
[if depends_on != [] then 'depends_on']: depends_on,
29+
};
30+
31+
local step(
32+
name,
33+
image,
34+
settings = null,
35+
depends_on = [],
36+
commands = null,
37+
environment = null,
38+
failure = false,
39+
detach = false,
40+
privileged = false,
41+
volumes = [],
42+
when = null
43+
) = {
44+
name: name,
45+
image: image,
46+
[if failure then 'failure']: failure,
47+
[if detach then 'detach']: detach,
48+
[if privileged then 'privileged']: detach,
49+
[if settings != null then 'settings']: settings,
50+
[if depends_on != [] then 'depends_on']: depends_on,
51+
[if commands != [] then 'commands']: commands,
52+
[if environment != null then 'environment']: environment,
53+
[if volumes != [] then 'volumes']: volumes,
54+
[if when != null then 'when']: when,
55+
};
56+
57+
[
58+
pipeline(
59+
kind = "pipeline",
60+
name = "check requisites (node:10)",
61+
steps = [
62+
step(
63+
name = "build information",
64+
image = "node:10",
65+
commands = [
66+
"node --version",
67+
"npm --version",
68+
"git --version",
69+
],
70+
),
71+
step(
72+
name = "install",
73+
image = "node:10",
74+
commands = [
75+
"npm install",
76+
],
77+
),
78+
step(
79+
name = "audit",
80+
image = "node:10",
81+
commands = [
82+
"npm audit",
83+
],
84+
),
85+
step(
86+
name = "lint",
87+
image = "node:10",
88+
commands = [
89+
"npm run lint",
90+
],
91+
),
92+
],
93+
),
94+
pipeline(
95+
kind = "pipeline",
96+
name = "unit tests (node:6)",
97+
steps = [
98+
step(
99+
name = "build information",
100+
image = "node:6",
101+
commands = [
102+
"node --version",
103+
"npm --version",
104+
"git --version",
105+
],
106+
),
107+
step(
108+
name = "install",
109+
image = "node:6",
110+
commands = [
111+
"npm install",
112+
],
113+
),
114+
step(
115+
name = "unit-test",
116+
image = "node:6",
117+
depends_on = [
118+
"install",
119+
],
120+
commands = [
121+
"npm run test",
122+
],
123+
environment = {
124+
MONGO_URI: "mongodb://mongo:27017/key-recovery-service-test",
125+
},
126+
),
127+
],
128+
trigger = {
129+
branch: {
130+
exclude: [
131+
"prod/production",
132+
],
133+
},
134+
},
135+
services = [
136+
{
137+
name: "mongo",
138+
image: "mongo:3.4",
139+
},
140+
]
141+
),
142+
pipeline(
143+
kind = "pipeline",
144+
name = "unit tests (node:10)",
145+
steps = [
146+
step(
147+
name = "build information",
148+
image = "node:10",
149+
commands = [
150+
"node --version",
151+
"npm --version",
152+
"git --version",
153+
],
154+
),
155+
step(
156+
name = "install",
157+
image = "node:10",
158+
commands = [
159+
"npm install",
160+
],
161+
),
162+
step(
163+
name = "unit-test",
164+
image = "node:10",
165+
depends_on = [
166+
"install",
167+
],
168+
commands = [
169+
"npm run test",
170+
],
171+
environment = {
172+
MONGO_URI: "mongodb://mongo:27017/key-recovery-service-test",
173+
},
174+
),
175+
],
176+
trigger = {
177+
branch: {
178+
exclude: [
179+
"prod/production",
180+
],
181+
},
182+
},
183+
services = [
184+
{
185+
name: "mongo",
186+
image: "mongo:3.4",
187+
},
188+
]
189+
)
190+
191+
]

.drone.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.

test/testutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
process.config = require('../config');
2-
process.config.mongouri = 'mongodb://localhost:27017/key-recovery-service-test';
2+
process.config.mongouri = process.env['MONGO_URI'] || 'mongodb://localhost:27017/key-recovery-service-test';
33
process.config.mail = undefined;
44

55
const mongoose = require('../app/db');

0 commit comments

Comments
 (0)