Skip to content

Commit a3711a0

Browse files
authored
CLOUDP-59024: List MongoCLI in Download Center (#161)
1 parent 78b1df4 commit a3711a0

File tree

4 files changed

+74
-31
lines changed

4 files changed

+74
-31
lines changed

.evergreen.yml

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,39 @@ functions:
1919
- command: git.get_project
2020
type: setup
2121
params:
22-
directory: mongocli
22+
directory: src/github.com/mongodb/mongocli
2323
"build":
2424
- command: subprocess.exec
2525
type: test
2626
params:
2727
add_to_path:
2828
- *go_bin
29-
working_dir: mongocli
29+
working_dir: src/github.com/mongodb/mongocli
3030
env:
3131
WORKDIR: ${workdir}
3232
<<: *go_options
3333
command: make build
34-
"gen-notices":
34+
"generate notices":
3535
- command: shell.exec
3636
type: setup
3737
params:
38-
working_dir: mongocli
3938
script: |
4039
set -ex
4140
export GOROOT="/opt/golang/go1.14"
42-
mkdir go-licenses
43-
export GOPATH=${workdir}/go-licenses
41+
export GOPATH=$(pwd)
4442
export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"
43+
mkdir -p github.com/google/go-licenses
44+
pushd github.com/google/go-licenses
4545
46-
go get -u github.com/google/go-licenses
46+
go get github.com/google/go-licenses
47+
popd
48+
cd src/github.com/mongodb/mongocli
4749
go-licenses save "github.com/mongodb/mongocli" --save_path=third_party_notices
4850
"fetch goreleaser":
4951
- command: shell.exec
5052
type: setup
5153
params:
52-
working_dir: mongocli
54+
working_dir: src/github.com/mongodb/mongocli
5355
script: |
5456
set -ex
5557
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
@@ -60,14 +62,26 @@ functions:
6062
add_to_path:
6163
- *go_bin
6264
- ./bin
63-
working_dir: mongocli
65+
working_dir: src/github.com/mongodb/mongocli
6466
env:
6567
<<: *go_options
6668
command: make package
67-
"gen_repo_data":
69+
"release":
70+
- command: subprocess.exec
71+
type: setup
72+
params:
73+
add_to_path:
74+
- *go_bin
75+
- ./bin
76+
working_dir: src/github.com/mongodb/mongocli
77+
env:
78+
GITHUB_TOKEN: ${github_token}
79+
<<: *go_options
80+
command: make release
81+
"rename bin for curator":
6882
- command: shell.exec
6983
params:
70-
working_dir: mongocli/dist
84+
working_dir: src/github.com/mongodb/mongocli/dist
7185
script: |
7286
set -o xtrace
7387
set -o errexit
@@ -81,10 +95,10 @@ functions:
8195
mv apt/mongocli_next_linux_x86_64.deb apt/mongodb-cli-unstable_$VERSION~latest_amd64.deb
8296
cp mongocli_next_linux_x86_64.rpm yum/
8397
mv yum/mongocli_next_linux_x86_64.rpm yum/mongodb-cli-unstable-$VERSION.latest.x86_64.rpm
84-
"gen_download_archive":
98+
"generate download archive json":
8599
- command: shell.exec
86100
params:
87-
working_dir: mongocli/dist
101+
working_dir: src/github.com/mongodb/mongocli/dist
88102
script: |
89103
set -o xtrace
90104
set -o errexit
@@ -96,7 +110,7 @@ functions:
96110
"set up notary client credentials":
97111
- command: shell.exec
98112
params:
99-
working_dir: mongocli
113+
working_dir: src/github.com/mongodb/mongocli
100114
silent: true
101115
script: |
102116
set -o errexit
@@ -113,7 +127,7 @@ functions:
113127
"push":
114128
- command: shell.exec
115129
params:
116-
working_dir: mongocli
130+
working_dir: src/github.com/mongodb/mongocli
117131
script: |
118132
. ./notary_env.sh
119133
@@ -150,38 +164,64 @@ tasks:
150164
- name: compile
151165
commands:
152166
- func: "clone"
153-
- func: "gen-notices"
167+
- func: "generate notices"
154168
- func: "fetch goreleaser"
155169
- func: "package"
156-
- func: "gen_repo_data"
157-
- func: "gen_download_archive"
170+
- func: "rename bin for curator"
171+
- func: "generate download archive json"
158172
- command: archive.targz_pack
159173
params:
160-
target: mongocli/dist/deb.tgz
161-
source_dir: mongocli/dist/apt
174+
target: src/github.com/mongodb/mongocli/dist/deb.tgz
175+
source_dir: src/github.com/mongodb/mongocli/dist/apt
162176
include:
163177
- "*.deb"
164178
- command: archive.targz_pack
165179
params:
166-
target: mongocli/dist/rpm.tgz
167-
source_dir: mongocli/dist/yum
180+
target: src/github.com/mongodb/mongocli/dist/rpm.tgz
181+
source_dir: src/github.com/mongodb/mongocli/dist/yum
168182
include:
169183
- "*.rpm"
170184
- command: s3.put
171185
params:
172186
aws_key: ${aws_key}
173187
aws_secret: ${aws_secret}
174188
local_files_include_filter:
175-
- mongocli/dist/*.tar.gz
176-
- mongocli/dist/*.zip
177-
- mongocli/dist/*.deb
178-
- mongocli/dist/*.rpm
179-
- mongocli/dist/*.tgz
180-
- mongocli/dist/*.json
189+
- src/github.com/mongodb/mongocli/dist/*.tar.gz
190+
- src/github.com/mongodb/mongocli/dist/*.zip
191+
- src/github.com/mongodb/mongocli/dist/*.deb
192+
- src/github.com/mongodb/mongocli/dist/*.rpm
193+
- src/github.com/mongodb/mongocli/dist/*.tgz
194+
- src/github.com/mongodb/mongocli/dist/*.json
181195
remote_file: ${project}/dist/${build_id}/
182196
bucket: mongodb-mongocli-build
183197
permissions: public-read
184198
content_type: ${content_type|application/x-gzip}
199+
- name: release
200+
stepback: false
201+
patch_only: true
202+
depends_on:
203+
- name: compile
204+
commands:
205+
- func: "clone"
206+
- func: "generate notices"
207+
- func: "fetch goreleaser"
208+
- func: "release"
209+
- func: "generate download archive json"
210+
- command: s3.put
211+
params:
212+
aws_key: ${download_center_aws_key}
213+
aws_secret: ${download_center_aws_secret}
214+
local_files_include_filter:
215+
- src/github.com/mongodb/mongocli/dist/*.tar.gz
216+
- src/github.com/mongodb/mongocli/dist/*.zip
217+
- src/github.com/mongodb/mongocli/dist/*.deb
218+
- src/github.com/mongodb/mongocli/dist/*.rpm
219+
- src/github.com/mongodb/mongocli/dist/*.tgz
220+
- src/github.com/mongodb/mongocli/dist/*.json
221+
remote_file: ${project}/dist/${build_id}/
222+
bucket: downloads.mongodb.org
223+
permissions: public-read
224+
content_type: ${content_type|application/x-gzip}
185225
# RPM Distros
186226
- name: push_rhel70_enterprise
187227
# This should prevent this task from running in patch builds, where we
@@ -490,4 +530,5 @@ buildvariants:
490530
tasks:
491531
- name: compile
492532
- name: package
533+
- name: release
493534
- name: .push

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ dist/
99
# Test binary, built with `go test -c`
1010
*.test
1111

12+
.gocache/
13+
1214
# Output of the go coverage tool, specifically when used with LiteIDE
1315
*.out
1416

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ package: ## Use goreleaser to generate evergreen builds
113113
goreleaser --rm-dist --snapshot
114114

115115
.PHONY: release
116-
release: gen-notices ## Use goreleaser to generate builds and publish
116+
release: ## Use goreleaser to generate builds and publish
117117
@echo "==> Releasing"
118118
goreleaser --rm-dist
119119

internal/release/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func newPlatform(version, arch, system, distro, format string) *Platform { //nol
5757
Title: "MongoDB CLI",
5858
Links: []Link{
5959
{
60-
DownloadLink: fmt.Sprintf("https://downloads.mongodb.com/on-prem-mms/mcli/mongocli_%s_%s_%s.%s", version, system, arch, format),
60+
DownloadLink: fmt.Sprintf("https://fastdl.mongodb.org/mongocli/mongocli_%s_%s_%s.%s", version, system, arch, format),
6161
Name: format,
6262
},
6363
},
@@ -94,7 +94,7 @@ func generateFile(name, version string) error {
9494
*newPlatform(version, "x86_64", "linux", "Debian 9 / Ubuntu 16.04 + 18.04", "deb"),
9595
*newPlatform(version, "x86_64", "linux", "Red Hat + CentOS 6, 7, 8 / SUSE 12 + 15 / Amazon Linux", "rpm"),
9696
*newPlatform(version, "x86_64", "windows", "Microsoft Windows", "zip"),
97-
*newPlatform(version, "x86_64", "macOS", "macOS", "tar.gz"),
97+
*newPlatform(version, "x86_64", "macos", "macOS", "tar.gz"),
9898
*newPlatform(version, "x86_64", "linux", "Linux (x86_64)", "tar.gz"),
9999
},
100100
}

0 commit comments

Comments
 (0)