From b2c1363d7622ff5caaf0274448ae48f7b575371a Mon Sep 17 00:00:00 2001 From: John Blum Date: Mon, 5 Apr 2021 15:26:31 -0700 Subject: [PATCH] Move 'docker login' command to setup.sh. Move 'chown' and and 'mkdir /tmp/jenkins-home' commmands to setup.sh. Add 'exit 0' commands to the cleanup Bash shell scripts. Add 'echo' commands to log build progress. --- Jenkinsfile | 7 +++++-- ci/check.sh | 2 -- ci/cleanupArtifacts.sh | 4 ++-- ci/cleanupGemFiles.sh | 3 +-- ci/setup.sh | 7 +++++++ 5 files changed, 15 insertions(+), 8 deletions(-) create mode 100755 ci/setup.sh diff --git a/Jenkinsfile b/Jenkinsfile index b70cd1dd..b5df65a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,9 +33,12 @@ pipeline { docker.withRegistry('', 'hub.docker.com-springbuildmaster') { docker.image('adoptopenjdk/openjdk8:latest').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') { + sh "echo 'Setting up build environment...'" + sh "ci/setup.sh" + // Cleanup any prior build system resources try { - sh "echo 'Cleaning up build artifacts & old GemFire/Geode files...'" + sh "echo 'Cleaning up build artifacts & GemFire/Geode files...'" sh "ci/cleanupGemFiles.sh" sh "ci/cleanupArtifacts.sh" } @@ -43,7 +46,7 @@ pipeline { // Run the SBDG project Gradle build using JDK 8 inside Docker try { - sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}" + sh "echo 'Building SBDG...'" sh "ci/check.sh" } catch (e) { diff --git a/ci/check.sh b/ci/check.sh index 0873380f..f21fce61 100755 --- a/ci/check.sh +++ b/ci/check.sh @@ -1,8 +1,6 @@ #!/bin/bash -x set -eou pipefail -mkdir -p /tmp/jenkins-home -chown -R 1001:1001 . GRADLE_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ ./gradlew --no-daemon --refresh-dependencies --stacktrace clean check diff --git a/ci/cleanupArtifacts.sh b/ci/cleanupArtifacts.sh index e6393301..1effaf0c 100755 --- a/ci/cleanupArtifacts.sh +++ b/ci/cleanupArtifacts.sh @@ -1,6 +1,6 @@ #!/bin/bash -x -set -eou pipefail -chown -R 1001:1001 . rm -Rf ./.gradle rm -Rf ./.m2 +exit 0 + diff --git a/ci/cleanupGemFiles.sh b/ci/cleanupGemFiles.sh index 0e211994..5918c838 100755 --- a/ci/cleanupGemFiles.sh +++ b/ci/cleanupGemFiles.sh @@ -1,10 +1,9 @@ #!/bin/bash -x -set -eou pipefail -chown -R 1001:1001 . rm -Rf `find . -name "BACKUPDEFAULT*"` rm -Rf `find . -name "ConfigDiskDir*"` rm -Rf `find . -name "locator*" | grep -v "src" | grep -v "locator-application"` rm -Rf `find . -name "newDB"` rm -Rf `find . -name "server" | grep -v "src"` rm -Rf `find . -name "*.log"` +exit 0 diff --git a/ci/setup.sh b/ci/setup.sh new file mode 100755 index 00000000..2466b511 --- /dev/null +++ b/ci/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x + +mkdir -p /tmp/jenkins-home +chown -R 1001:1001 . +echo "Logging into Docker..." +docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW} +exit 0