From e68c9bae1b8a56b288e9b8fa288342e5fa187c27 Mon Sep 17 00:00:00 2001
From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com>
Date: Mon, 21 Oct 2019 04:39:32 +0200
Subject: [PATCH] TSK-901: replaced deploy stage with single maven call.
---
.travis.yml | 17 +++++++---
ci/mvnsettings.xml | 41 ++++++++++++------------
ci/release.sh | 78 ----------------------------------------------
3 files changed, 32 insertions(+), 104 deletions(-)
delete mode 100755 ci/release.sh
diff --git a/.travis.yml b/.travis.yml
index 36d641bf0..a3594687a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,9 @@ language: java
jdk:
- openjdk8
+git:
+ depth: 3
+
services:
- docker
- xvfb # required because our frontend tests currently use firefox as a browser (and thus do not run headless)
@@ -58,19 +61,23 @@ matrix:
script: ci/compile.sh $MODULE
before_cache: rm -rf $HOME/.m2/repository/pro/taskana
-
- stage: "Release / Deploy"
+ name: release / deploy / commit
+ before_install: |
+ openssl aes-256-cbc -K "$encrypted_21a5d40e43a3_key" -iv "$encrypted_21a5d40e43a3_iv" \
+ -in "ci/codesigning.asc.enc" -out "ci/codesigning.asc" -d && gpg --import "ci/codesigning.asc"
install: ci/change_version.sh -m .
&& ( cd web && npm install )
&& ( cd web && npm run build:prod )
&& mvn -q install -T 4C -am -DskipTests -DmFaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-rest-spring-test
&& mvn -q prepare-package -pl :taskana-rest-spring-test
&& mvn -q install -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-rest-spring-example
- env: DEPLOY_MODULES=". lib lib/taskana-core lib/taskana-cdi lib/taskana-spring web rest rest/taskana-rest-spring rest/taskana-rest-spring rest/taskana-rest-spring-base"
- name: release / deploy / commit
- script: for i in $DEPLOY_MODULES; do ci/release.sh $i; done
- after_success: ci/change_version.sh -i -m . && ci/commitPoms.sh
+ script: |
+ mvn deploy -T 4C -P `[[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot"` \
+ --settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -pl !:taskana-spring-example,!:taskana-cdi-example,\
+ !:taskana-rest-spring-example,!:taskana-rest-spring-wildfly-example
before_cache: rm -rf $HOME/.m2/repository/pro/taskana
+ after_success: ci/change_version.sh -i -m . && ci/commitPoms.sh
deploy:
provider: cloudfoundry
username: $BLUEMIX_ACCOUNT
diff --git a/ci/mvnsettings.xml b/ci/mvnsettings.xml
index ca553ba4e..4a09501ab 100644
--- a/ci/mvnsettings.xml
+++ b/ci/mvnsettings.xml
@@ -1,24 +1,23 @@
-
-
- ossrh
- ${env.OSSRH_JIRA_USERNAME}
- ${env.OSSRH_JIRA_PASSWORD}
-
-
-
-
-
- ossrh
-
- true
-
-
- gpg
- ${env.GPG_KEY_NAME}
- ${env.GPG_PASSPHRASE}
-
+
+
+ ossrh
+
+ true
+
+
+ gpg
+ ${env.GPG_KEY_NAME}
+ ${env.GPG_PASSPHRASE}
+
+
+
-
-
+
+
+ ossrh
+ ${env.OSSRH_JIRA_USERNAME}
+ ${env.OSSRH_JIRA_PASSWORD}
+
+
\ No newline at end of file
diff --git a/ci/release.sh b/ci/release.sh
deleted file mode 100755
index 4fd16a5ed..000000000
--- a/ci/release.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-set -e # fail fast
-
-#H Usage:
-#H release.sh -h | release.sh --help
-#H
-#H prints this help and exits
-#H
-#H release.sh [version]
-#H
-#H an easy deployment tool to deploy maven projects.
-#H
-#H module:
-#H
-#H path to maven project
-#H
-#H version:
-#H
-#H new version for the .
-#H format: ^v[0-9]+\.[0-9]+\.[0-9]+$
-#H if the format is wrong it will be ignored.
-#H
-#H requirements:
-#H
-#H - 's pom file contains the profiles 'release' and 'snapshot'
-#H - the files
-#H * mvnsettings.xml
-#H * codesigning.asc.enc
-#H have to exist in the same folder as this script
-#H - the environment variables
-#H * encrypted_21a5d40e43a3_key
-#H * encrypted_21a5d40e43a3_iv
-#H have to exist (in order to decode codesigning.asc.enc)
-# Arguments:
-# $1: exit code
-function helpAndExit {
- cat "$0" | grep "^#H" | cut -c4-
- exit "$1"
-}
-
-# decripting gpg keys and importing them (needed to sign artifacts)
-# Global:
-# $encrypted_21a5d40e43a3_key: decription key
-# $encrypted_21a5d40e43a3_iv: initialisation vector
-# Arguments:
-# $1: basedir
-function decodeAndImportKeys {
- if [[ ! -f "$1/codesigning.asc" ]]; then
- openssl aes-256-cbc -K "$encrypted_21a5d40e43a3_key" -iv "$encrypted_21a5d40e43a3_iv" -in "$1/codesigning.asc.enc" -out "$1/codesigning.asc" -d
- gpg --import "$1/codesigning.asc"
- fi
-}
-
-# deploying a given project
-# Arguments:
-# $1: project folder (dir)
-# $2: profile name
-# $3: settings file (dir)
-function release {
- mvn deploy -f "$1" -P "$2" --settings "$3" -DskipTests=true -B -U -N
-}
-
-# changing version in pom and all its children
-# Arguments:
-# $1: directory of pom
-# $2: new version
-function change_version {
- mvn versions:set -f "$1" -DnewVersion="$2" -DartifactId=* -DgroupId=* versions:commit
-}
-
-function main {
- [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0
- [[ "$1" == '.' && "$2" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && change_version "$1" "${2##v}"
- decodeAndImportKeys `dirname "$0"`
- release "$1" `[[ "$2" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot"` "`dirname "$0"`/mvnsettings.xml"
-}
-
-main "$@"