Skip to content

Commit 032db49

Browse files
authored
Add a script to upload a new protoc version (#723)
This also changes all scripts to include "set -euo pipefail" in a consistent way
1 parent e0c1afb commit 032db49

22 files changed

+106
-16
lines changed

druid/upload_new_druid_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

hadoop/upload_new_hadoop_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

hbase/upload_new_hbase-operator-tools_version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
VERSION=${1:?"Missing version number argument (arg 1)"}
66
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}

hbase/upload_new_hbase_version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
VERSION=${1:?"Missing version number argument (arg 1)"}
66
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}

hbase/upload_new_phoenix_version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
VERSION=${1:?"Missing version number argument (arg 1)"}
66
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}

hive/upload_new_hive_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

hive/upload_new_postgres_driver_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

kafka/upload_new_kafka_version.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

@@ -72,4 +74,4 @@ if [ $EXIT_STATUS -ne 0 ]; then
7274
fi
7375

7476
echo "Successfully uploaded version $VERSION of Kafka to Nexus"
75-
echo "https://repo.stackable.tech/service/rest/repository/browse/packages/kafka/"
77+
echo "https://repo.stackable.tech/service/rest/repository/browse/packages/kafka/"

nifi/upload_new_nifi_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

opa/upload_new_opa_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

spark-k8s/upload_new_spark_version.sh

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

@@ -15,13 +17,13 @@ WORK_DIR=$(mktemp -d -p "$DIR")
1517

1618
# check if tmp dir was created
1719
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
18-
echo "Could not create temp dir"
19-
exit 1
20+
echo "Could not create temp dir"
21+
exit 1
2022
fi
2123

2224
# deletes the temp directory
2325
function cleanup {
24-
rm -rf "$WORK_DIR"
26+
rm -rf "$WORK_DIR"
2527
}
2628

2729
# register the cleanup function to be called on the EXIT signal
@@ -39,16 +41,16 @@ curl --fail -LOs "https://archive.apache.org/dist/spark/spark-${VERSION}/${src_f
3941
# It is probably redundant to check both the checksum and the signature but it's cheap and why not
4042
echo "Validating SHA512 Checksum"
4143
if ! (sha512sum "${src_file}" | diff - "${src_file}.sha512"); then
42-
echo "ERROR: The SHA512 sum does not match"
43-
exit 1
44+
echo "ERROR: The SHA512 sum does not match"
45+
exit 1
4446
fi
4547

4648
echo "Validating signature"
4749
echo '--> NOTE: Make sure you have downloaded and added the KEYS file (https://archive.apache.org/dist/spark/KEYS) to GPG: https://www.apache.org/info/verification.html (e.g. by using "curl https://archive.apache.org/dist/spark/KEYS | gpg --import")'
4850

4951
if ! (gpg --verify "${src_file}.asc" "${src_file}" 2>/dev/null); then
50-
echo "ERROR: The signature could not be verified"
51-
exit 1
52+
echo "ERROR: The signature could not be verified"
53+
exit 1
5254
fi
5355

5456
echo "Uploading everything to Nexus"
@@ -58,8 +60,8 @@ curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}.asc" 'ht
5860
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}.sha512" 'https://repo.stackable.tech/repository/packages/spark/' || EXIT_STATUS=$?
5961

6062
if [ $EXIT_STATUS -ne 0 ]; then
61-
echo "ERROR: Upload failed"
62-
exit 1
63+
echo "ERROR: Upload failed"
64+
exit 1
6365
fi
6466

6567
echo "Successfully uploaded version ${VERSION} of Spark to Nexus"

trino-cli/upload_new_trino_version.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
23
set -euo pipefail
34

45
VERSION=${1:?"Missing version number argument (arg 1)"}

trino/upload_new_trino_storage_version.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
23
set -euo pipefail
34

45
VERSION=${1:?"Missing version number argument (arg 1)"}

trino/upload_new_trino_version.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
23
set -euo pipefail
34

45
VERSION=${1:?"Missing version number argument (arg 1)"}

upload_new_async-profiler_version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
VERSION=${1:?"Missing version number argument (arg 1)"}
66
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}

upload_new_inotify-tools_version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
VERSION=${1:?"Missing version number argument (arg 1)"}
66
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}

upload_new_jmx_exporter_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

upload_new_kcat_version.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

@@ -33,7 +35,7 @@ cd "$WORK_DIR" || exit
3335
# kcat does not currently publish signatures or SBOMs
3436
# renaming binary because original file name has no version
3537
echo "Downloading kcat"
36-
curl --fail -Ls -o "kcat-$VERSION.tar.gz" "https://github.com/edenhill/kcat/archive/refs/tags/$VERSION.tar.gz"
38+
curl --fail -Ls -o "kcat-$VERSION.tar.gz" "https://github.com/edenhill/kcat/archive/refs/tags/$VERSION.tar.gz"
3739

3840
echo "Uploading to Nexus"
3941
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "kcat-$VERSION.tar.gz" 'https://repo.stackable.tech/repository/packages/kcat/'

upload_new_protoc_version.sh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
VERSION=${1:?"Missing version number argument (arg 1)"}
6+
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
7+
8+
ARCHITECTURES=(
9+
aarch_64
10+
x86_64
11+
)
12+
13+
read -r -s -p "Nexus Password: " NEXUS_PASSWORD
14+
echo ""
15+
16+
# https://stackoverflow.com/questions/4632028/how-to-create-a-temporary-directory
17+
# Find the directory name of the script
18+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
19+
20+
# the temp directory used, within $DIR
21+
WORK_DIR=$(mktemp -d -p "$DIR")
22+
23+
# check if tmp dir was created
24+
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
25+
echo "Could not create temp dir"
26+
exit 1
27+
fi
28+
29+
# deletes the temp directory
30+
function cleanup {
31+
rm -rf "$WORK_DIR"
32+
}
33+
34+
# register the cleanup function to be called on the EXIT signal
35+
trap cleanup EXIT
36+
37+
cd "$WORK_DIR" || exit
38+
39+
for arch in "${ARCHITECTURES[@]}"; do
40+
# protoc does not currently publish signatures or SBOMs
41+
42+
DOWNLOAD_URL="https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-$arch.zip"
43+
44+
echo "Downloading protoc"
45+
if ! curl --fail -Ls -O "$DOWNLOAD_URL"; then
46+
echo "Failed to download from $DOWNLOAD_URL"
47+
exit 1
48+
fi
49+
50+
FILE_NAME=$(basename "$DOWNLOAD_URL")
51+
52+
echo "Uploading protoc to Nexus"
53+
if ! curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "$FILE_NAME" 'https://repo.stackable.tech/repository/packages/protoc/'; then
54+
echo "Failed to upload protoc to Nexus"
55+
exit 1
56+
fi
57+
58+
done
59+
60+
echo "Successfully uploaded new version of protoc ($VERSION) to Nexus"
61+
echo "https://repo.stackable.tech/service/rest/repository/browse/packages/protoc/"

upload_new_statsd_exporter_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

vector/upload_new_vector_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
RELEASE=${2:?"Missing release number argument (arg 2)"}
57
NEXUS_USER=${3:?"Missing Nexus username argument (arg 3)"}

zookeeper/upload_new_zookeeper_version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
35
VERSION=${1:?"Missing version number argument (arg 1)"}
46
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
57

0 commit comments

Comments
 (0)