问题
I have Jenkins instance on Openshift
I've enabled Jenkins build of my Openshift application Here part of Jenkins shell script parts and logs what they produce :
# Sync any libraries
rsync $upstream_ssh:~/.m2/ ~/.m2/
# Build/update libs and run user pre_build and build
gear build
command above triggers such action
+ gear build
Found pom.xml... attempting to build with 'mvn -e clean package -Popenshift -DskipTests'
Apache Maven 3.0.3 (r1075437; 2011-06-20 13:22:37-0400)
Maven home: /etc/alternatives/maven-3.0
I want to customize maven options (in this case allow to run test by deleting -DskipTests part )
Further in script I tried to add some steps combining with disabling this gear build command
# Run tests here
mvn -e clean package -Popenshfit
Above run mvn clean package but doesn't update last successful artifact, and logs shows
[WARNING] The requested profile "openshfit" could not be activated because it does not exist.
I have that profile in my pom.xml so I don't know what happening
<profiles>
<profile>
<id>openshift</id>
This is doesn't working to:
mvn --global-settings $OPENSHIFT_MAVEN_MIRROR clean package -Popenshift
Probably above is some old staff (taken from https://www.openshift.com/blogs/jenkins-polyglot-persistence-part-2)
Any idea about customizing this gear build or overriding maven options on Openshift are welcome :) I can make changes directly on machines (jenkins, jenkins-build) (as far free openshift account allow me :))
Edit
Some workaround is to run
gear build and then mvn clean package so I get build run twice and all test goals are meet and war is deployed on upstream instance and additionally Cobertura reports work fine with my Jbehave tests but this is inelegant, resources consuming solution.
回答1:
I found this question while "Doing my homework" with regards to another question about Maven in OpenShift -- as to how OpenShift uses the Maven profile during the build process, broadly, as towards a goal of installing a "customized" third-party .war file providing the Liferay portal, along with some 'module' customizations, in an app using the 'jbossas' cartridge.
Although my portal-gproj app doesn't use Jenkins in its build -- as I expect that it won't have a spare gear available for Jenkins, initially, of the three "free gears" available to start with. It's a scalable app, though. However, I've found a reference item, as a blog entry by Bill DeCoste such that at least mentions two configuration features about Jenkins, as with regards to customization of OpenShift Maven builds in Jenkins: http://blog-judcon.rhcloud.com/?p=16 To summarize, the article mentions, with regards to Jenkins: One "Build/Execute shell section of the Job configuration."
Though I've not used Jenkins, myself, but I've seen it in use, however -- I think it's used in the eXo Platform for instance. I assume that Jenkins would have a sort of web-based interface for job configuration? (I tend to prefer the shell/filesystem interface onto Maven, personally)
Alternately, there is the OpenShift Origin Server source code, and an OpenShift Origin System Architecture Guide corresponding, as in reference to the OpenShift Origin baseline, on which (I assume) OpenShift Online is running, in its layer on the Amazon EC2 cloud. "If all else fails, there's the source code," just like in so many things Red Hat, LOL. It seems that there are both jenkins and jenkins-client cartridges under OpenShift Origin. Certainly, the details of the process used by either of those cartridges would be apparent from its source code.
Hope this helps! Coffee cheers.
来源:https://stackoverflow.com/questions/18827057/overriding-openshift-maven-script-jenkins-gear