Skip to content

Commit 525940e

Browse files
authored
chore: remove generate msi task (#3926)
1 parent 84dd89e commit 525940e

File tree

8 files changed

+201
-178
lines changed

8 files changed

+201
-178
lines changed

build/ci/release.yml

Lines changed: 18 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ variables:
33
go_root: "/opt/golang/go1.24"
44
go_bin: "/opt/golang/go1.24/bin"
55
go_base_path: ""
6-
- &go_windows_version
7-
go_root: "c:\\golang\\go1.24"
8-
go_bin: "c:\\golang\\go1.24\\bin"
9-
go_base_path: "c:"
106
- &go_env
117
XDG_CONFIG_HOME: ${go_base_path}${workdir}
128
GO111MODULE: "on"
@@ -126,6 +122,7 @@ functions:
126122
ARTIFACTORY_PASSWORD: ${artifactory_password}
127123
GRS_USERNAME: ${garasign_username}
128124
GRS_PASSWORD: ${garasign_password}
125+
AUTHENTICODE_KEY_NAME: ${authenticode_key_name}
129126
GITHUB_TOKEN: ${github_token}
130127
include_expansions_in_env:
131128
- go_base_path
@@ -136,38 +133,6 @@ functions:
136133
- goreleaser_key
137134
- unstable
138135
binary: build/package/package.sh
139-
"install go-msi":
140-
- command: subprocess.exec
141-
type: setup
142-
params:
143-
working_dir: src/github.com/mongodb/mongodb-atlas-cli
144-
command: choco install -y "go-msi" --force
145-
"uninstall go-msi":
146-
- command: subprocess.exec
147-
type: setup
148-
params:
149-
working_dir: src/github.com/mongodb/mongodb-atlas-cli
150-
command: choco uninstall -y "go-msi"
151-
"generate msi":
152-
- command: subprocess.exec
153-
type: test
154-
params:
155-
<<: *go_options
156-
add_to_path:
157-
- ${go_bin}
158-
- ${go_base_path}${workdir}/bin
159-
- ${go_base_path}${workdir}/src/github.com/mongodb/mongodb-atlas-cli/bin
160-
- "/cygdrive/c/Program Files/go-msi"
161-
- "/cygdrive/c/wixtools/bin"
162-
env:
163-
<<: *go_env
164-
SECRET_API_KEY: ${chocolatey_api_key}
165-
ARTIFACTORY_USERNAME: ${artifactory_username}
166-
ARTIFACTORY_PASSWORD: ${artifactory_password}
167-
GRS_USERNAME: ${garasign_username}
168-
GRS_PASSWORD: ${garasign_password}
169-
unstable: ${unstable}
170-
command: bash.exe -c build/package/generate-msi.sh
171136
"rename pkg":
172137
- command: subprocess.exec
173138
type: test
@@ -368,74 +333,39 @@ functions:
368333
shell: bash
369334
script: |
370335
./run-copybara.sh
336+
"create-windows-host":
337+
- command: host.create
338+
params:
339+
distro: windows-vsCurrent-small
340+
- command: host.list
341+
params:
342+
wait: true
343+
num_hosts: 1
344+
path: ${workdir}/src/github.com/mongodb/mongodb-atlas-cli/build/ci/hosts.json
345+
- command: shell.exec
346+
params:
347+
<<: *go_options
348+
script: |
349+
set -Eeou pipefail
350+
echo "${__project_aws_ssh_key_value}" > ./build/ci/ssh_id
351+
chmod 0600 ./build/ci/ssh_id
371352
tasks:
372-
- name: package_msi
373-
tags: ["packaging"]
374-
depends_on:
375-
- name: compile
376-
variant: "code_health"
377-
commands:
378-
- func: "install go-msi"
379-
- func: "generate msi"
380-
vars:
381-
unstable: ${unstable}
382-
- func: "uninstall go-msi"
383-
- command: s3.put
384-
params:
385-
aws_key: ${aws_key}
386-
aws_secret: ${aws_secret}
387-
local_files_include_filter:
388-
- src/github.com/mongodb/mongodb-atlas-cli/bin/*.exe
389-
- src/github.com/mongodb/mongodb-atlas-cli/dist/*.msi
390-
remote_file: ${project}/dist/${revision}_${created_at}/unsigned_
391-
bucket: mongodb-mongocli-build
392-
permissions: public-read
393-
content_type: ${content_type|application/octet-stream}
394-
display_name: unsigned
395353
- name: package_goreleaser
396354
tags: ["packaging"]
397355
depends_on:
398356
- name: compile
399357
variant: "code_health"
400358
commands:
359+
- func: "create-windows-host"
401360
- func: "generate sbom"
402361
- func: "run silkbomb"
403362
- func: "generate notices"
404363
- func: "install goreleaser"
405364
- func: "install macos notarization service"
406365
- func: "install gh-token"
407-
- command: subprocess.exec
408-
type: test
409-
params:
410-
working_dir: src/github.com/mongodb/mongodb-atlas-cli
411-
include_expansions_in_env:
412-
- project
413-
- revision
414-
- created_at
415-
env:
416-
BUCKET: mongodb-mongocli-build
417-
unstable: ${unstable}
418-
binary: build/package/download-win-binaries.sh
419-
- command: subprocess.exec
420-
type: test
421-
params:
422-
include_expansions_in_env:
423-
- unstable
424-
env:
425-
ARTIFACTORY_USERNAME: ${artifactory_username}
426-
ARTIFACTORY_PASSWORD: ${artifactory_password}
427-
GRS_USERNAME: ${garasign_username}
428-
GRS_PASSWORD: ${garasign_password}
429-
AUTHENTICODE_KEY_NAME: ${authenticode_key_name}
430-
working_dir: src/github.com/mongodb/mongodb-atlas-cli
431-
binary: build/package/windows_notarize.sh
432366
- func: "package"
433367
vars:
434368
unstable: ${unstable}
435-
ARTIFACTORY_USERNAME: ${artifactory_username}
436-
ARTIFACTORY_PASSWORD: ${artifactory_password}
437-
GRS_USERNAME: ${garasign_username}
438-
GRS_PASSWORD: ${garasign_password}
439369
- func: "rename pkg"
440370
vars:
441371
unstable: ${unstable}
@@ -561,15 +491,6 @@ tasks:
561491
gh_token: ${cloud_docs_token}
562492
workflow: cloud-docs
563493
buildvariants:
564-
- name: go_atlascli_msi_snapshot
565-
display_name: "Packaging AtlasCLI (go-msi)"
566-
run_on:
567-
- windows-vsCurrent-small
568-
expansions:
569-
<<: *go_windows_version
570-
unstable: -unstable
571-
tasks:
572-
- name: package_msi
573494
- name: goreleaser_atlascli_snapshot
574495
display_name: "Packaging AtlasCLI (goreleaser)"
575496
run_on:
@@ -584,9 +505,6 @@ buildvariants:
584505
unstable: -unstable
585506
tasks:
586507
- name: package_goreleaser
587-
depends_on:
588-
- name: package_msi
589-
variant: "go_atlascli_msi_snapshot"
590508
- name: publish_atlascli_snapshot
591509
display_name: "Publish AtlasCLI Snapshot"
592510
run_on:
@@ -609,9 +527,6 @@ buildvariants:
609527
meta_package_name: "mongodb-atlas"
610528
tasks:
611529
- name: package_goreleaser
612-
depends_on:
613-
- name: package_msi
614-
variant: release_atlascli_msi
615530
- name: copybara
616531
display_name: "Copybara"
617532
git_tag_only: true
@@ -623,17 +538,6 @@ buildvariants:
623538
<<: *go_linux_version
624539
tasks:
625540
- name: copybara
626-
- name: release_atlascli_msi
627-
display_name: "Release AtlasCLI (go-msi)"
628-
run_on:
629-
- windows-vsCurrent-small
630-
git_tag_only: true
631-
tags:
632-
- foliage_health
633-
expansions:
634-
<<: *go_windows_version
635-
tasks:
636-
- name: package_msi
637541
- name: release_atlascli_publish
638542
display_name: "Publish AtlasCLI Generator"
639543
run_on:

build/ci/ssh-ready.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 MongoDB Inc
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euo pipefail
18+
19+
declare -i attempts
20+
declare -i connection_attempts
21+
declare -ri timeout=10
22+
23+
while getopts 'i:h:t:u:' opt; do
24+
case ${opt} in
25+
i) keyfile="${OPTARG}" ;; # SSH identity file
26+
u) user="${OPTARG}" ;; # Username on the remote host
27+
h) hostsfile="${OPTARG}" ;; # Output of Evergreen host.list
28+
t) connection_attempts="${OPTARG}" ;; # How many times to attempt to connect via SSH
29+
*)
30+
echo "Invalid option"
31+
exit 1
32+
;;
33+
esac
34+
done
35+
36+
hosts=$(
37+
cat <<EOF | python - "$hostsfile"
38+
import sys
39+
import json
40+
with open(sys.argv[1]) as hostsfile:
41+
hosts = json.load(hostsfile)
42+
for host in hosts:
43+
print(host["dns_name"])
44+
EOF
45+
)
46+
47+
attempts=0
48+
connection_attempts=${connection_attempts:-60} # Total timeout = timeout * timeout_attempts
49+
50+
for host in $hosts; do
51+
set +e
52+
echo "Waiting for $host to become available..."
53+
while ! ssh -i "$keyfile" -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -tt "${user}@${host}" exit 2>/dev/null; do
54+
if [[ "${attempts}" -ge "${connection_attempts}" ]]; then
55+
echo 'Connect to spawn host failed'
56+
exit 1
57+
fi
58+
((attempts++))
59+
60+
echo "SSH connection attempt $attempts/$connection_attempts failed. Retrying ($host)..."
61+
# sleep for Permission denied (publickey) errors
62+
sleep "$timeout"
63+
done
64+
set -e
65+
done

build/package/.goreleaser.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@ builds:
2828
- cmd: ./build/package/mac_notarize.sh
2929
output: true
3030
- <<: *build_defaults
31-
builder: prebuilt
3231
id: windows
3332
goos: [windows]
3433
goarch: [amd64]
3534
goamd64: [v1]
36-
prebuilt:
37-
path: ./bin/atlas.exe
35+
hooks:
36+
post:
37+
- cmd: ./build/package/windows_notarize.sh
38+
output: true
39+
- cmd: ./build/package/windows_build_msi.sh
40+
output: true
3841
gomod: # https://goreleaser.com/customization/verifiable_builds/
3942
# Proxy a module from proxy.golang.org, making the builds verifiable.
4043
# This will only be effective if running against a tag. Snapshots will ignore

build/package/generate-msi.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

build/package/msi/generate-msi.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2020 MongoDB Inc
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -Eeou pipefail
17+
18+
GOROOT="$(cygpath --unix "c:\\golang\\go1.24")"
19+
PATH="${PATH}:$(cygpath --unix "c:\\golang\\go1.24\\bin"):$(cygpath --unix "c:\\Program Files\\go-msi"):$(cygpath --unix "c:\\wixtools\\bin")"
20+
GOCACHE="$(cygpath --unix "c:\\Users\\Administrator\\.cache")"
21+
CGO_ENABLED=0
22+
23+
export GOROOT PATH GOCACHE CGO_ENABLED
24+
25+
choco install -y "go-msi" --force
26+
27+
go-msi make --path "wix.json" --msi "out.msi" --version "$(cat version.txt)"
28+
29+
choco uninstall -y "go-msi" --force
30+
31+
rm -rf "$GOCACHE"

build/package/wix/atlascli.json renamed to build/package/msi/wix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"guid": "cac1e5b1-6547-4c47-a68c-17a5b84dd87b",
88
"items": [
99
"bin/atlas.exe",
10-
"build/package/msi/installer"
10+
"installer"
1111
]
1212
},
1313
"env": {

0 commit comments

Comments
 (0)