forked from snowflakedb/snowflake-kafka-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_jar.sh
executable file
·36 lines (28 loc) · 964 Bytes
/
upload_jar.sh
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
#!/usr/bin/env bash
if ! VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)
then
echo "failed to read version from pom.xml"
exit 1
fi
echo "version to upload: $VERSION"
if ! API_KEY_SECRET_ID=$(op item list --tags "connectors-nexus-api-key" --format json | jq -r '.[].id')
then
echo "failed to find required api key in 1password"
exit 1
fi
if ! USER_PASS=$(op item get $API_KEY_SECRET_ID --format json | jq -r '.fields[] | select(.type=="CONCEALED") | .value')
then
echo 'failed to read user:password from 1password'
exit 1
fi
FILE="https://nexus.int.snowflakecomputing.com/repository/connectors/snowflake-kafka-connector-$USER-$VERSION.jar"
echo trying to delete $FILE....
curl -X DELETE \
-u $USER_PASS \
$FILE
echo uploading new file to $FILE...
curl --fail \
--upload-file ./target/snowflake-kafka-connector-$VERSION.jar \
-u $USER_PASS \
-w "\nHTTP Status: %{http_code}\n" \
$FILE