0

First of all, let me inform you that this issue is related to OPENSHIFT. I'm tired of building war with Jenkins and then manually transferring the newly built war file to the server - It's time consuming.

I'm trying to deploy a maven application built from Jenkins in one gear and deploy it in the TOMCAT 7 server which is running in another gear.

I'm using Deploy container plugin via Jenkins to push my war file into the TOMCAT server after being built by the Jenkins. In the tomcat server, I edited the tomcat-users.xml.

<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="manager"/>

I tried to deploy it with JBoss AS 7 available. But could not deploy either - so decided to switch to the Tomcat with hope that deployment in tomcat is easier than in JBoss.

3
  • Are you using OpenShift Jenkins integration? If yes, then it would transfer the WAR itself and you do not need deploy plugin
    – Shekhar
    Apr 27, 2014 at 7:52
  • Are you using OpenShift Jenkins integration? If yes, then it would transfer the WAR itself and you do not need deploy plugin
    – Shekhar
    Apr 27, 2014 at 7:52
  • @Shekhar Do you have any example somewhere?
    – aug70co
    Apr 28, 2014 at 0:07

1 Answer 1

0

Here is how you can do it with Jenkins/execute shell: (This is example is with Java/Maven but you can use it with any other stack.)

source $OPENSHIFT_CARTRIDGE_SDK_BASH
## Aliasing rsynch
alias rsync="rsync --delete-after -az -e '$GIT_SSH'"

## OPENSHIFT_NAMESPACE => redrumapi
## Setting upstream SSH
upstream_ssh="${OPENSHIFT_APP_UUID}@apiserver1-${OPENSHIFT_NAMESPACE}.rhcloud.com"

## Remove previous metadata, if any
rm -f $OPENSHIFT_HOMEDIR/app-deployments/current/metadata.json

#if ! marker_present "force_clean_build"; then
  # don't fail if these rsyncs fail
  #set +e
  rsync $upstream_ssh:'$OPENSHIFT_BUILD_DEPENDENCIES_DIR' $OPENSHIFT_BUILD_DEPENDENCIES_DIR
  rsync $upstream_ssh:'$OPENSHIFT_DEPENDENCIES_DIR' $OPENSHIFT_DEPENDENCIES_DIR
  #set -e
#fi

## Build/update libs and run user pre_build and build
##gear build

cd $OPENSHIFT_DATA_DIR
echo -e "<settings><localRepository>$OPENSHIFT_DATA_DIR.m2</localRepository></settings>" > settings.xml
cd $WORKSPACE
git pull origin master
## Build your project with the settings.xml and other switches that you might need (or not?)
mvn clean install -s $OPENSHIFT_DATA_DIR/settings.xml -P openshift -Djacoco.skip=true -DskipTests -Dbuild.number=${BUILD_NUMBER}


deployment_dir=`$GIT_SSH $upstream_ssh 'gear create-deployment-dir'`

rsync $WORKSPACE/redrum-web/target/your_project.war $upstream_ssh:app-root/runtime/repo/webapps
$GIT_SSH $upstream_ssh "gear remotedeploy --trace --deployment-datetime $deployment_dir"

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.