diff --git a/.travis.yml b/.travis.yml index 298ce121a..5ab5e1bf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,14 +34,7 @@ cache: - "$HOME/.gradle/caches/" - "$HOME/.gradle/wrapper/" before_install: -- if [ "$TRAVIS_SECURE_ENV_VARS" == true ]; then openssl aes-256-cbc -K $encrypted_677f232983c0_key -iv $encrypted_677f232983c0_iv -in travis/signing-key.asc.enc -out travis/signing-key.asc -d ; fi -- if [ "$TRAVIS_SECURE_ENV_VARS" == true ]; then gpg --no-tty --batch --allow-secret-key-import --import travis/signing-key.asc ; fi -- rm -rf "$HOME/.gradle/gradle.properties" -- echo signing.keyId="${SIGNING_KEY_ID}" > "$HOME/.gradle/gradle.properties" -- echo signing.password="${SIGNING_KEY_PASSPHRASE}" >> "$HOME/.gradle/gradle.properties" -- echo ossrhUsername="${SONATYPE_USERNAME}" >> "$HOME/.gradle/gradle.properties" -- echo ossrhPassword="${SONATYPE_PASSWORD}" >> "$HOME/.gradle/gradle.properties" -- echo signing.secretKeyRingFile="${HOME}/.gnupg/secring.gpg" >> "$HOME/.gradle/gradle.properties" +- ./travis/prepare-signing.sh $encrypted_677f232983c0_key $encrypted_677f232983c0_iv - if [ "$CROSSDOCK" == true ]; then bash ./travis/install-crossdock-deps.sh ; fi - sudo rm -rf /usr/local/bin/thrift - sudo cp travis/docker-thrift/thrift /usr/local/bin/ diff --git a/build.gradle b/build.gradle index 956905530..fd0f6cbb4 100644 --- a/build.gradle +++ b/build.gradle @@ -163,6 +163,11 @@ configure(subprojects.findAll {it.name != 'jaeger-thrift'}) { def getVersionForBuild() { String candidateVersion = System.env.TRAVIS_TAG + + if (null == candidateVersion || candidateVersion.isEmpty()) { + return ext.developmentVersion + } + if (Pattern.compile("[v]?((\\d+)\\.(\\d+)\\.(\\d+))").matcher(candidateVersion).matches()) { return candidateVersion } diff --git a/travis/prepare-signing.sh b/travis/prepare-signing.sh new file mode 100755 index 000000000..c2ebc3c88 --- /dev/null +++ b/travis/prepare-signing.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +ENCRYPTION_KEY=$1 +ENCRYPTION_IV=$2 + +# some sanity checks first: +if [ "x${ENCRYPTION_KEY}" == "x" ]; then + echo "The encryption key has not been provided. Skipping signing preparation" + exit 1 +fi + +if [ "x${ENCRYPTION_IV}" == "x" ]; then + echo "The encryption initialization vector has not been provided. Skipping signing preparation" + exit 2 +fi + +if [ "${TRAVIS_SECURE_ENV_VARS}" == true ]; then + openssl aes-256-cbc -K "${ENCRYPTION_KEY}" -iv "${ENCRYPTION_IV}" -in travis/signing-key.asc.enc -out travis/signing-key.asc -d + if (( $? == 0 )); then + echo "Failed to decrypt the signing key. Skipping." + exit 3 + fi + + gpg --no-tty --batch --allow-secret-key-import --import travis/signing-key.asc + rm -rf "$HOME/.gradle/gradle.properties" + echo signing.keyId="${SIGNING_KEY_ID}" > "$HOME/.gradle/gradle.properties" + echo signing.password="${SIGNING_KEY_PASSPHRASE}" >> "$HOME/.gradle/gradle.properties" + echo ossrhUsername="${SONATYPE_USERNAME}" >> "$HOME/.gradle/gradle.properties" + echo ossrhPassword="${SONATYPE_PASSWORD}" >> "$HOME/.gradle/gradle.properties" + echo signing.secretKeyRingFile="${HOME}/.gnupg/secring.gpg" >> "$HOME/.gradle/gradle.properties" +else + echo "Travis secure env vars not set. Skipping." +fi