Skip to content

Commit 0caad2e

Browse files
authored
CLOUDP-59015: Upload rpm to mongo yum repo (#78)
1 parent 6dbbd8b commit 0caad2e

File tree

3 files changed

+498
-18
lines changed

3 files changed

+498
-18
lines changed

.evergreen.yml

Lines changed: 196 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,6 @@ functions:
3131
WORKDIR: ${workdir}
3232
<<: *go_options
3333
command: make build
34-
"set up notary client credentials":
35-
- command: shell.exec
36-
params:
37-
working_dir: mongocli
38-
silent: true
39-
script: |
40-
set -o errexit
41-
cat <<EOF > notary_env.sh
42-
export NOTARY_TOKEN=${signing_auth_token}
43-
export BARQUE_USERNAME=${barque_user}
44-
export BARQUE_PASSWORD=${barque_password}
45-
EOF
46-
47-
echo "${signing_auth_token}" > signing_auth_token
4834
"gen-notices":
4935
- command: shell.exec
5036
type: setup
@@ -78,6 +64,84 @@ functions:
7864
env:
7965
<<: *go_options
8066
command: make package
67+
"set up remote credentials":
68+
command: shell.exec
69+
params:
70+
silent: true
71+
script: |
72+
set -o errexit
73+
# Since the macros 'private_key_remote' and 'private_key_file' are not always defined
74+
# we default to /dev/null to avoid syntax errors of an empty expansion.
75+
if [ ! -z "${private_key_remote}" ] && [ ! -z "${private_key_file}" ] ; then
76+
mkdir -p ~/.ssh
77+
echo -n "${private_key_remote}" > ${private_key_file|/dev/null}
78+
chmod 0600 ${private_key_file|/dev/null}
79+
fi
80+
# Ensure a clean aws configuration state
81+
rm -rf ~/.aws
82+
mkdir -p ~/.aws
83+
# If ${aws_profile_remote} is not specified then the config & credentials are
84+
# stored in the 'default' profile.
85+
aws_profile="${aws_profile_remote|default}"
86+
# The profile in the config file is specified as [profile <profile>], except
87+
# for [default], see http://boto3.readthedocs.io/en/latest/guide/configuration.html
88+
if [ $aws_profile = "default" ] ; then
89+
aws_profile_config="[default]"
90+
else
91+
aws_profile_config="[profile $aws_profile]"
92+
fi
93+
cat <<EOF >> ~/.aws/config
94+
$aws_profile_config
95+
region = us-east-1
96+
EOF
97+
# The profile in the credentials file is specified as [<profile>].
98+
cat <<EOF >> ~/.aws/credentials
99+
[$aws_profile]
100+
aws_access_key_id = ${aws_key_remote}
101+
aws_secret_access_key = ${aws_secret_remote}
102+
EOF
103+
"set up notary client credentials":
104+
- command: shell.exec
105+
params:
106+
working_dir: mongocli
107+
silent: true
108+
script: |
109+
set -o errexit
110+
111+
cat <<EOF > notary_env.sh
112+
export NOTARY_TOKEN=${signing_auth_token_44}
113+
export BARQUE_USERNAME=${barque_user}
114+
export BARQUE_PASSWORD=${barque_password}
115+
EOF
116+
117+
if [[ ! -f signing_auth_token_44 ]]; then
118+
echo "${signing_auth_token_44}" > signing_auth_token
119+
fi
120+
"push":
121+
- command: shell.exec
122+
params:
123+
working_dir: mongocli
124+
script: |
125+
. ./notary_env.sh
126+
127+
set -o errexit
128+
set -o verbose
129+
130+
CURATOR_RELEASE=${curator_release|"latest"}
131+
curl -L -O http://boxes.10gen.com/build/curator/curator-dist-rhel70-$CURATOR_RELEASE.tar.gz
132+
tar -zxvf curator-dist-rhel70-$CURATOR_RELEASE.tar.gz
133+
134+
# We get the raw version string (v1.2.3-45-gabcdef) from git
135+
VERSION=$(git describe --abbrev=7 | cut -d "v" -f 2)
136+
137+
./curator repo submit \
138+
--service ${barque_url} \
139+
--config .repo_config.yml \
140+
--distro ${distro} \
141+
--edition ${edition} \
142+
--version $VERSION \
143+
--arch x86_64 \
144+
--packages https://s3.amazonaws.com/mongodb-mongocli-build/${project}/${revision}/dist/mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.rpm
81145
tasks:
82146
- name: compile
83147
commands:
@@ -105,7 +169,7 @@ tasks:
105169
mv mongocli_next_linux_x86_64.deb mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.deb
106170
mv mongocli_next_linux_x86_64.rpm mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.rpm
107171
mv mongocli_next_linux_x86_64.tar.gz mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.tar.gz
108-
mv mongocli_next_macOS_x86_64.tar.gz mongocli_next_${revision}_${version_id}_${created_at}_macOS_x86_64.tar.gz
172+
mv mongocli_next_macos_x86_64.tar.gz mongocli_next_${revision}_${version_id}_${created_at}_macOS_x86_64.tar.gz
109173
mv mongocli_next_windows_i386.zip mongocli_next_${revision}_${version_id}_${created_at}_windows_i386.zip
110174
mv mongocli_next_windows_x86_64.zip mongocli_next_${revision}_${version_id}_${created_at}_windows_x86_64.zip
111175
- command: s3.put
@@ -121,12 +185,127 @@ tasks:
121185
bucket: mongodb-mongocli-build
122186
permissions: public-read
123187
content_type: ${content_type|application/x-gzip}
124-
188+
# RPM Distros
189+
- name: push_rhel70_enterprise
190+
# This should prevent this task from running in patch builds, where we
191+
# don't want to publish packages.
192+
patchable: false
193+
stepback: false
194+
tags: ["push"]
195+
depends_on:
196+
- name: compile
197+
- name: package
198+
commands:
199+
- func: "clone"
200+
- func: "set up remote credentials"
201+
vars:
202+
aws_key_remote: ${repo_aws_key}
203+
aws_secret_remote: ${repo_aws_secret}
204+
- func: "set up notary client credentials"
205+
- func: "push"
206+
vars:
207+
edition: enterprise
208+
distro: rhel70
209+
- name: push_rhel70_org
210+
# This should prevent this task from running in patch builds, where we
211+
# don't want to publish packages.
212+
patchable: false
213+
stepback: false
214+
tags: ["push"]
215+
depends_on:
216+
- name: package
217+
commands:
218+
- func: "clone"
219+
- func: "set up remote credentials"
220+
vars:
221+
aws_key_remote: ${repo_aws_key}
222+
aws_secret_remote: ${repo_aws_secret}
223+
- func: "set up notary client credentials"
224+
- func: "push"
225+
vars:
226+
edition: org
227+
distro: rhel70
228+
- name: push_rhel80_enterprise
229+
# This should prevent this task from running in patch builds, where we
230+
# don't want to publish packages.
231+
patchable: false
232+
stepback: false
233+
tags: ["push"]
234+
depends_on:
235+
- name: compile
236+
- name: package
237+
commands:
238+
- func: "clone"
239+
- func: "set up remote credentials"
240+
vars:
241+
aws_key_remote: ${repo_aws_key}
242+
aws_secret_remote: ${repo_aws_secret}
243+
- func: "set up notary client credentials"
244+
- func: "push"
245+
vars:
246+
edition: enterprise
247+
distro: rhel80
248+
- name: push_rhel80_org
249+
# This should prevent this task from running in patch builds, where we
250+
# don't want to publish packages.
251+
patchable: false
252+
stepback: false
253+
tags: ["push"]
254+
depends_on:
255+
- name: compile
256+
- name: package
257+
commands:
258+
- func: "clone"
259+
- func: "set up remote credentials"
260+
vars:
261+
aws_key_remote: ${repo_aws_key}
262+
aws_secret_remote: ${repo_aws_secret}
263+
- func: "set up notary client credentials"
264+
- func: "push"
265+
vars:
266+
edition: org
267+
distro: rhel80
268+
- name: push_amazon2_enterprise
269+
# This should prevent this task from running in patch builds, where we
270+
# don't want to publish packages.
271+
patchable: false
272+
stepback: false
273+
tags: ["push"]
274+
depends_on:
275+
- name: package
276+
commands:
277+
- func: "clone"
278+
- func: "set up notary client credentials"
279+
- func: "push"
280+
vars:
281+
edition: enterprise
282+
distro: amazon2
283+
- name: push_amazon2_org
284+
# This should prevent this task from running in patch builds, where we
285+
# don't want to publish packages.
286+
patchable: false
287+
stepback: false
288+
tags: ["push"]
289+
depends_on:
290+
- name: compile
291+
- name: package
292+
commands:
293+
- func: "clone"
294+
- func: "set up remote credentials"
295+
vars:
296+
aws_key_remote: ${repo_aws_key}
297+
aws_secret_remote: ${repo_aws_secret}
298+
- func: "set up notary client credentials"
299+
- func: "push"
300+
vars:
301+
edition: org
302+
distro: amazon2
125303
buildvariants:
126304
- name: publish
127-
display_name: Building & Publishing
305+
display_name: "Packaging & Publishing"
128306
run_on:
129307
- rhel70-small
130308
tasks:
131309
- name: compile
132310
- name: package
311+
- name: .push

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ builds:
1616
goarch: 386
1717
archives:
1818
- replacements:
19-
darwin: macOS
19+
darwin: macos
2020
386: i386
2121
amd64: x86_64
2222
format_overrides:

0 commit comments

Comments
 (0)