Openshift issue with deploying using Jenkins - jenkins

Need some help figuring out how to configure Jenkins on Openshift to deploy an app to Tomcat (JBoss EWS2.0).
The default setup using just rhc commands to instantiate a Jenkins gear and a JBoss EWS gear fails me.
I just changed the URL for the source control part in Jenkins, and it finds the source and the build works.
But it fails when trying to deploy with this message:
[INFO] Installing /var/lib/openshift/532351cee0b8cd0ba4000001/app-root/runtime/repo/pom.xml to /var/lib/openshift/532351cee0b8cd0ba4000001/.m2/repository/ca/architech/apl_web_sk_hb_mp/1.0/apl_web_sk_hb_mp-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.484s
[INFO] Finished at: Fri Mar 14 15:04:18 EDT 2014
[INFO] Final Memory: 9M/179M
[INFO] ------------------------------------------------------------------------
Archiving artifacts
ERROR: No artifacts found that match the file pattern "webapps/**". Configuration error?
ERROR: 'webapps/**' doesn't match anything, but '**' does. Perhaps that's what you mean?
Build step 'Archive the artifacts' changed build result to FAILURE
Finished: FAILURE
I noticed the build and deploy is done through shell with the gear command and all that stuff.
I would prefer to use Maven, since my project is maven-ized already, but then I cannot figure out how to configure the target URL for deployment in the pom.xml either.
So - either one option would do the trick for me!
Appreciate your help, attention and feedback!

I had the same error, i managed to solve it by changing (as suggested) webapps/** by ** in the configurations at the bottom of this page :
http://yourapp-domain.rhcloud.com/job/dev-build/configure
I'm not really sure what it does though...

Related

Jenkins jobs hang indefinitely on maven goal

Summary: A month or two ago we started noticing our Jenkins builds stalling indefinitely. When a build spins up, our Jenkins Shared Library creates a new docker container on a virtual machine and executes the library code to build our service, usually including a maven build. We sporadically see a build or two stall indefinitely on one of various Maven goals (and only maven goals, as seen below). Sometimes this is happens on single build on a virtual machine, but it is most egregious when we run multiple builds at the same time. Some will build, others will stall. All builds on the same virtual machine share an .m2 repository so we don't download dependencies every time.
We are using maven 3.8.1 running in an ubuntu 18.04 container. We're looking for possible leads as we've exhausted all of ours.
We tried upgrading to maven 3.8.2 with no luck, we tried looking into this similar issue but its solution did not apply to us: Jenkins docker container simply hangs and never executes steps
We've also tried having each node have its own maven repository and that didn't work, so we ruled out read/write conflicts.
Details:
Some of the places it stalls:
Mvn help:evaluate after "Picking up Java_Tools_Options...",
Mvn set:property,
On checking on updates from virtual,
On actually downloading from artifactory.
These are a couple example of where it stalls:
[2022-02-22T17:39:15.452Z] + mvn versions:set-property -Dproperty=my.version -DnewVersion=4.0.1 -DgenerateBackupPoms=false -X --debug
[2022-02-22T17:39:15.452Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 -Djenkins.branch.WorkspaceLocatorImpl.PATH_MAX=0 -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400
And
[2022-03-03T13:27:01.046Z] + mvn clean install -P snapshot -Dmaven.test.skip=true -Dbuild.number=32 -U
[2022-03-03T13:27:01.046Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 -Djenkins.branch.WorkspaceLocatorImpl.PATH_MAX=0 -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400
[2022-03-03T13:27:02.425Z] [INFO] Scanning for projects...
[2022-03-03T13:27:04.913Z] [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # sample-child-java ---
[2022-03-03T13:27:05.481Z] Downloading from virtual: https://my.artifactory/org/codehaus/plexus/plexus-java/0.9.10/plexus-java-0.9.10.pom
When we turn on debug mode for maven, we only get a little extra information before it stalls:
02-22T17:39:20.880Z] [DEBUG] Reading global settings from /opt/maven/conf/settings.xml
[2022-02-22T17:39:20.880Z] [DEBUG] Reading user settings from /home/myUser/.m2/settings.xml
[2022-02-22T17:39:20.880Z] [DEBUG] Reading global toolchains from /opt/maven/conf/toolchains.xml
[2022-02-22T17:39:20.880Z] [DEBUG] Reading user toolchains from /home/myUser/.m2/toolchains.xml
[2022-02-22T17:39:20.880Z] [DEBUG] Using local repository at /home/myUser/.m2/repository
[2022-02-22T17:39:21.144Z] [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /home/myUser/.m2/repository
After about 6 hours of stalling, the logs will usually show one of these statements:
Cannot contact myVirtualMachine6: Remote call on myVirtualMachine6 failed. The channel is closing down or has closed down
Wrapper script does not seem to be touching the log file in /home/jenkins/workspace/myService#tmp/durable-7db8f58b
(JENKINS-48300: if on an extremely laggy filesystem, consider - HEARBEAT_CHECK_INTERVAL=86400)
We tried using the withMaven() from the Maven Integration Plugin, but even that did not solve our problem:
11:14:07 + mvn versions:set-property -Dproperty=myService.version -DnewVersion=9.9.9-RC1 -DgenerateBackupPoms=false
11:14:07 Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/home/jenkins/workspace/myService#tmp/withMaven368661c2/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/home/jenkins/workspace/myService#tmp/withMaven368661c2"
11:14:10 [INFO] [jenkins-event-spy] Generate /home/jenkins/workspace/myService#tmp/withMaven368661c2/maven-spy-20220308-161411-4457772303541115170084.log.tmp ...
When we add a tee command to our withMaven() maven commands, the output where it stalls is just:
[INFO] [jenkins-event-spy] Generated /home/jenkins/workspace/myService#tmp/withMavena1de258e/maven-spy-20220308-192941-7666252427488201541499.log
[INFO] [jenkins-event-spy] Generate /home/jenkins/workspace/myService#tmp/withMavena1de258e/maven-spy-20220308-193003-7826277450333225168004.log.tmp ...
Our Jenkinsfile is just this and calling our maven script:
agent {
docker {
label 'myVirtualMachine6'
image 'myImage'
registryUrl 'xxxx'
registryCredentialsId 'yyyy'
args '-v maven-repo:/home/myUser/.m2/repository/ -v /var/run/docker.sock:/var/run/docker.sock'
}
}

Jenkins xUnit test result report

I have a Jenkins job to copy some test reports(XML) to local and convert them to JUnit reports via xUnit.
The issue is that there are no failed or skipped tests, but I always get
[xUnit] [INFO] - Check 'Failed Tests' threshold.
[xUnit] [INFO] - Check 'Skipped Tests' threshold.
[xUnit] [INFO] - Setting the build status to FAILURE
[xUnit] [INFO] - Stopping recording.
Finished: FAILURE
What causes this?
On my previous project I was running 3 development teams with 4 solutions that together consisted an integrated platform all on one Jenkins Master.
I had 2 DOS batch files that were held in a JenkinsScripts/ subdirectory at the root of each solution. One was called CodeCoverage.bat (which ensured OpenCover and ReportGenerator watched the unit tests) which in turn called RunUnitTests.bat passing parameters.
In RunUnitTests.bat the key line with many parameters resolved to:
packages\xunit.runner.console.2.1.0\tools\xunit.console.exe <MyUnitTestProject.dll> -nologo -noshadow -nunit TestReports\TestResults.xml
Hence, I was converting XUnit result XML to NUnit result XML and using the NUnit Plugin to publish the results.
Since I used this approach, the options for mapping of XUnit and NUnit 3 XML to Jenkins friendly JUnit (at my behest mind you) has improved.

Why Travis fails to clone proper revision

my PR - https://travis-ci.org/spring-cloud/spring-cloud-zookeeper/builds/74302452 - continuously fails to build even though locally on 3 different machines it's working.
I receive very bizarre errors like compilation errors and tests failed.
The thing is that I've managed to build the branch - https://travis-ci.org/marcingrzejszczak/spring-cloud-zookeeper/builds/74301310 .
From what I see when Travis builds the PR it fails to take out proper revision. For example I bumped up Groovy to 2.4.4 but in logs you can see
[INFO] --- gmavenplus-plugin:1.4:testCompile (default) # spring-cloud-zookeeper-core ---
[INFO] Using Groovy 2.4.3 to perform testCompile.
[INFO] Compiled 2 files.
whereas locally I have
[INFO] --- gmavenplus-plugin:1.4:testCompile (default) # spring-cloud-zookeeper-core ---
[INFO] Using Groovy 2.4.4 to perform testCompile.
[INFO] Compiled 2 files.
Please help cause I can't merge a fully functional PR.
There were some issues with caching AFAIR.

sbt test ends with No tests to run for test:test under Jenkins

As a former Java developer who is used to using Jenkins to launch JUnit tests every time a build is performed, I would love to get my Specs to run in a similar manner.
When running sbt test in the command line, the test cases that I have set up run just fine. Below is the output from the test run:
[info] MySqlStoreSpec
[info]
[info] MySqlStore Spec should
[info] + getUserIdFromEmail
[info] + getUserUserProperties
[info] + getUserHashFromEmail
[info] + md5
[info] + getUserContextFromStripeId
[info]
[info]
[info] Total for specification MySqlStoreSpec
[info] Finished in 24 ms
[info] 5 examples, 0 failure, 0 error
When I run the build in Jenkins, I get the following message:
[info] No tests to run for test:test
I suspect that the issue with not kicking off the tests has to do with my sbt setup in Jenkins. In the configuration for the build, I am using sbt launcher 0.12.4 and actions test. Does anyone have any experience with getting specs2 to run on Jenkins?
Turns out the issue was the build being performed on the wrong directory. Once the project was checked out from git, it needed to move into a subdirectory to get to the project files. It seems that SBT reports a successful run even if it finds no project files.

Issue building Grails project with Maven

I'm creating a "Mavenised" Grails project but am having trouble running the maven install goal on the project.
To create the project I've used the following archetype: grails-maven-archetype
It has built my project structure correctly and set up all the necessary configuration files (pom.xml etc)
However, when I run mvn install on this I get the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.206s
[INFO] Finished at: Thu Mar 15 10:40:15 GMT 2012
[INFO] Final Memory: 65M/366M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.0.1:maven-test (default) on project MyApp: Unable to start Grails: java.lang.reflect.InvocationTargetException: Native Library C:\Users\<username>\AppData\Local\Temp\jline_.dll already loaded in another classloader -> [Help 1]
However when I run the grails goals that this is trying to run individually e.g. mvn grails:maven-compile they work and I am able to fully build the project.
I am guessing when running mvn install the process is locking the jline_.dll and not releasing it before trying to read it in again in the next goal.
Has anyone seen this issue before? Any advice on how to get around this?
I really need mvn install to build the project correctly so I can set up effective build scripts.
Thanks!
The 2.0.1 version doesn't work on Windows machines. Known issue. Sorry about that, you will need to wait for 2.0.2

Resources