Skip to content

Commit 4508fd6

Browse files
authored
CLOUDP-326355: Add extra release checks (#4046)
1 parent de097ec commit 4508fd6

File tree

3 files changed

+96
-16
lines changed

3 files changed

+96
-16
lines changed

build/ci/check-release-files.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env 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 -Eeou pipefail
18+
19+
if [[ -z "${version}" ]]; then
20+
echo "version environment variable is not set"
21+
exit 1
22+
fi
23+
24+
# shellcheck disable=SC2154 # unstable is set by evergreen
25+
if [[ "${unstable}" == "-unstable" ]]; then
26+
version="${version}-next"
27+
fi
28+
29+
REQUIRED_FILES=(
30+
"dist/mongodb-atlas-cli_${version}_linux_arm64.deb"
31+
"dist/mongodb-atlas-cli_${version}_linux_arm64.deb.sig"
32+
"dist/mongodb-atlas-cli_${version}_linux_arm64.rpm"
33+
"dist/mongodb-atlas-cli_${version}_linux_arm64.rpm.sig"
34+
"dist/mongodb-atlas-cli_${version}_linux_arm64.tar.gz"
35+
"dist/mongodb-atlas-cli_${version}_linux_arm64.tar.gz.sig"
36+
"dist/mongodb-atlas-cli_${version}_linux_x86_64.deb"
37+
"dist/mongodb-atlas-cli_${version}_linux_x86_64.deb.sig"
38+
"dist/mongodb-atlas-cli_${version}_linux_x86_64.rpm"
39+
"dist/mongodb-atlas-cli_${version}_linux_x86_64.rpm.sig"
40+
"dist/mongodb-atlas-cli_${version}_linux_x86_64.tar.gz"
41+
"dist/mongodb-atlas-cli_${version}_linux_x86_64.tar.gz.sig"
42+
"dist/mongodb-atlas-cli_${version}_macos_arm64.zip"
43+
"dist/mongodb-atlas-cli_${version}_macos_x86_64.zip"
44+
"dist/mongodb-atlas-cli_${version}_windows_x86_64.msi"
45+
"dist/mongodb-atlas-cli_${version}_windows_x86_64.zip"
46+
"sbom.json"
47+
)
48+
49+
for file in "${REQUIRED_FILES[@]}"; do
50+
if [[ ! -f "${file}" ]]; then
51+
echo "${file} is missing"
52+
exit 1
53+
fi
54+
done

build/ci/release.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,29 @@ functions:
350350
set -Eeou pipefail
351351
echo "${__project_aws_ssh_key_value}" > ./build/ci/ssh_id
352352
chmod 0600 ./build/ci/ssh_id
353+
"check-git-dirty":
354+
- command: shell.exec
355+
params:
356+
<<: *go_options
357+
script: |
358+
set -Eeou pipefail
359+
git checkout -- dist/.keep
360+
OUTPUT=$(git status --porcelain)
361+
if [ -z "$OUTPUT" ]; then
362+
echo "Git is clean"
363+
else
364+
echo "Git is dirty"
365+
echo "$OUTPUT"
366+
exit 1
367+
fi
368+
"check-required-files":
369+
- command: subprocess.exec
370+
params:
371+
<<: *go_options
372+
include_expansions_in_env:
373+
- unstable
374+
- version
375+
binary: build/ci/check-release-files.sh
353376
tasks:
354377
- name: package_goreleaser
355378
tags: ["packaging"]
@@ -417,15 +440,14 @@ tasks:
417440
- src/github.com/mongodb/mongodb-atlas-cli/dist/*.sig
418441
remote_file: mongocli/
419442
build_variants:
420-
- release_mongocli_github
421443
- release_atlascli_github
422444
bucket: cdn-origin-mongocli
423445
permissions: private
424446
content_type: ${content_type|application/x-gzip}
425447
display_name: downloads-center-
448+
- func: "check-required-files"
449+
- func: "check-git-dirty"
426450
- func: "trace artifacts"
427-
vars:
428-
unstable: ${unstable}
429451
- func: "send slack notification"
430452
- name: push_atlascli_generate
431453
patchable: false

build/package/linux_notarize.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@ 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 part of a custom publisher.
2222

23-
echo "GRS_CONFIG_USER1_USERNAME=${GRS_USERNAME}" >> "signing-envfile"
23+
if [[ ! -f "${artifact:?}" ]]; then
24+
echo "artifact ${artifact} does not exist"
25+
exit 1
26+
fi
27+
28+
echo "GRS_CONFIG_USER1_USERNAME=${GRS_USERNAME}" > "signing-envfile"
2429
echo "GRS_CONFIG_USER1_PASSWORD=${GRS_PASSWORD}" >> "signing-envfile"
2530

26-
if [[ -f "${artifact:?}" ]]; then
27-
echo "${ARTIFACTORY_PASSWORD}" | podman login --password-stdin --username "${ARTIFACTORY_USERNAME}" artifactory.corp.mongodb.com
31+
echo "${ARTIFACTORY_PASSWORD}" | podman login --password-stdin --username "${ARTIFACTORY_USERNAME}" artifactory.corp.mongodb.com
2832

29-
echo "notarizing Linux binary ${artifact}"
33+
echo "notarizing Linux binary ${artifact}"
3034

31-
podman run \
32-
--env-file=signing-envfile \
33-
--rm \
34-
-v "$(pwd)":"$(pwd)" \
35-
-w "$(pwd)" \
36-
artifactory.corp.mongodb.com/release-tools-container-registry-local/garasign-gpg \
37-
/bin/bash -c "gpgloader && gpg --yes -v --armor -o ${artifact}.sig --detach-sign ${artifact}"
38-
fi
35+
podman run \
36+
--env-file=signing-envfile \
37+
--rm \
38+
-v "$(pwd)":"$(pwd)" \
39+
-w "$(pwd)" \
40+
artifactory.corp.mongodb.com/release-tools-container-registry-local/garasign-gpg \
41+
/bin/bash -c "gpgloader && gpg --yes -v --armor -o ${artifact}.sig --detach-sign ${artifact}"
3942

40-
echo "Signing of ${artifact} completed."
43+
rm -rf signing-envfile
4144

45+
echo "Signing of ${artifact} completed."

0 commit comments

Comments
 (0)