Bug 1176970 - 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 CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Jakub Hadvig
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks: 1176507
TreeView+ depends on / blocked
 
Reported: 2014-12-23 16:37 UTC by Luke Meyer
Modified: 2019-03-22 07:30 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1176507
Environment:
Last Closed: 2015-02-18 16:53:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Luke Meyer 2014-12-23 16:37:57 UTC
+++ This bug was initially created as a clone of Bug #1176507 +++

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
~~~

--- Additional comment from RHEL Product and Program Management on 2014-12-22 02:57:30 EST ---

Since this issue was entered in bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 1 openshift-github-bot 2015-01-07 22:57:56 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/70ed80147c4043a669f9b99ab47e0472aaeb105f
BUG 1176970: Delete all dependencies except settings.xml

Comment 2 Jakub Hadvig 2015-01-07 23:07:39 UTC
Now the settings.xml file will be preserved even if the force clean build marker will be added.

Comment 3 Wenjing Zheng 2015-01-08 05:45:39 UTC
Verified on devenv_5381.
1. Configure to use global maven settings.xml with below steps:
# mkdir -p /etc/openshift/skel/.m2/
# cp $(rpm -ql $(rpm -qa | grep maven) | grep settings.xml) /etc/openshift/skel/.m2/
2. Create a jboss app,here I have tested with jbosseap-6, jbossas-7, jbossews 1. and 2.0
3. Check the settings.xml exists under ${OPENSHIFT_HOMEDIR}.m2 after ssh to app
4. touch .openshift/markers/force_clean_build
5. Push changes
6. Check the settings.xml still exists.


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