-
Notifications
You must be signed in to change notification settings - Fork 57
/
unshaded_snapshot_deploy.sh
executable file
·55 lines (44 loc) · 1.73 KB
/
unshaded_snapshot_deploy.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash -e
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export GPG_KEY_ID="Snowflake Computing"
export LDAP_USER="$INTERNAL_NEXUS_USERNAME"
export LDAP_PWD="$INTERNAL_NEXUS_PASSWORD"
if [ -z "$GPG_KEY_PASSPHRASE" ]; then
echo "[ERROR] GPG passphrase is not specified for $GPG_KEY_ID!"
exit 1
fi
if [ -z "$GPG_PRIVATE_KEY" ]; then
echo "[ERROR] GPG private key file is not specified!"
exit 1
fi
echo "[INFO] Import PGP Key"
if ! gpg --list-secret-key | grep "$GPG_KEY_ID"; then
gpg --allow-secret-key-import --import "$GPG_PRIVATE_KEY"
fi
# copy the settings.xml template and inject credential information
UNSHADED_SNAPSHOT_DEPLOY_SETTINGS_XML="$THIS_DIR/mvn_settings_unshaded_snapshot_deploy.xml"
MVN_REPOSITORY_ID=snapshot
cat > $UNSHADED_SNAPSHOT_DEPLOY_SETTINGS_XML << SETTINGS.XML
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>$MVN_REPOSITORY_ID</id>
<username>$LDAP_USER</username>
<password>$LDAP_PWD</password>
</server>
</servers>
</settings>
SETTINGS.XML
MVN_OPTIONS+=(
"--settings" "$UNSHADED_SNAPSHOT_DEPLOY_SETTINGS_XML"
"--batch-mode"
)
echo "[Info] Sign unshaded package and deploy to staging area"
project_version=$($THIS_DIR/scripts/get_project_info_from_pom.py $THIS_DIR/pom.xml version)
echo "[Info] Project version: $project_version"
$THIS_DIR/scripts/update_project_version.py pom.xml ${project_version} > generated_public_pom.xml
mvn deploy ${MVN_OPTIONS[@]} -Dnot-shadeDep -Dsnapshot-deploy
rm $UNSHADED_SNAPSHOT_DEPLOY_SETTINGS_XML