From db13f435e4c834bd981b9a77dc8df0028c96d8eb Mon Sep 17 00:00:00 2001 From: John Blum Date: Wed, 4 May 2022 11:08:34 -0700 Subject: [PATCH] Add CI build shell scripts. --- ci/check.sh | 6 ++++++ ci/cleanupArtifacts.sh | 7 +++++++ ci/cleanupGemFiles.sh | 9 +++++++++ ci/deployArtifacts.sh | 20 ++++++++++++++++++++ ci/deployDocs.sh | 15 +++++++++++++++ ci/setup.sh | 11 +++++++++++ 6 files changed, 68 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..1e04b0d --- /dev/null +++ b/ci/check.sh @@ -0,0 +1,6 @@ +#!/bin/bash -x + +set -eou pipefail + +GRADLE_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home -Djava.io.tmpdir=/tmp" \ + ./gradlew clean check --no-daemon --refresh-dependencies --stacktrace diff --git a/ci/cleanupArtifacts.sh b/ci/cleanupArtifacts.sh new file mode 100755 index 0000000..76f2de6 --- /dev/null +++ b/ci/cleanupArtifacts.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x + +rm -Rf ./.gradle +rm -Rf ./.m2 +rm -Rf `find . -name "build" | grep -v "src"` +rm -Rf `find . -name "target" | grep -v "src"` +exit 0 diff --git a/ci/cleanupGemFiles.sh b/ci/cleanupGemFiles.sh new file mode 100755 index 0000000..5918c83 --- /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" | 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/deployArtifacts.sh b/ci/deployArtifacts.sh new file mode 100755 index 0000000..f63e8fe --- /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 -Duser.home=/tmp/jenkins-home -Djava.io.tmpdir=/tmp" \ + ./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..46bb865 --- /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="--add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED -Duser.name=jenkins -Duser.home=/tmp/jenkins-home -Djava.io.tmpdir=/tmp" \ + ./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..2bc4484 --- /dev/null +++ b/ci/setup.sh @@ -0,0 +1,11 @@ +#!/bin/bash -x + +# User ID 1001 is "jenkins" +# Group ID 1001 is "jenkins" +# Syntax: `chown -R userId:groupId .` + +echo "Logged into Jenkins CI as user [$USER] with home directory [$HOME] in the current working directory [$PWD]" +chown -R 1001:1001 . +#echo "Logging into Docker..." +#docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW} +exit 0