From 4dcdbe4e7d06c21700c167418aa6a00acff8e556 Mon Sep 17 00:00:00 2001 From: John Blum Date: Wed, 14 Apr 2021 14:28:01 -0700 Subject: [PATCH] Use Bash shell scripts to encapsulate build steps in the Jenkins CI build stages. --- ci/check.sh | 6 ++++++ ci/cleanupArtifacts.sh | 5 +++++ ci/cleanupGemFiles.sh | 9 +++++++++ ci/deployArtifacts.sh | 20 ++++++++++++++++++++ ci/deployDocs.sh | 15 +++++++++++++++ ci/setup.sh | 14 ++++++++++++++ 6 files changed, 69 insertions(+) create mode 100755 ci/check.sh create mode 100755 ci/cleanupArtifacts.sh create mode 100755 ci/cleanupGemFiles.sh create mode 100755 ci/deployArtifacts.sh create mode 100755 ci/deployDocs.sh create mode 100755 ci/setup.sh diff --git a/ci/check.sh b/ci/check.sh new file mode 100755 index 0000000..b4a5f80 --- /dev/null +++ b/ci/check.sh @@ -0,0 +1,6 @@ +#!/bin/bash -x + +set -eou pipefail + +GRADLE_OPTS="-Duser.name=jenkins -Djava.io.tmpdir=/tmp -Dgradle.user.home=/tmp/geode/session/build-gradle-cache" \ + ./gradlew clean check --no-daemon --refresh-dependencies --stacktrace diff --git a/ci/cleanupArtifacts.sh b/ci/cleanupArtifacts.sh new file mode 100755 index 0000000..9f343d2 --- /dev/null +++ b/ci/cleanupArtifacts.sh @@ -0,0 +1,5 @@ +#!/bin/bash -x + +rm -Rf ./.gradle +rm -Rf ./.m2 +exit 0 diff --git a/ci/cleanupGemFiles.sh b/ci/cleanupGemFiles.sh new file mode 100755 index 0000000..6a7ec30 --- /dev/null +++ b/ci/cleanupGemFiles.sh @@ -0,0 +1,9 @@ +#!/bin/bash -x + +rm -Rf `find . -name "BACKUPDEFAULT*"` +rm -Rf `find . -name "ConfigDiskDir*"` +rm -Rf `find . -name "locator*" | grep -v "src" +rm -Rf `find . -name "newDB"` +rm -Rf `find . -name "server" | grep -v "src"` +rm -Rf `find . -name "*.log"` +exit 0 diff --git a/ci/deployArtifacts.sh b/ci/deployArtifacts.sh new file mode 100755 index 0000000..3ac11b7 --- /dev/null +++ b/ci/deployArtifacts.sh @@ -0,0 +1,20 @@ +#!/bin/bash -x + +set -eou pipefail + +echo "Deploying artifacts on host [$HOSTNAME]" + +# User ID 1001 is "jenkins" +# Group ID 1001 is "jenkins" +# Syntax: `chown -R userId:groupId .` +chown -R 1001:1001 . + +GRADLE_OPTS="-Duser.name=jenkins -Djava.io.tmpdir=/tmp -Dgradle.user.home=/tmp/geode/session/artifacts-gradle-cache" \ + ./gradlew deployArtifacts finalizeDeployArtifacts --no-build-cache --no-configuration-cache --no-daemon --stacktrace \ + -PartifactoryUsername=$ARTIFACTORY_USERNAME \ + -PartifactoryPassword=$ARTIFACTORY_PASSWORD \ + -PossrhUsername=$OSSRH_USERNAME \ + -PossrhPassword=$OSSRH_PASSWORD \ + -Psigning.keyId=$SPRING_SIGNING_KEYID \ + -Psigning.password=$SIGNING_PASSWORD \ + -Psigning.secretKeyRingFile=$SIGNING_KEYRING_FILE diff --git a/ci/deployDocs.sh b/ci/deployDocs.sh new file mode 100755 index 0000000..1568f07 --- /dev/null +++ b/ci/deployDocs.sh @@ -0,0 +1,15 @@ +#!/bin/bash -x + +set -eou pipefail + +echo "Deploying docs on host [$HOSTNAME]" + +# User ID 1001 is "jenkins" +# Group ID 1001 is "jenkins" +# Syntax: `chown -R userId:groupId .` +chown -R 1001:1001 . + +GRADLE_OPTS="-Duser.name=jenkins -Djava.io.tmpdir=/tmp -Dgradle.user.home=/tmp/geode/session/docs-gradle-cache" \ + ./gradlew deployDocs --no-daemon --stacktrace \ + -PdeployDocsSshKeyPath=$DEPLOY_SSH_KEY \ + -PdeployDocsSshUsername=$SPRING_DOCS_USERNAME diff --git a/ci/setup.sh b/ci/setup.sh new file mode 100755 index 0000000..1286d3d --- /dev/null +++ b/ci/setup.sh @@ -0,0 +1,14 @@ +#!/bin/bash -x + +# User ID 1001 is "jenkins" +# Group ID 1001 is "jenkins" +# Syntax: `chown -R userId:groupId .` + +echo "Logged in as user [$USER] with home directory [$HOME] in the current working directory [$PWD]" +chown -R 1001:1001 . +mkdir -p /tmp/geode/session/artifacts-gradle-cache +mkdir -p /tmp/geode/session/build-gradle-cache +mkdir -p /tmp/geode/session/docs-gradle-cache +echo "Logging into Docker..." +docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW} +exit 0