TSK-901: replaced deploy stage with single maven call.

This commit is contained in:
Mustapha Zorgati 2019-10-21 04:39:32 +02:00
parent 8bcde0a40b
commit e68c9bae1b
3 changed files with 32 additions and 104 deletions

View File

@ -5,6 +5,9 @@ language: java
jdk: jdk:
- openjdk8 - openjdk8
git:
depth: 3
services: services:
- docker - docker
- xvfb # required because our frontend tests currently use firefox as a browser (and thus do not run headless) - 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 script: ci/compile.sh $MODULE
before_cache: rm -rf $HOME/.m2/repository/pro/taskana before_cache: rm -rf $HOME/.m2/repository/pro/taskana
- stage: "Release / Deploy" - 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 . install: ci/change_version.sh -m .
&& ( cd web && npm install ) && ( cd web && npm install )
&& ( cd web && npm run build:prod ) && ( 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 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 prepare-package -pl :taskana-rest-spring-test
&& mvn -q install -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-rest-spring-example && 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" script: |
name: release / deploy / commit mvn deploy -T 4C -P `[[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot"` \
script: for i in $DEPLOY_MODULES; do ci/release.sh $i; done --settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -pl !:taskana-spring-example,!:taskana-cdi-example,\
after_success: ci/change_version.sh -i -m . && ci/commitPoms.sh !:taskana-rest-spring-example,!:taskana-rest-spring-wildfly-example
before_cache: rm -rf $HOME/.m2/repository/pro/taskana before_cache: rm -rf $HOME/.m2/repository/pro/taskana
after_success: ci/change_version.sh -i -m . && ci/commitPoms.sh
deploy: deploy:
provider: cloudfoundry provider: cloudfoundry
username: $BLUEMIX_ACCOUNT username: $BLUEMIX_ACCOUNT

View File

@ -1,24 +1,23 @@
<settings> <settings>
<servers> <profiles>
<server> <profile>
<id>ossrh</id> <id>ossrh</id>
<username>${env.OSSRH_JIRA_USERNAME}</username> <activation>
<password>${env.OSSRH_JIRA_PASSWORD}</password> <activeByDefault>true</activeByDefault>
</server> </activation>
</servers> <properties>
<gpg.executable>gpg</gpg.executable>
<profiles> <gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
<profile> <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
<id>ossrh</id> </properties>
<activation> </profile>
<activeByDefault>true</activeByDefault> </profiles>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile> <servers>
</profiles> <server>
<id>ossrh</id>
<username>${env.OSSRH_JIRA_USERNAME}</username>
<password>${env.OSSRH_JIRA_PASSWORD}</password>
</server>
</servers>
</settings> </settings>

View File

@ -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 <module> [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 <module>.
#H format: ^v[0-9]+\.[0-9]+\.[0-9]+$
#H if the format is wrong it will be ignored.
#H
#H requirements:
#H
#H - <module>'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 "$@"