Bug 993558 - User specified JENKINS_WAR_PATH will be ignored during jenkins server build phase
Summary: User specified JENKINS_WAR_PATH will be ignored during jenkins server build p...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Dan McPherson
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-06 07:45 UTC by Meng Bo
Modified: 2015-05-14 23:25 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-07 22:59:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Meng Bo 2013-08-06 07:45:27 UTC
Description of problem:
Set JENKINS_WAR_PATH to any other available value in pre_build or build action_hook. eg, copy the jenkins.war to /root/ and set the value to /root/jenkins.war.

$ cat .openshift/action_hooks/pre_build 
#!/bin/bash
JENKINS_WAR_PATH='/root/jenkins.war'
export JENKINS_WAR_PATH='/root/jenkins.war'
echo $JENKINS_WAR_PATH

During the jenkins server building phase it will always use the default jenkins.war under /usr/lib/jenkins/.

Version-Release number of selected component (if applicable):
devenv_3616

How reproducible:
always

Steps to Reproduce:
1.Create jenkins server
2.Add pre_build action_hook with execute permission
3.Specify the JENKINS_WAR_PATH in the pre_build script
cat .openshift/action_hooks/pre_build 
#!/bin/bash
JENKINS_WAR_PATH='/root/jenkins.war'
export JENKINS_WAR_PATH='/root/jenkins.war'
echo JENKINS_WAR_PATH=$JENKINS_WAR_PATH
4.Git push
5.Check the jenkins server log
$ rhc tail jenkins

Actual results:
The jenkins app will always use the /usr/lib/jenkins/jenkins.war when building.

jenkins.log:
Running from: /usr/lib/jenkins/jenkins.war
webroot: System.getProperty("JENKINS_HOME")
Aug 06, 2013 12:52:13 AM winstone.Logger logInternal
INFO: Beginning extraction from war file
Jenkins home directory: /var/lib/openshift/955786308154953985687552/app-root/data found at: System.getProperty("JENKINS_HOME")
Aug 06, 2013 12:52:17 AM winstone.Logger logInternal
INFO: HTTP Listener started: port=8080
Aug 06, 2013 12:52:17 AM winstone.Logger logInternal

Expected results:
User can specify the customized war for the JENKINS_WAR_PATH

Additional info:
In the control script, there are following lines

  if [ -z "$JENKINS_WAR_PATH" ]; then
         JENKINS_WAR_PATH=/usr/lib/jenkins/jenkins.war
  fi


And the JENKINS_WAR_PATH can be printed out in the git push output.

Total 4 (delta 0), reused 0 (delta 0)
remote: Stopping jenkins cart
remote: Waiting for stop to finish
remote: Starting application jenkins
remote: JENKINS_WAR_PATH=/root/jenkins.war
remote: Starting jenkins cart
remote: Waiting ...
remote: Waiting ...
remote: Still waiting ...
To ssh://871880341879427059154944.rhcloud.com/~/git/jenkins.git/
   748bcc6..a39cab4  master -> master

Comment 1 Dan McPherson 2013-08-06 17:13:43 UTC
I am not sure that pre_build ever worked for this use case.  I am assuming it does based on the bug being opened.  But I think you want to use pre_start_jenkins since otherwise the war you specify would only be used when you push to jenkins (which is a strange thing to do really).  I tried using pre_start_jenkins and that seem to work fine.

-Dan

Comment 2 Meng Bo 2013-08-07 06:04:38 UTC
As Dan said, this worked when set the war_path in pre_start_jenkins-1.4 script.

remote: Stopping jenkins cart
remote: Waiting for stop to finish
remote: Starting application jenkins
remote: JENKINS_WAR_PATH=/root/jenkins.war
remote: Starting jenkins cart
remote: Error: Unable to access jarfile /root/jenkins.war
remote: Waiting ...
remote: Waiting ...
remote: Waiting ...


Close this bug.


Note You need to log in before you can comment on or make changes to this bug.