summaryrefslogtreecommitdiffhomepage
path: root/ci
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2023-02-27 14:03:37 +0100
committerLinus Färnstrand <faern@faern.net>2023-02-27 14:28:39 +0100
commitbc8cd14bfe1f58e29b739bcd4aad40288a62420c (patch)
treeabeb8b36d3445fcffe2ae7497dfb434af9735914 /ci
parentee7230f661d4a05cd31f6f52cbca8082d583577b (diff)
downloadmullvadvpn-bc8cd14bfe1f58e29b739bcd4aad40288a62420c.tar.xz
mullvadvpn-bc8cd14bfe1f58e29b739bcd4aad40288a62420c.zip
Change indentation 2->4 spaces in buildserver-upload.sh
Diffstat (limited to 'ci')
-rwxr-xr-xci/buildserver-build-android.sh124
-rwxr-xr-xci/buildserver-build.sh236
-rwxr-xr-xci/buildserver-upload.sh68
3 files changed, 214 insertions, 214 deletions
diff --git a/ci/buildserver-build-android.sh b/ci/buildserver-build-android.sh
index 6e04bf18b9..533e37f6d1 100755
--- a/ci/buildserver-build-android.sh
+++ b/ci/buildserver-build-android.sh
@@ -19,86 +19,86 @@ BRANCHES_TO_BUILD=("origin/main")
TAG_PATTERN_TO_BUILD=("^android/")
upload() {
- for f in MullvadVPN-*.{apk,aab}; do
- sha256sum "$f" > "$f.sha256"
- mv "$f" "$f.sha256" "$UPLOAD_DIR/"
- done
+ for f in MullvadVPN-*.{apk,aab}; do
+ sha256sum "$f" > "$f.sha256"
+ mv "$f" "$f.sha256" "$UPLOAD_DIR/"
+ done
}
build_ref() {
- ref=$1
- tag=${2:-""}
+ ref=$1
+ tag=${2:-""}
- current_hash="$(git rev-parse $ref^{commit})"
- if [ -f "$LAST_BUILT_DIR/$current_hash" ]; then
- # This commit has already been built
- return 0
- fi
+ current_hash="$(git rev-parse $ref^{commit})"
+ if [ -f "$LAST_BUILT_DIR/$current_hash" ]; then
+ # This commit has already been built
+ return 0
+ fi
- echo ""
- echo "[#] $ref: $current_hash, building new packages."
+ echo ""
+ echo "[#] $ref: $current_hash, building new packages."
- if [[ $ref == "refs/tags/"* ]] && ! git verify-tag $ref; then
- echo "!!!"
- echo "[#] $ref is a tag, but it failed GPG verification!"
- echo "!!!"
- sleep 60
- return 0
- elif [[ $ref == "refs/remotes/"* ]] && ! git verify-commit $current_hash; then
- echo "!!!"
- echo "[#] $ref is a branch, but it failed GPG verification!"
- echo "!!!"
- sleep 60
- return 0
- fi
+ if [[ $ref == "refs/tags/"* ]] && ! git verify-tag $ref; then
+ echo "!!!"
+ echo "[#] $ref is a tag, but it failed GPG verification!"
+ echo "!!!"
+ sleep 60
+ return 0
+ elif [[ $ref == "refs/remotes/"* ]] && ! git verify-commit $current_hash; then
+ echo "!!!"
+ echo "[#] $ref is a branch, but it failed GPG verification!"
+ echo "!!!"
+ sleep 60
+ return 0
+ fi
- # Clean our working dir and check out the code we want to build
- rm -r dist/ 2&>/dev/null || true
- git reset --hard
- git checkout $ref
- git submodule update
- git clean -df
+ # Clean our working dir and check out the code we want to build
+ rm -r dist/ 2&>/dev/null || true
+ git reset --hard
+ git checkout $ref
+ git submodule update
+ git clean -df
- echo "Building Android app"
- ANDROID_CREDENTIALS_DIR=$ANDROID_CREDENTIALS_DIR ./building/containerized-build.sh android --app-bundle || return 0
+ echo "Building Android app"
+ ANDROID_CREDENTIALS_DIR=$ANDROID_CREDENTIALS_DIR ./building/containerized-build.sh android --app-bundle || return 0
- # If there is a tag for this commit then we append that to the produced artifacts
- # A version suffix should only be created if there is a tag for this commit and it is not a release build
- if [[ -n "$tag" ]]; then
- # Remove disallowed version characters from the tag
- version_suffix="+${tag//[^0-9a-z_-]/}"
- # Will only match paths that include *-dev-* which means release builds will not be included
- # Pipes all matching names and their new name to mv
- pushd dist
- for original_file in MullvadVPN-*-dev-*{.apk,.aab}; do
- new_file=$(echo $original_file | sed -nE "s/^(MullvadVPN-.*-dev-.*)(\.apk|\.aab)$/\1$version_suffix\2/p")
- mv $original_file $new_file
- done
- popd
- fi
+ # If there is a tag for this commit then we append that to the produced artifacts
+ # A version suffix should only be created if there is a tag for this commit and it is not a release build
+ if [[ -n "$tag" ]]; then
+ # Remove disallowed version characters from the tag
+ version_suffix="+${tag//[^0-9a-z_-]/}"
+ # Will only match paths that include *-dev-* which means release builds will not be included
+ # Pipes all matching names and their new name to mv
+ pushd dist
+ for original_file in MullvadVPN-*-dev-*{.apk,.aab}; do
+ new_file=$(echo $original_file | sed -nE "s/^(MullvadVPN-.*-dev-.*)(\.apk|\.aab)$/\1$version_suffix\2/p")
+ mv $original_file $new_file
+ done
+ popd
+ fi
- (cd dist/ && upload) || return 0
+ (cd dist/ && upload) || return 0
- touch "$LAST_BUILT_DIR/$current_hash"
- echo "Successfully finished Android build at $(date)"
+ touch "$LAST_BUILT_DIR/$current_hash"
+ echo "Successfully finished Android build at $(date)"
}
cd "$BUILD_DIR"
while true; do
- # Delete all tags. So when fetching we only get the ones existing on the remote
- git tag | xargs git tag -d > /dev/null
+ # Delete all tags. So when fetching we only get the ones existing on the remote
+ git tag | xargs git tag -d > /dev/null
- git fetch --prune --tags 2> /dev/null || continue
- tags=( $(git tag | grep "$TAG_PATTERN_TO_BUILD") )
+ git fetch --prune --tags 2> /dev/null || continue
+ tags=( $(git tag | grep "$TAG_PATTERN_TO_BUILD") )
- for tag in "${tags[@]}"; do
- build_ref "refs/tags/$tag" "$tag"
- done
+ for tag in "${tags[@]}"; do
+ build_ref "refs/tags/$tag" "$tag"
+ done
- for branch in "${BRANCHES_TO_BUILD[@]}"; do
- build_ref "refs/remotes/$branch"
- done
+ for branch in "${BRANCHES_TO_BUILD[@]}"; do
+ build_ref "refs/remotes/$branch"
+ done
- sleep 240
+ sleep 240
done
diff --git a/ci/buildserver-build.sh b/ci/buildserver-build.sh
index 73859b7704..1b9ed7f2f0 100755
--- a/ci/buildserver-build.sh
+++ b/ci/buildserver-build.sh
@@ -22,19 +22,19 @@ UPLOAD_DIR="/home/upload/upload"
BRANCHES_TO_BUILD=("origin/main")
case "$(uname -s)" in
- Darwin*|MINGW*|MSYS_NT*)
- if [[ -z ${CSC_KEY_PASSWORD-} ]]; then
- read -sp "CSC_KEY_PASSWORD = " CSC_KEY_PASSWORD
- echo ""
- export CSC_KEY_PASSWORD
- fi
- ;;
+ Darwin*|MINGW*|MSYS_NT*)
+ if [[ -z ${CSC_KEY_PASSWORD-} ]]; then
+ read -sp "CSC_KEY_PASSWORD = " CSC_KEY_PASSWORD
+ echo ""
+ export CSC_KEY_PASSWORD
+ fi
+ ;;
esac
# Uploads whatever matches the first argument to the Linux build server
upload_sftp() {
- echo "Uploading Mullvad VPN installers to app-build-linux:upload/"
- sftp app-build-linux <<EOF
+ echo "Uploading Mullvad VPN installers to app-build-linux:upload/"
+ sftp app-build-linux <<EOF
cd upload
put $1
bye
@@ -42,141 +42,141 @@ EOF
}
upload() {
- version=$1
+ version=$1
- files=( * )
- checksums_path="$version+$(hostname).sha256"
- sha256sum "${files[@]}" > "$checksums_path"
+ files=( * )
+ checksums_path="$version+$(hostname).sha256"
+ sha256sum "${files[@]}" > "$checksums_path"
- case "$(uname -s)" in
- # Linux is both the build and upload server. Just move directly to target dir
- Linux*)
- mv "${files[@]}" "$checksums_path" "$UPLOAD_DIR/"
- ;;
- # Other platforms need to transfer their artifacts to the Linux build machine.
- Darwin*|MINGW*|MSYS_NT*)
- for file in "${files[@]}"; do
- upload_sftp "$file" || return 1
- done
- upload_sftp "$checksums_path" || return 1
- ;;
- esac
+ case "$(uname -s)" in
+ # Linux is both the build and upload server. Just move directly to target dir
+ Linux*)
+ mv "${files[@]}" "$checksums_path" "$UPLOAD_DIR/"
+ ;;
+ # Other platforms need to transfer their artifacts to the Linux build machine.
+ Darwin*|MINGW*|MSYS_NT*)
+ for file in "${files[@]}"; do
+ upload_sftp "$file" || return 1
+ done
+ upload_sftp "$checksums_path" || return 1
+ ;;
+ esac
}
build_ref() {
- ref=$1
- tag=${2:-""}
+ ref=$1
+ tag=${2:-""}
- current_hash="$(git rev-parse $ref^{commit})"
- if [ -f "$LAST_BUILT_DIR/$current_hash" ]; then
- # This commit has already been built
- return 0
- fi
+ current_hash="$(git rev-parse $ref^{commit})"
+ if [ -f "$LAST_BUILT_DIR/$current_hash" ]; then
+ # This commit has already been built
+ return 0
+ fi
- echo ""
- echo "[#] $ref: $current_hash, building new packages."
+ echo ""
+ echo "[#] $ref: $current_hash, building new packages."
- if [[ $ref == "refs/tags/"* ]] && ! git verify-tag $ref; then
- echo "!!!"
- echo "[#] $ref is a tag, but it failed GPG verification!"
- echo "!!!"
- sleep 60
- return 0
- elif [[ $ref == "refs/remotes/"* ]] && ! git verify-commit $current_hash; then
- echo "!!!"
- echo "[#] $ref is a branch, but it failed GPG verification!"
- echo "!!!"
- sleep 60
- return 0
- fi
+ if [[ $ref == "refs/tags/"* ]] && ! git verify-tag $ref; then
+ echo "!!!"
+ echo "[#] $ref is a tag, but it failed GPG verification!"
+ echo "!!!"
+ sleep 60
+ return 0
+ elif [[ $ref == "refs/remotes/"* ]] && ! git verify-commit $current_hash; then
+ echo "!!!"
+ echo "[#] $ref is a branch, but it failed GPG verification!"
+ echo "!!!"
+ sleep 60
+ return 0
+ fi
- # Clean our working dir and check out the code we want to build
- rm -r dist/ 2&>/dev/null || true
- git reset --hard
- git checkout $ref
- git submodule update
- git clean -df
+ # Clean our working dir and check out the code we want to build
+ rm -r dist/ 2&>/dev/null || true
+ git reset --hard
+ git checkout $ref
+ git submodule update
+ git clean -df
- # Make sure we have the latest Rust and Node toolchains before the build
- rustup update
+ # Make sure we have the latest Rust and Node toolchains before the build
+ rustup update
- version="$(cargo run -q --bin mullvad-version || return 0)"
- artifact_dir="dist/$version"
- mkdir -p "$artifact_dir"
+ version="$(cargo run -q --bin mullvad-version || return 0)"
+ artifact_dir="dist/$version"
+ mkdir -p "$artifact_dir"
- BUILD_ARGS=(--optimize --sign)
- if [[ "$(uname -s)" == "Darwin" ]]; then
- BUILD_ARGS+=(--universal)
- fi
- ./build.sh "${BUILD_ARGS[@]}" || return 0
- mv dist/*.{deb,rpm,exe,pkg} "$artifact_dir" || return 0
+ BUILD_ARGS=(--optimize --sign)
+ if [[ "$(uname -s)" == "Darwin" ]]; then
+ BUILD_ARGS+=(--universal)
+ fi
+ ./build.sh "${BUILD_ARGS[@]}" || return 0
+ mv dist/*.{deb,rpm,exe,pkg} "$artifact_dir" || return 0
- (gui/scripts/build-test-executable.sh && mv "dist/app-e2e-tests-$version"* "$artifact_dir") || \
- true
+ (gui/scripts/build-test-executable.sh && mv "dist/app-e2e-tests-$version"* "$artifact_dir") || \
+ true
- case "$(uname -s)" in
- MINGW*|MSYS_NT*)
- echo "Packaging all PDB files..."
- find ./windows/ \
- ./target/release/mullvad-daemon.pdb \
- ./target/release/mullvad.pdb \
- ./target/release/mullvad-problem-report.pdb \
- -iname "*.pdb" | tar -cJf "$artifact_dir/pdb-$version.tar.xz" -T -
- ;;
- Linux*)
- echo "Building ARM64 installers"
- TARGETS=aarch64-unknown-linux-gnu ./build.sh "${BUILD_ARGS[@]}" || return 0
- mv dist/*.{deb,rpm} "$artifact_dir" || return 0
+ case "$(uname -s)" in
+ MINGW*|MSYS_NT*)
+ echo "Packaging all PDB files..."
+ find ./windows/ \
+ ./target/release/mullvad-daemon.pdb \
+ ./target/release/mullvad.pdb \
+ ./target/release/mullvad-problem-report.pdb \
+ -iname "*.pdb" | tar -cJf "$artifact_dir/pdb-$version.tar.xz" -T -
+ ;;
+ Linux*)
+ echo "Building ARM64 installers"
+ TARGETS=aarch64-unknown-linux-gnu ./build.sh "${BUILD_ARGS[@]}" || return 0
+ mv dist/*.{deb,rpm} "$artifact_dir" || return 0
- (gui/scripts/build-test-executable.sh aarch64-unknown-linux-gnu && \
- mv "dist/app-e2e-tests-$version"* "$artifact_dir") || \
- true
- ;;
- esac
+ (gui/scripts/build-test-executable.sh aarch64-unknown-linux-gnu && \
+ mv "dist/app-e2e-tests-$version"* "$artifact_dir") || \
+ true
+ ;;
+ esac
- # If there is a tag for this commit then we append that to the produced artifacts
- # A version suffix should only be created if there is a tag for this commit and it is not a release build
- if [[ -n "$tag" ]]; then
- # Remove disallowed version characters from the tag
- version_suffix="+${tag//[^0-9a-z_-]/}"
- # Will only match paths that include *-dev-* which means release builds will not be included
- # Pipes all matching names and their new name to mv
- pushd "$artifact_dir"
- for original_file in MullvadVPN-*-dev-*{.deb,.rpm,.exe,.pkg}; do
- new_file=$(echo "$original_file" | sed -nE "s/^(MullvadVPN-.*-dev-.*)(_amd64\.deb|_x86_64\.rpm|_arm64\.deb|_aarch64\.rpm|\.exe|\.pkg)$/\1$version_suffix\2/p")
- mv "$original_file" "$new_file"
- done
- popd
+ # If there is a tag for this commit then we append that to the produced artifacts
+ # A version suffix should only be created if there is a tag for this commit and it is not a release build
+ if [[ -n "$tag" ]]; then
+ # Remove disallowed version characters from the tag
+ version_suffix="+${tag//[^0-9a-z_-]/}"
+ # Will only match paths that include *-dev-* which means release builds will not be included
+ # Pipes all matching names and their new name to mv
+ pushd "$artifact_dir"
+ for original_file in MullvadVPN-*-dev-*{.deb,.rpm,.exe,.pkg}; do
+ new_file=$(echo "$original_file" | sed -nE "s/^(MullvadVPN-.*-dev-.*)(_amd64\.deb|_x86_64\.rpm|_arm64\.deb|_aarch64\.rpm|\.exe|\.pkg)$/\1$version_suffix\2/p")
+ mv "$original_file" "$new_file"
+ done
+ popd
- if [[ $version == *"-dev-"* ]]; then
- version="$version$version_suffix"
- fi
- fi
+ if [[ $version == *"-dev-"* ]]; then
+ version="$version$version_suffix"
+ fi
+ fi
- (cd "$artifact_dir" && upload "$version") || return 0
- # shellcheck disable=SC2216
- yes | rm -r "$artifact_dir"
+ (cd "$artifact_dir" && upload "$version") || return 0
+ # shellcheck disable=SC2216
+ yes | rm -r "$artifact_dir"
- touch "$LAST_BUILT_DIR/$current_hash"
- echo "Successfully finished build at $(date)"
+ touch "$LAST_BUILT_DIR/$current_hash"
+ echo "Successfully finished build at $(date)"
}
cd "$BUILD_DIR"
while true; do
- # Delete all tags. So when fetching we only get the ones existing on the remote
- git tag | xargs git tag -d > /dev/null
+ # Delete all tags. So when fetching we only get the ones existing on the remote
+ git tag | xargs git tag -d > /dev/null
- git fetch --prune --tags 2> /dev/null || continue
- tags=( $(git tag) )
+ git fetch --prune --tags 2> /dev/null || continue
+ tags=( $(git tag) )
- for tag in "${tags[@]}"; do
- build_ref "refs/tags/$tag" "$tag"
- done
+ for tag in "${tags[@]}"; do
+ build_ref "refs/tags/$tag" "$tag"
+ done
- for branch in "${BRANCHES_TO_BUILD[@]}"; do
- build_ref "refs/remotes/$branch"
- done
+ for branch in "${BRANCHES_TO_BUILD[@]}"; do
+ build_ref "refs/remotes/$branch"
+ done
- sleep 240
+ sleep 240
done
diff --git a/ci/buildserver-upload.sh b/ci/buildserver-upload.sh
index 3b5e8ad09b..121dbd3104 100755
--- a/ci/buildserver-upload.sh
+++ b/ci/buildserver-upload.sh
@@ -9,46 +9,46 @@ shopt -s nullglob
cd $UPLOAD_DIR
while true; do
- sleep 10
+ sleep 10
- for checksums_path in *.sha256; do
- sleep 1
+ for checksums_path in *.sha256; do
+ sleep 1
- # Strip everything from the last "+" in the file name to only keep the version and tag (if
- # present).
- version="${checksums_path%+*}"
- if ! sha256sum --quiet -c "$checksums_path"; then
- echo "Failed to verify checksums for $version"
- continue
- fi
+ # Strip everything from the last "+" in the file name to only keep the version and tag (if
+ # present).
+ version="${checksums_path%+*}"
+ if ! sha256sum --quiet -c "$checksums_path"; then
+ echo "Failed to verify checksums for $version"
+ continue
+ fi
- if [[ $version == *"-dev-"* ]]; then
- upload_path="builds"
- else
- upload_path="releases"
- fi
+ if [[ $version == *"-dev-"* ]]; then
+ upload_path="builds"
+ else
+ upload_path="releases"
+ fi
- files=$(awk '{print $2}' < "$checksums_path")
- for file in $files; do
- file_upload_dir="$upload_path/$version"
- if [[ ! $file == MullvadVPN-* ]]; then
- file_upload_dir="$file_upload_dir/additional-files"
- fi
+ files=$(awk '{print $2}' < "$checksums_path")
+ for file in $files; do
+ file_upload_dir="$upload_path/$version"
+ if [[ ! $file == MullvadVPN-* ]]; then
+ file_upload_dir="$file_upload_dir/additional-files"
+ fi
- rsync -av --rsh='ssh -p 1122' "$file" "build@releases.mullvad.net:$file_upload_dir/" || continue
+ rsync -av --rsh='ssh -p 1122' "$file" "build@releases.mullvad.net:$file_upload_dir/" || continue
- if [[ $file == MullvadVPN-* ]]; then
- rm -f "$file.asc"
- gpg -u A1198702FC3E0A09A9AE5B75D5A1D4F266DE8DDF --pinentry-mode loopback --sign --armor --detach-sign "$file"
- rsync -av --rsh='ssh -p 1122' "$file.asc" "build@releases.mullvad.net:$file_upload_dir/" || continue
- rm -f "$file.asc"
- fi
+ if [[ $file == MullvadVPN-* ]]; then
+ rm -f "$file.asc"
+ gpg -u A1198702FC3E0A09A9AE5B75D5A1D4F266DE8DDF --pinentry-mode loopback --sign --armor --detach-sign "$file"
+ rsync -av --rsh='ssh -p 1122' "$file.asc" "build@releases.mullvad.net:$file_upload_dir/" || continue
+ rm -f "$file.asc"
+ fi
- # shellcheck disable=SC2216
- yes | rm "$file"
- done
+ # shellcheck disable=SC2216
+ yes | rm "$file"
+ done
- # shellcheck disable=SC2216
- yes | rm "$checksums_path"
- done
+ # shellcheck disable=SC2216
+ yes | rm "$checksums_path"
+ done
done