Skip to content

task: Update msi packaging #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 58 additions & 46 deletions build/ci/evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -444,34 +440,41 @@ 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
- 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
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
Expand Down Expand Up @@ -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
28 changes: 28 additions & 0 deletions build/package/generate-msi.sh
Original file line number Diff line number Diff line change
@@ -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}
2 changes: 1 addition & 1 deletion wix.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"files": {
"guid": "c7b0df57-c3c1-4591-becd-f0f73a912eb8",
"items": [
"mongocli.exe"
"bin/mongocli.exe"
]
},
"env": {
Expand Down