Bug 1021722 - Jenkins cartridge unable to create local maven repository at ~/.m2/repository
Jenkins cartridge unable to create local maven repository at ~/.m2/repository
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Jhon Honce
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2013-10-21 18:15 EDT by hexafraction
Modified: 2015-05-14 19:31 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-01-29 19:49:21 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description hexafraction 2013-10-21 18:15:32 EDT
Description of problem:
My Jenkins cartridge is unable to create its ~/.m2/repository directory, which also cannot be created over SSH(access denied)

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

How reproducible:

Steps to Reproduce:
1. Create standalone Jenkins cartridge
2. Log into jenkins on this cartridge, create a new project to be built. Provide access to a valid git repository with a maven repo for the project.
3. Install the JDK and maven as follows:
   a. SCP the tarballs for JDK 7u45 and latest Maven version to ~/jenkins/data
   b. Extract packages, and give Jenkins the locations to which the packages were extracted.
4. Run a Maven-enabled job in Jenkins. Observe its successfully calling JDK and Maven commands(proving it can find and run them). Observe Maven command giving error that it cannot create a repo at ~/.m2
5. Attempt to change the location to which Maven will write its repo with its settings.xml or command-line options in Jenkins. This has no effect. 

Actual results:

Maven unconditionally uses the unusable location ~/.m2 for its repository. This directory does not exist and it cannot be created with mkdir ("Access denied" message)

Expected results:

~/.m2 is writeable and can be created(contingent on disk quota). 

Additional info:

As far as I can tell, this is a showstopper for Maven builds using the Jenkins cartridge short of recompiling Jenkins with changes, as the latter does not allow overriding the location passed to Maven.

The cartridge is new, only a day old. It was created standalone, not by adding jenkins to an existing cartridge, but is not the first application on the domain.

Disk quotas:

[jenkins-mosstest.rhcloud.com 52646f325973ca65bb000260]\> quota
Disk quotas for user 52646f325973ca65bb000260 (uid 6210):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
                 411560       0 1048576            6337       0   40000
[jenkins-mosstest.rhcloud.com 52646f325973ca65bb000260]\> quota -s
Disk quotas for user 52646f325973ca65bb000260 (uid 6210):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
                   402M       0   1024M            6337       0   40000
Comment 1 Jhon Honce 2013-10-22 13:30:30 EDT
Is your cartridge code available for public review?  You should be able to create the ~/.m2 directory during the setup or install scripts for the cartridge.

The current JBoss cartridges have examples of this: https://github.com/openshift/origin-server/blob/stage/cartridges/openshift-origin-cartridge-jbossas/bin/setup#L9
Comment 2 hexafraction 2013-10-22 14:55:17 EDT
Jhon: I am not using my own cartridge. Using my own I can create ~/.m2 just fine. The problem is that the Jenkins cartridge should really be creating this folder itself due to Jenkins' close interaction with Maven.
Comment 3 openshift-github-bot 2013-10-22 23:46:32 EDT
Commit pushed to master at https://github.com/openshift/origin-server

Bug 1021722 - Create ~/.m2 for all jenkins gears
Comment 4 Qiushui Zhang 2013-10-24 06:50:38 EDT
Tested on devenv_3939.

The folder ".m2" will be created successfully.
App build will not meet those errors.

Make the bug as verified.

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