Bug 1176507 - The settings.xml file gets deleted along with the repository directory after enabling the force clean build
Summary: The settings.xml file gets deleted along with the repository directory after ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: ImageStreams
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Jason DeTiberus
QA Contact: libra bugs
URL:
Whiteboard:
Depends On: 1176970
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-22 07:43 UTC by Miheer Salunke
Modified: 2019-03-22 07:29 UTC (History)
8 users (show)

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.
Clone Of:
: 1176970 (view as bug list)
Environment:
Last Closed: 2015-02-12 13:09:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0220 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.4 bug fix and enhancement update 2015-02-12 18:08:20 UTC

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


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