blob: 4eda48ad420e51df57155842a6277475089b2f74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#!/usr/bin/env bash
# This script does the following:
# 1. Fetch the latest metadata for the provided version and platforms.
# 2. Set the `rollout` fraction to the provided value in [0, 1].
# 3. Sign and upload the updated metadata files.
#
# * You need to put the private ed25519 signing key in the clipboard before running this script.
set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
REPO_ROOT=../../../
$REPO_ROOT/scripts/utils/commit-verification
if [ $# -lt 5 ]; then
echo "Please provide the following arguments:"
echo " $(basename "$0") \\"
echo " <build server SSH destination> \\"
echo " <metadata server SSH destination> \\"
echo " <product version> \\"
echo " <rollout> \\"
echo " <..platforms> \\"
echo ""
echo "Note that the metadata server SSH destination is part of the rsync command executed on the build server and will be checked against the SSH config of build@\$buildserver_host."
exit 1
fi
# The hostname (can be the alias in your ~/.ssh/config) of the build server
BUILDSERVER_HOST=$1
# The server to upload the metadata to *from* the build server (argument above)
METADATA_SERVER_HOST=$2
PRODUCT_VERSION=$3
ROLLOUT=$4
shift 4; # past the first arguments
# the trailing arguments are the platform targets
PLATFORMS=("$@")
# shellcheck source=desktop/scripts/release/release-config.sh
source "$SCRIPT_DIR/release-config.sh"
source $REPO_ROOT/scripts/utils/log
function modify_rollout {
local signed_dir="$DATA_DIR/signed/"
local work_dir="$DATA_DIR/work/"
local published_dir="$DATA_DIR/currently_published/"
local upload_dir="$DATA_DIR/upload/"
local latest_filename="latest.json"
local all_platforms=(linux macos windows)
local mullvad_release="cargo run -q --package mullvad-release --"
rm -rf "$signed_dir"
rm -rf "$work_dir"
rm -rf "$published_dir"
rm -rf "$upload_dir"
log_info "Platforms:" "${PLATFORMS[@]}"
log_header "Fetching current version metadata"
$mullvad_release pull --latest-file --assume-yes "${all_platforms[@]}"
log_header "Backing up released data"
cp -r "$signed_dir" "$published_dir"
mv "$DATA_DIR/$latest_filename" "$published_dir/$latest_filename"
log_header "Replacing $work_dir directory with latest published data"
cp -rf "$signed_dir" "$work_dir"
log_header "Setting rollout = $ROLLOUT for $PRODUCT_VERSION"
$mullvad_release modify-release "$PRODUCT_VERSION" --rollout "$ROLLOUT" "${PLATFORMS[@]}"
log "\nScript paused allow manual edits to the metadata before signing and publishing."
log "Before continuing, make sure your release metadata signing key in the clipboard."
log "Press enter to continue..."
read -rs
log_header "Signing $PRODUCT_VERSION metadata. Reading signing key from clipboard"
xclip -sensitive | $mullvad_release sign "${PLATFORMS[@]}"
log_header "Verifying signed metadata"
$mullvad_release verify "${all_platforms[@]}"
log_header "Creating upload dir"
cp -rf "$signed_dir" "$upload_dir"
log_header "Generating $latest_filename for current version metadata"
$mullvad_release query-latest "${all_platforms[@]}" > "$upload_dir/$latest_filename"
log_header "New metadata including $PRODUCT_VERSION"
git --no-pager diff --no-index -- "$published_dir" "$upload_dir" || true
read -rp "Press enter to upload if the diffs look good "
./publish-metadata-to-api "$upload_dir" "$BUILDSERVER_HOST" "$METADATA_SERVER_HOST"
}
modify_rollout
|