Bug 1176507

Summary: The settings.xml file gets deleted along with the repository directory after enabling the force clean build
Product: OpenShift Container Platform Reporter: Miheer Salunke <misalunk>
Component: ImageStreamsAssignee: Jason DeTiberus <jdetiber>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 2.2.0CC: bleanhar, cryan, gpei, jialiu, jokerman, libra-onpremise-devel, lmeyer, mmccomas
Target Milestone: ---Keywords: NeedsTestCase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-jbosseap-2.24.0.1-1, openshift-origin-cartridge-jbossews-1.32.0.1-1 Doc Type: Bug Fix
Doc Text:
Cause: The JBOSS EAP cartridge incorrectly removed Maven settings.xml during a force clean build. Consequence: Maven configuration in settings.xml would be lost. Fix: The JBOSS EAP cartridge no longer removes settings.xml on a force clean build. Result: Maven settings.xml is no longer lost.
Story Points: ---
Clone Of:
: 1176970 (view as bug list) Environment:
Last Closed: 2015-02-12 13:09:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1176970    
Bug Blocks:    

Description Miheer Salunke 2014-12-22 07:43:12 UTC
Description of problem:

When force clean build marker is used all the content along with the settings.xml from .m2 directory of the gear is deleted as seen from the code: 

~~~
if force_clean_build_enabled_for_latest_deployment; then
echo "force_clean_build marker found; removing Maven dependencies."
rm -rf ${OPENSHIFT_HOMEDIR}.m2/* ${OPENSHIFT_HOMEDIR}.m2/.[^.]*
fi
~~~

Also, if we configure global maven settings.xml file as mentioned in this article : https://access.redhat.com/solutions/535653 and then create a new gear the .m2 directory  for the gear is populated with a copy of /etc/openshift/skel/.m2/settings.xml  and everything works as expected.

When we enable force clean build, the settings.xml file gets deleted along with the repository that gets created after downloading the dependencies and the next build results in fail. 


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

How reproducible:
Always

Steps to Reproduce:
1.Configure global maven settings.xml file as mentioned in this article : https://access.redhat.com/solutions/535653
2.Create a new gear having jboss cartridge
3.Enable force clean build

Actual results:
The settings.xml file gets deleted along with the repository directory after enabling the force clean build


Expected results:
The settings.xml file shouldn't be deleted along with the repository directory after enabling the force clean build


Additional info:
The next time when a build is performed the settings.xml file from skel directory must be copied to the .m2 directory.

OR

In short the rm line in the code should be replaced with something like: 

~~~
if force_clean_build_enabled_for_latest_deployment; then
echo "force_clean_build marker found; removing Maven dependencies."
rm -rf ${OPENSHIFT_HOMEDIR}.m2/* ${OPENSHIFT_HOMEDIR}.m2/.[^.]*    ## Replace with: find ${OPENSHIFT_HOMEDIR}.m2/ -type f -not -name 'settings.xml' -delete
fi
~~~

Comment 4 Gaoyun Pei 2015-01-26 07:37:54 UTC
Verified on puddle 2.2/2015-01-23.2.

1. Configure to use global maven settings.xml following https://access.redhat.com/solutions/535653

2. Create a jbosseap app, check the settings.xml exists under ${OPENSHIFT_HOMEDIR}.m2 after ssh to app

3. Touch .openshift/markers/force_clean_build marker and git push this change.

4. The settings.xml under ${OPENSHIFT_HOMEDIR}.m2 is still there.

5. This also works well for jbossews-1.0 and jbossews-2.0 cartridge.

Comment 6 errata-xmlrpc 2015-02-12 13:09:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0220.html