Skip to content

Commit 3766eb3

Browse files
committed
evergreen: port config structure from scout-server
1 parent 4ff98df commit 3766eb3

File tree

1 file changed

+108
-89
lines changed

1 file changed

+108
-89
lines changed

.evergreen.yml

Lines changed: 108 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,9 @@
88

99
stepback: false
1010

11-
pre:
12-
- command: shell.track
13-
14-
post:
15-
- command: shell.cleanup
16-
1711
variables:
18-
# function "fetch npm tarball" is conditional on the following
12+
# function "fetch npm tarball" is conditional on {fetch_npm_tarball}
1913
# -> all except windows
20-
- &fetch_npm_tarball_variants
21-
- osx-108
22-
- ubuntu
2314

2415
# function "upgrade npm windows" is conditional based on {upgrade_npm_version}
2516
# as set in the buildvariant declaration
@@ -44,100 +35,124 @@ functions:
4435
- command: git.apply_patch
4536
params:
4637
directory: src
47-
- command: shell.exec
48-
params:
49-
working_dir: src
50-
script: |
51-
mkdir .deps
5238

5339
# Install node,npm from a tarball in S3 to src/.deps/bin
5440
# To use "npm" installed by this, each shell.exec script must add:
5541
# export PATH="$PATH:${node_path|}"
56-
"fetch npm tarball" :
57-
- command: s3.get
58-
params:
59-
build_variants:
60-
*fetch_npm_tarball_variants
61-
aws_key: ${aws_key_evergreen_integrations}
62-
aws_secret: ${aws_secret_evergreen_integrations}
63-
bucket: mongodb-dx-public
64-
remote_file: evergreen-deps/${fetch_npm_tarball}
65-
local_file: src/.deps/${fetch_npm_tarball}
66-
- command: shell.exec
67-
params:
68-
working_dir: src/.deps
69-
script: |
70-
if [ -z "${fetch_npm_tarball|}" ]; then
71-
echo "fetch_npm_tarball: fetch_npm_tarball is unset; skipping"
72-
exit 0
73-
fi
74-
set -ev
75-
tar xzf ${fetch_npm_tarball} --strip-components=1
76-
ls
42+
#
43+
# Only when this is a single-step command can we reuse via *fetch_npm_tarball below.
44+
#
45+
# Ubuntu: has curl+wget
46+
# Windows: has curl
47+
# OSX: has curl
48+
#
49+
# So we use curl.
50+
# Tried "command: s3.get" but it's challenging to blend into "setup ci" below.
51+
# Also, command "s3.get"s extract_to target chokes on symlinks. EVG-609.
52+
#
53+
"fetch npm tarball" : &fetch_npm_tarball
54+
command: shell.exec
55+
params:
56+
working_dir: src
57+
script: |
58+
mkdir -p .deps
59+
set -ev
60+
if [ -z "${fetch_npm_tarball|}" ]; then
61+
echo "fetch_npm_tarball: fetch_npm_tarball is unset; skipping"
62+
exit 0
63+
fi
64+
curl -fs \
65+
-o ".deps/${fetch_npm_tarball}" \
66+
--url "http://mongodb-dx-public.s3.amazonaws.com/evergreen-deps/${fetch_npm_tarball}"
67+
cd .deps
68+
tar xzf ${fetch_npm_tarball} --strip-components=1
7769
7870
# THIS COMMAND WORKS ON WINDOWS ONLY, SHOULD BE CONSIDERED OBSOLETE
7971
# To use "npm" installed by this, each shell.exec script must add:
8072
# export PATH="`npm -g bin`:$PATH"
81-
"upgrade npm windows" :
82-
- command: shell.exec
83-
params:
84-
working_dir: src
85-
script: |
86-
if [ -z "${upgrade_npm_version|}" ]; then
87-
echo "upgrade_npm: upgrade_npm_version is unset; skipping"
88-
exit 0
89-
fi
90-
set -ev
91-
test -n "${add_environment|}" && export "${add_environment|}"
92-
export PATH="$PATH:${node_path|}"
93-
${npm|npm} install -g npm@${upgrade_npm_version|xx}
73+
"upgrade npm windows" : &upgrade_npm_windows
74+
command: shell.exec
75+
params:
76+
working_dir: src
77+
script: |
78+
if [ -z "${upgrade_npm_version|}" ]; then
79+
echo "upgrade_npm: upgrade_npm_version is unset; skipping"
80+
exit 0
81+
fi
82+
set -ev
83+
test -n "${node_environment|}" && export "${node_environment|}"
84+
export PATH="$PATH:${node_path|}"
85+
${npm|npm} install -g npm@${upgrade_npm_version|xx}
9486
9587
"npm install" :
96-
- command: shell.exec
97-
params:
98-
working_dir: src
99-
script: |
100-
set -ev
101-
test -n "${add_environment|}" && export "${add_environment|}"
102-
export PATH="$PATH:${node_path|}"
103-
export PATH="`npm -g bin`:$PATH"
104-
${node|node} --version
105-
${npm|npm} --version
106-
${npm|npm} config set loglevel error
107-
${npm|npm} config -g list -l
108-
${npm|npm} install
88+
command: shell.exec
89+
params:
90+
working_dir: src
91+
script: |
92+
set -ev
93+
test -n "${node_environment|}" && export "${node_environment|}"
94+
export PATH="$PATH:${node_path|}"
95+
export PATH="`npm -g bin`:$PATH"
96+
${node|node} --version
97+
${npm|npm} --version
98+
${npm|npm} config set loglevel error
99+
${npm|npm} config -g list -l
100+
${npm|npm} install
109101
110102
"build" :
111-
- command: shell.exec
112-
params:
113-
working_dir: src
114-
script: |
115-
set -ev
116-
test -n "${add_environment|}" && export "${add_environment|}"
117-
export PATH="$PATH:${node_path|}"
118-
export PATH="`npm -g bin`:$PATH"
119-
${npm|npm} run ci
120-
${npm|npm} run test
121-
${npm|npm} run release
103+
command: shell.exec
104+
params:
105+
working_dir: src
106+
script: |
107+
set -ev
108+
test -n "${node_environment|}" && export "${node_environment|}"
109+
export PATH="$PATH:${node_path|}"
110+
export PATH="`npm -g bin`:$PATH"
111+
export CI=1 EVERGREEN=1
112+
test -n "${add_environment|}" && export ${add_environment|}
113+
${npm|npm} run ci
114+
${npm|npm} run test
115+
${npm|npm} run release
122116
123117
"save release":
124-
- command: s3.put
125-
params:
126-
build_variants:
127-
*save_release_variants
128-
aws_key: ${aws_key}
129-
aws_secret: ${aws_secret}
130-
local_file: "src/dist/${installer_filename}"
131-
remote_file: "mongodbjs-scout-master/${build_variant}/${revision}/${installer_filename}"
132-
bucket: mciuploads
133-
permissions: public-read
134-
content_type: ${installer_content_type|application/octet-stream}
135-
display_name: "Installer: ${installer_filename}"
118+
command: s3.put
119+
params:
120+
build_variants:
121+
*save_release_variants
122+
aws_key: ${aws_key}
123+
aws_secret: ${aws_secret}
124+
local_file: "src/dist/${installer_filename}"
125+
remote_file: "mongodbjs-scout-master/${build_variant}/${revision}/${installer_filename}"
126+
bucket: mciuploads
127+
permissions: public-read
128+
content_type: ${installer_content_type|application/octet-stream}
129+
display_name: "Installer: ${installer_filename}"
130+
136131

137132
#######################################
138133
# Tasks #
139134
#######################################
140135

136+
pre:
137+
- command: shell.track
138+
- command: shell.exec
139+
params:
140+
silent: true
141+
script: |
142+
${killall_evergreen|pkill -9 mongod; pkill -9 mongos; pkill -9 mongo} >/dev/null 2>&1
143+
rm -rf src /data/db/*
144+
mkdir -p src
145+
146+
post:
147+
- command: shell.exec
148+
params:
149+
silent: true
150+
script: |
151+
${killall_evergreen|pkill -9 mongod; pkill -9 mongos; pkill -9 mongo} >/dev/null 2>&1
152+
exit 0
153+
- command: shell.cleanup
154+
155+
141156
tasks:
142157
- name: compile
143158
depends_on: []
@@ -149,6 +164,10 @@ tasks:
149164
- func: "build"
150165
- func: "save release"
151166

167+
# Define shortcut for use below
168+
variables:
169+
- &all_tasks
170+
- name: compile
152171

153172
#######################################
154173
# Buildvariants #
@@ -167,22 +186,22 @@ buildvariants:
167186
installer_filename: "MongoDB Compass.dmg"
168187
num_cores: $(sysctl -n hw.logicalcpu)
169188
tasks:
170-
- name: compile
189+
*all_tasks
171190

172191
- name: windows-64
173192
display_name: Windows 64-bit
174193
modules: ~
175194
run_on:
176195
- "windows-64-vs2013-test"
177196
expansions:
178-
add_environment: "APPDATA=C:\\Program Files (x86)\\nodejs\\node_modules"
197+
node_environment: "APPDATA=C:\\Program Files (x86)\\nodejs\\node_modules"
179198
upgrade_npm_version: "3"
180199
node_path: "/cygdrive/c/Program Files (x86)/nodejs"
181200
installer_content_type: "application/octet-stream"
182201
installer_filename: "MongoDBCompassSetup.exe"
183202
num_cores: $(grep -c ^processor /proc/cpuinfo)
184203
tasks:
185-
- name: compile
204+
*all_tasks
186205

187206
- name: ubuntu
188207
display_name: Ubuntu 14.04
@@ -195,4 +214,4 @@ buildvariants:
195214
compile_env: CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
196215
num_cores: $(grep -c ^processor /proc/cpuinfo)
197216
tasks:
198-
- name: compile
217+
*all_tasks

0 commit comments

Comments
 (0)