From e737e38d7392ad644cafe07b4c4e41dfc9fdf203 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 13 Oct 2017 10:37:16 +0200 Subject: [PATCH] [ci] check for var encrypted_5630fbebf057_iv in setup-secrets This should now allow forked builds to finally run on travis... --- .travis/build-coveralls.sh | 2 +- .travis/build-deploy.sh | 6 +++--- .travis/build-doc.sh | 4 ++-- .travis/build-sonar.sh | 2 +- .travis/common-functions.sh | 18 +++++++++--------- .travis/configure-maven.sh | 6 +++--- .travis/setup-secrets.sh | 12 +++++++++--- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.travis/build-coveralls.sh b/.travis/build-coveralls.sh index e250f80d3b..490dc2c618 100755 --- a/.travis/build-coveralls.sh +++ b/.travis/build-coveralls.sh @@ -15,6 +15,6 @@ fi # for java9: enable all modules. # coveralls plugin seems to need java.xml.bind module # -echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > $HOME/.mavenrc +echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc ./mvnw clean test jacoco:report coveralls:report -Pcoveralls -B -V diff --git a/.travis/build-deploy.sh b/.travis/build-deploy.sh index 17e22e0c26..b0a8513d27 100755 --- a/.travis/build-deploy.sh +++ b/.travis/build-deploy.sh @@ -32,10 +32,10 @@ if travis_isPullRequest; then elif travis_isPush; then - if [[ "$VERSION" != *-SNAPSHOT && "$TRAVIS_TAG" != "" ]]; then - echo "This is a release build for tag $TRAVIS_TAG" + if [[ "${VERSION}" != *-SNAPSHOT && "${TRAVIS_TAG}" != "" ]]; then + echo "This is a release build for tag ${TRAVIS_TAG}" ./mvnw deploy -Possrh,pmd-release -B -V - elif [[ "$VERSION" == *-SNAPSHOT ]]; then + elif [[ "${VERSION}" == *-SNAPSHOT ]]; then echo "This is a snapshot build" ./mvnw deploy -Possrh -B -V push_docs diff --git a/.travis/build-doc.sh b/.travis/build-doc.sh index 5feb08fbad..447f7c63fa 100755 --- a/.travis/build-doc.sh +++ b/.travis/build-doc.sh @@ -25,13 +25,13 @@ zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/ # Uploading pmd doc distribution to sourceforge -if [[ "$TRAVIS_TAG" != "" || "$VERSION" == *-SNAPSHOT ]]; then +if [[ "${TRAVIS_TAG}" != "" || "${VERSION}" == *-SNAPSHOT ]]; then echo -e "\n\nUploading pmd-doc archive to sourceforge...\n\n" rsync -avh pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ fi # rsync site to pmd.sourceforge.net/snapshot -if [[ "$VERSION" == *-SNAPSHOT && "$TRAVIS_BRANCH" == "master" ]]; then +if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then echo -e "\n\nUploading snapshot site...\n\n" travis_wait rsync -ah --stats --delete pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/ fi diff --git a/.travis/build-sonar.sh b/.travis/build-sonar.sh index 5ded5bcb7f..9c09a440cf 100755 --- a/.travis/build-sonar.sh +++ b/.travis/build-sonar.sh @@ -15,7 +15,7 @@ fi # for java9: enable all modules. # sonar plugin seems to need java.xml.bind module # -echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > $HOME/.mavenrc +echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc # Run the build, truncate output due to Travis log limits ./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=${SONAR_TOKEN} -B -V diff --git a/.travis/common-functions.sh b/.travis/common-functions.sh index 129bde4639..c7802946ce 100755 --- a/.travis/common-functions.sh +++ b/.travis/common-functions.sh @@ -2,17 +2,17 @@ set -e -echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" -echo "TRAVIS_PULL_REQUEST_SLUG: $TRAVIS_PULL_REQUEST_SLUG" -echo "TRAVIS_PULL_REQUEST_BRANCH: $TRAVIS_PULL_REQUEST_BRANCH" -echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" -echo "TRAVIS_SECURE_ENV_VARS: $TRAVIS_SECURE_ENV_VARS" -echo "TRAVIS_BRANCH: $TRAVIS_BRANCH" -echo "TRAVIS_TAG: $TRAVIS_TAG" -echo "TRAVIS_ALLOW_FAILURE: $TRAVIS_ALLOW_FAILURE" +echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}" +echo "TRAVIS_PULL_REQUEST_SLUG: ${TRAVIS_PULL_REQUEST_SLUG}" +echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}" +echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}" +echo "TRAVIS_SECURE_ENV_VARS: ${TRAVIS_SECURE_ENV_VARS}" +echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}" +echo "TRAVIS_TAG: ${TRAVIS_TAG}" +echo "TRAVIS_ALLOW_FAILURE: ${TRAVIS_ALLOW_FAILURE}" function travis_isPullRequest() { - if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then return 0 else return 1 diff --git a/.travis/configure-maven.sh b/.travis/configure-maven.sh index 6d1599a4c4..0b8f10a17b 100755 --- a/.travis/configure-maven.sh +++ b/.travis/configure-maven.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -echo "MAVEN_OPTS='-Xms1g -Xmx1g'" > $HOME/.mavenrc -mkdir -p $HOME/.m2 -cp .travis/travis-settings.xml $HOME/.m2/settings.xml +echo "MAVEN_OPTS='-Xms1g -Xmx1g'" > ${HOME}/.mavenrc +mkdir -p ${HOME}/.m2 +cp .travis/travis-settings.xml ${HOME}/.m2/settings.xml diff --git a/.travis/setup-secrets.sh b/.travis/setup-secrets.sh index cb9cf28fdf..b8d4bb04e7 100755 --- a/.travis/setup-secrets.sh +++ b/.travis/setup-secrets.sh @@ -1,12 +1,18 @@ #!/bin/bash set -e -if [ "$TRAVIS_REPO_SLUG" != "pmd/pmd" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "${TRAVIS_SECURE_ENV_VARS}" != "true" ]; then - echo "Not setting up secrets (TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG} TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_SECURE_ENV_VARS=${TRAVIS_SECURE_ENV_VARS})." +if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "${TRAVIS_PULL_REQUEST}" != "false" ] || [ "${TRAVIS_SECURE_ENV_VARS}" != "true" ] || [ "${encrypted_5630fbebf057_iv}" = "" ]; then + echo "Not setting up secrets:" + echo " TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}" + echo " TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}" + echo " TRAVIS_SECURE_ENV_VARS=${TRAVIS_SECURE_ENV_VARS}" + [ "${encrypted_5630fbebf057_iv}" = "" ] && echo " Variable encrypted_5630fbebf057_iv is not set" exit 0 fi -openssl aes-256-cbc -K $encrypted_5630fbebf057_key -iv $encrypted_5630fbebf057_iv -in .travis/secrets.tar.enc -out .travis/secrets.tar -d +echo "Setting up secrets..." + +openssl aes-256-cbc -K ${encrypted_5630fbebf057_key} -iv ${encrypted_5630fbebf057_iv} -in .travis/secrets.tar.enc -out .travis/secrets.tar -d pushd .travis && tar xfv secrets.tar && popd mkdir -p "$HOME/.ssh" chmod 700 "$HOME/.ssh"