Author: maven-release Date: 2014-03-05 11:15:00 +0100 (Wed, 05 Mar 2014) New Revision: 55 Url: http://forge.codelutin.com/projects/adminsys/repository/revisions/55 Log: refs #3653 (add authenticate mode) Modified: scripts/maven-release/deploy-to-demo-from-GAV.pom scripts/maven-release/deploy-to-demo-from-GAV.sh Modified: scripts/maven-release/deploy-to-demo-from-GAV.pom =================================================================== --- scripts/maven-release/deploy-to-demo-from-GAV.pom 2014-03-03 11:39:09 UTC (rev 54) +++ scripts/maven-release/deploy-to-demo-from-GAV.pom 2014-03-05 10:15:00 UTC (rev 55) @@ -110,6 +110,10 @@ <property>file</property> <message>You must set a file property!</message> </requireProperty> + <requireProperty> + <property>repo</property> + <message>You must set a repo property!</message> + </requireProperty> </rules> <ignoreCache>true</ignoreCache> <failFast>true</failFast> @@ -137,9 +141,7 @@ <packaging>${packaging}</packaging> <classifier>${classifier}</classifier> <transitive>false</transitive> - <remoteRepositories> - http://nexus.nuiton.org/nexus/content/repositories/other-releases - </remoteRepositories> + <remoteRepositories>${repo}</remoteRepositories> </configuration> </execution> </executions> Modified: scripts/maven-release/deploy-to-demo-from-GAV.sh =================================================================== --- scripts/maven-release/deploy-to-demo-from-GAV.sh 2014-03-03 11:39:09 UTC (rev 54) +++ scripts/maven-release/deploy-to-demo-from-GAV.sh 2014-03-05 10:15:00 UTC (rev 55) @@ -18,13 +18,15 @@ print_usage_and_exit() { echo "-----------------------------------------------------------------------------------" - echo "usage $(basename $0) [-h] [-b] [-d] [-c classifier] [-p packaging] [-e deployFile] -g groupId -a artifactId -v version deployType" + echo "usage $(basename $0) [-h] [-b] [-d] [-c classifier] [-p packaging] [-e deployFile] [-s serverId] [-r repositoryUrl] -g groupId -a artifactId -v version deployType" echo " -h show usage and exit" echo " -b for batch mode (no question asked)" echo " -d for dryRun mode (nothing is deployed)" echo " -c optional classifier of war to grab" echo " -p optional packaging, if not set will use war" echo " -e optional deploy file to use, if not set will use deploy (the file must exists in $DEPLOY_TYPE directory)" + echo " -s optional serverId to use (must then fill the -r option)" + echo " -r optional repository url to use" echo " -g groupId groupId of war to collect" echo " -a artifactId artifactId of war to collect" echo " -v version version of war to collect" @@ -55,8 +57,10 @@ PACKAGING=war CLASSIFIER= DEPLOY_FILE=deploy +REPOSITORY_URL= +SERVER_ID= -while getopts ":g:a:v:c:p:e:hbd" opt; do +while getopts ":g:a:v:c:p:e:s:r:hbd" opt; do case $opt in h) echo "OK" @@ -86,6 +90,12 @@ e) DEPLOY_FILE=$OPTARG ;; + s) + SERVER_ID=$OPTARG + ;; + r) + REPOSITORY_URL=$OPTARG + ;; \?) echo "KO" echo "Invalid option: -$OPTARG" >&2 @@ -108,6 +118,22 @@ fi DEPLOY_TYPE="$1" +# check serverId and repositoryUrl options +if [ ! "$SERVER_ID" = "" ]; then + if [ "$REPOSITORY_URL" = "" ]; then + echo "KO" + echo "Mandatory repository url required (-r) if serverId filled" + print_usage_and_exit 1 + fi + REPOSITORY="$SERVER_ID::::$REPOSITORY_URL" +else + if [ ! "$REPOSITORY_URL" = "" ]; then + REPOSITORY="$REPOSITORY_URL" + else + REPOSITORY="http://nexus.nuiton.org/nexus/content/repositories/other-releases" + fi +fi + # check deploy type exist if [ ! -d $DEPLOY_TYPE ]; then echo "KO" @@ -136,6 +162,7 @@ echo "----------------------------------------------------------" echo "- application = $APPLICATION_NAME" echo "- deployType = $DEPLOY_TYPE" +echo "- repository = $REPOSITORY" echo "- GAV = $GROUP_ID:$ARTIFACT_ID:$PACKAGING:$VERSION" if [ $BATCH_MODE -eq 1 ]; then echo "- batchMode = ON" @@ -148,15 +175,13 @@ fi echo "- file = $DEPLOY_TYPE/$FILE" echo "- deploy file = $DEPLOY_TYPE/$DEPLOY_FILE" - - echo "----------------------------------------------------------" if [ $BATCH_MODE -eq 0 ]; then # ask user to confirm echo -n "Accept the change ? [Y/n]" read r - if [ ! -z "$r" -o "$r" = "Y" -o "$r" = "y" ]; then + if [ -n "$r" -a ! "$r" = "Y" -a ! "$r" = "y" ]; then echo "User cancel operation" bye_bye 1 fi @@ -167,7 +192,7 @@ # get war to deploy echo -n "2/3 Get war $FILE to deploy..." -MVN_OPTIONS="-DgroupId=$GROUP_ID -DartifactId=$ARTIFACT_ID -Dversion=$VERSION -DserverId=$SERVER_ID -Dfile=$FILE -Dpackaging=$PACKAGING -Dclassifier=$CLASSIFIER" +MVN_OPTIONS="-DgroupId=$GROUP_ID -DartifactId=$ARTIFACT_ID -Dversion=$VERSION -Drepo=$REPOSITORY -Dfile=$FILE -Dpackaging=$PACKAGING -Dclassifier=$CLASSIFIER" ${M2_HOME}/bin/mvn -f ~/bin/deploy-to-demo-from-GAV.pom $MVN_OPTIONS > $LOG_FILE test_ok_or_bye_bye $? "Error while executing '${M2_HOME}/bin/mvn $MVN_OPTIONS ..."