Skip to content

Commit 0babae6

Browse files
authored
fix notarizing code (#277)
* use correct go version, and use correct paths * only trigger on git tags
1 parent b0a80fa commit 0babae6

File tree

3 files changed

+15
-37
lines changed

3 files changed

+15
-37
lines changed

.evergreen.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
variables:
2-
2+
- &go_env
3+
XDG_CONFIG_HOME: ${go_base_path}${workdir}
4+
GO111MODULE: "on"
5+
GOROOT: "/opt/golang/go1.21"
36
functions:
47

58
"clone":
@@ -42,24 +45,27 @@ functions:
4245
type: setup
4346
params:
4447
working_dir: src/github.com/mongodb/mongodb-enterprise-kubernetes/tools/multicluster
45-
add_to_path:
46-
- src/github.com/mongodb/tools
47-
- src/github.com/mongodb/tools/linux_amd64
4848
include_expansions_in_env:
4949
- GITHUB_TOKEN
5050
- macos_notary_keyid
5151
- macos_notary_secret
5252
- workdir
53+
- triggered_by_git_tag
5354
env:
55+
<<: *go_env
5456
MACOS_NOTARY_KEY: ${macos_notary_keyid}
5557
MACOS_NOTARY_SECRET: ${macos_notary_secret}
58+
GORELEASER_CURRENT_TAG: ${triggered_by_git_tag}
59+
# shell.exec EVG Task doesn't have add_to_path, so we need to explicitly add the path export below.
5660
script: |
5761
set -Eeu pipefail
58-
59-
${workdir}/goreleaser release
62+
63+
export PATH=$GOROOT/bin:$PATH
64+
${workdir}/goreleaser release --rm-dist
6065
6166
tasks:
6267
- name: package_goreleaser
68+
git_tag_only: true
6369
tags: ["packaging"]
6470
commands:
6571
- func: "clone"

.github/workflows/release-multicluster-cli.yaml

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

tools/multicluster/kubectl_mac_notarize.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -Eeou pipefail
2020
# This depends on binaries being generated in a goreleaser manner and gon being set up.
2121
# goreleaser should already take care of calling this script as a hook.
2222

23-
if [[ -f "./dist/kubectl-mongodb_darwin_arm64/kubectl-mongodb" && -f "./dist/kubectl-mongodb_darwin_amd64_v1/kubectl-mongodb" && ! -f "./dist/kubectl-mongodb_macos_signed.zip" ]]; then
23+
if [[ -f "./dist/kubectl-mongodb_darwin_amd64_v1/kubectl-mongodb" && -f "./dist/kubectl-mongodb_darwin_arm64/kubectl-mongodb" && ! -f "./dist/kubectl-mongodb_macos_signed.zip" ]]; then
2424
echo "notarizing macOs binaries"
2525
zip -r ./dist/kubectl-mongodb_amd64_arm64_bin.zip ./dist/kubectl-mongodb_darwin_amd64_v1/kubectl-mongodb ./dist/kubectl-mongodb_darwin_arm64/kubectl-mongodb # The Notarization Service takes an archive as input
2626
"${workdir:-.}"/linux_amd64/macnotary \
@@ -30,6 +30,6 @@ if [[ -f "./dist/kubectl-mongodb_darwin_arm64/kubectl-mongodb" && -f "./dist/kub
3030
-o ./dist/kubectl-mongodb_macos_signed.zip
3131

3232
echo "replacing original files"
33-
unzip -oj ./dist/kubectl-mongodb_macos_signed.zip dist/macos_darwin_amd64_v1/kubectl-mongodb -d ./dist/macos_darwin_amd64_v1/
34-
unzip -oj ./dist/kubectl-mongodb_macos_signed.zip dist/macos_darwin_arm64/kubectl-mongodb -d ./dist/macos_darwin_arm64/
33+
unzip -oj ./dist/kubectl-mongodb_macos_signed.zip dist/kubectl-mongodb_darwin_amd64_v1/kubectl-mongodb -d ./dist/kubectl-mongodb_darwin_amd64_v1/
34+
unzip -oj ./dist/kubectl-mongodb_macos_signed.zip dist/kubectl-mongodb_darwin_arm64/kubectl-mongodb -d ./dist/kubectl-mongodb_darwin_arm64/
3535
fi

0 commit comments

Comments
 (0)