diff --git a/build/ci/evergreen.yml b/build/ci/evergreen.yml index c633aef9c5..ecedaae19e 100644 --- a/build/ci/evergreen.yml +++ b/build/ci/evergreen.yml @@ -216,28 +216,19 @@ functions: working_dir: src/github.com/mongodb/mongocli command: choco uninstall -y "go-msi" "generate msi": - - command: shell.exec + - command: subprocess.exec type: test params: working_dir: src/github.com/mongodb/mongocli - script: | - set -Eeou pipefail - - export GOROOT="${go_root}" - export GOCACHE="$(cygpath --mixed "${workdir}\.gocache")" - export CGO_ENABLED=0 - export GOMSI="/cygdrive/c/Program Files/go-msi" - export PATH="$GOMSI:/cygdrive/c/wixtools/bin:$GOROOT\bin:$PATH" - - go-msi check-env - - VERSION=$(git describe | cut -d "v" -f 2) - - env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X github.com/mongodb/mongocli/internal/version.Version=$VERSION" -o mongocli.exe - - mkdir -p build - - go-msi make --msi "dist/mongocli_$VERSION.msi" --version $VERSION + add_to_path: + - ${go_bin} + - "/cygdrive/c/Program Files/go-msi" + - "/cygdrive/c/wixtools/bin" + include_expansions_in_env: + - workdir + env: + <<: *go_options + command: bash.exe -c build/package/generate-msi.sh "rename pkg": - command: subprocess.exec type: test @@ -266,6 +257,25 @@ functions: VERSION=$(git describe | cut -d "v" -f 2) go run ../internal/release/main.go "$VERSION" + "upload dist": + - command: s3.put + params: + aws_key: ${aws_key} + aws_secret: ${aws_secret} + local_files_include_filter: + - src/github.com/mongodb/mongocli/dist/*.tar.gz + - src/github.com/mongodb/mongocli/dist/*.zip + - src/github.com/mongodb/mongocli/dist/*.deb + - src/github.com/mongodb/mongocli/dist/*.rpm + - src/github.com/mongodb/mongocli/dist/*.tgz + - src/github.com/mongodb/mongocli/dist/*.json + - src/github.com/mongodb/mongocli/dist/*.rb + - src/github.com/mongodb/mongocli/dist/*.msi + remote_file: ${project}/dist/${revision}_${created_at}/ + bucket: mongodb-mongocli-build + permissions: public-read + content_type: ${content_type|application/x-gzip} + display_name: inernal-bucket "set up notary client credentials": - command: shell.exec params: @@ -400,21 +410,7 @@ tasks: include: - "*.rpm" - func: "generate download archive json" - - command: s3.put - params: - aws_key: ${aws_key} - aws_secret: ${aws_secret} - local_files_include_filter: - - src/github.com/mongodb/mongocli/dist/*.tar.gz - - src/github.com/mongodb/mongocli/dist/*.zip - - src/github.com/mongodb/mongocli/dist/*.deb - - src/github.com/mongodb/mongocli/dist/*.rpm - - src/github.com/mongodb/mongocli/dist/*.tgz - - src/github.com/mongodb/mongocli/dist/*.json - remote_file: ${project}/dist/${revision}_${created_at}/ - bucket: mongodb-mongocli-build - permissions: public-read - content_type: ${content_type|application/x-gzip} + - func: "upload dist" - name: release stepback: false patch_only: true @@ -444,10 +440,11 @@ tasks: include: - "*.rpm" - func: "generate download archive json" + - func: "upload dist" - command: s3.put params: - aws_key: ${aws_key} - aws_secret: ${aws_secret} + aws_key: ${download_center_aws_key} + aws_secret: ${download_center_aws_secret} local_files_include_filter: - src/github.com/mongodb/mongocli/dist/*.tar.gz - src/github.com/mongodb/mongocli/dist/*.zip @@ -455,23 +452,29 @@ tasks: - src/github.com/mongodb/mongocli/dist/*.rpm - src/github.com/mongodb/mongocli/dist/*.tgz - src/github.com/mongodb/mongocli/dist/*.json - - src/github.com/mongodb/mongocli/dist/*.rb - remote_file: ${project}/dist/${revision}_${created_at}/ - bucket: mongodb-mongocli-build + remote_file: mongocli/ + bucket: downloads.mongodb.org permissions: public-read content_type: ${content_type|application/x-gzip} - display_name: inernal-bucket- + display_name: downloads-center- + - name: release_msi + stepback: false + patch_only: true + depends_on: + - name: compile + variant: "code_health" + commands: + - func: "clone" + - func: "install go-msi" + - func: "generate msi" + - func: "uninstall go-msi" + - func: "upload dist" - command: s3.put params: aws_key: ${download_center_aws_key} aws_secret: ${download_center_aws_secret} local_files_include_filter: - - src/github.com/mongodb/mongocli/dist/*.tar.gz - - src/github.com/mongodb/mongocli/dist/*.zip - - src/github.com/mongodb/mongocli/dist/*.deb - - src/github.com/mongodb/mongocli/dist/*.rpm - - src/github.com/mongodb/mongocli/dist/*.tgz - - src/github.com/mongodb/mongocli/dist/*.json + - src/github.com/mongodb/mongocli/dist/*.msi remote_file: mongocli/ bucket: downloads.mongodb.org permissions: public-read @@ -953,3 +956,12 @@ buildvariants: - name: .push_stable run_on: - rhel70-small + - name: release_msi + display_name: "Release (go-msi)" + run_on: + - windows-64-vs2017-compile + expansions: + go_root: "c:\\golang\\go1.14" + go_bin: "c:\\golang\\go1.14/bin" + tasks: + - name: release_msi diff --git a/build/package/generate-msi.sh b/build/package/generate-msi.sh new file mode 100755 index 0000000000..2ea0ad9e2a --- /dev/null +++ b/build/package/generate-msi.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Copyright 2020 MongoDB Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +set -Eeou pipefail + +export GOCACHE="$(cygpath --mixed "${workdir}\.gocache")" +export CGO_ENABLED=0 + +go-msi check-env + +VERSION=$(git describe | cut -d "v" -f 2) + +env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X github.com/mongodb/mongocli/internal/version.Version=${VERSION}" -o ./bin/mongocli.exe + +go-msi make --msi "dist/mongocli_${VERSION}_windows_x86_64.msi" --version ${VERSION} diff --git a/wix.json b/wix.json index a532856dfe..590569e3a5 100644 --- a/wix.json +++ b/wix.json @@ -6,7 +6,7 @@ "files": { "guid": "c7b0df57-c3c1-4591-becd-f0f73a912eb8", "items": [ - "mongocli.exe" + "bin/mongocli.exe" ] }, "env": {