1*55e87721SMatt Gilbride#!/bin/bash 2*55e87721SMatt Gilbride# Copyright 2018 Google LLC 3*55e87721SMatt Gilbride# 4*55e87721SMatt Gilbride# Licensed under the Apache License, Version 2.0 (the "License"); 5*55e87721SMatt Gilbride# you may not use this file except in compliance with the License. 6*55e87721SMatt Gilbride# You may obtain a copy of the License at 7*55e87721SMatt Gilbride# 8*55e87721SMatt Gilbride# http://www.apache.org/licenses/LICENSE-2.0 9*55e87721SMatt Gilbride# 10*55e87721SMatt Gilbride# Unless required by applicable law or agreed to in writing, software 11*55e87721SMatt Gilbride# distributed under the License is distributed on an "AS IS" BASIS, 12*55e87721SMatt Gilbride# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*55e87721SMatt Gilbride# See the License for the specific language governing permissions and 14*55e87721SMatt Gilbride# limitations under the License. 15*55e87721SMatt Gilbride 16*55e87721SMatt Gilbrideset -eo pipefail 17*55e87721SMatt Gilbride 18*55e87721SMatt Gilbride# Get secrets from keystore and set and environment variables 19*55e87721SMatt Gilbridesetup_environment_secrets() { 20*55e87721SMatt Gilbride export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) 21*55e87721SMatt Gilbride export GPG_TTY=$(tty) 22*55e87721SMatt Gilbride export GPG_HOMEDIR=/gpg 23*55e87721SMatt Gilbride mkdir $GPG_HOMEDIR 24*55e87721SMatt Gilbride mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg 25*55e87721SMatt Gilbride mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg 26*55e87721SMatt Gilbride export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') 27*55e87721SMatt Gilbride export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') 28*55e87721SMatt Gilbride} 29*55e87721SMatt Gilbride 30*55e87721SMatt Gilbridecreate_settings_xml_file() { 31*55e87721SMatt Gilbride echo "<settings> 32*55e87721SMatt Gilbride <servers> 33*55e87721SMatt Gilbride <server> 34*55e87721SMatt Gilbride <id>ossrh</id> 35*55e87721SMatt Gilbride <username>${SONATYPE_USERNAME}</username> 36*55e87721SMatt Gilbride <password>${SONATYPE_PASSWORD}</password> 37*55e87721SMatt Gilbride </server> 38*55e87721SMatt Gilbride <server> 39*55e87721SMatt Gilbride <id>sonatype-nexus-staging</id> 40*55e87721SMatt Gilbride <username>${SONATYPE_USERNAME}</username> 41*55e87721SMatt Gilbride <password>${SONATYPE_PASSWORD}</password> 42*55e87721SMatt Gilbride </server> 43*55e87721SMatt Gilbride <server> 44*55e87721SMatt Gilbride <id>sonatype-nexus-snapshots</id> 45*55e87721SMatt Gilbride <username>${SONATYPE_USERNAME}</username> 46*55e87721SMatt Gilbride <password>${SONATYPE_PASSWORD}</password> 47*55e87721SMatt Gilbride </server> 48*55e87721SMatt Gilbride </servers> 49*55e87721SMatt Gilbride</settings>" > $1 50*55e87721SMatt Gilbride}