Error in Executing Jobs on Slave In Jenkins - ant

I have Master Slave configuration under Jenkins.I wanted to run a job on the slave system under Jenkins I order to do that I have copied the required scripts and files But I have been getting the following error
Started by user anonymous
[EnvInject] - Loading node environment variables.
Building remotely on MySlave in workspace C:\Users\prathamesh.n\workspace\MasterSlave
FATAL: Cannot find executable from the chosen Ant installation "apache-ant-1.9.4"
Build step 'Invoke Ant' marked build as failure
Archiving artifacts
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level C:\Users\sudharshan.r\workspace\Ant\exec\reports\Test 1 to C:\Users\sudharshan.r.jenkins\jobs\Project 11\htmlreports\HTML_Report
ERROR: Specified HTML directory 'C:\Users\sudharshan.r\workspace\Ant\exec\reports\Test 1' does not exist.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: C:/Users/sudharshan.r/workspace/Ant/exec/reports/Test 1/testng-results.xml
Did not find any matching files.
[BFA] Scanning build for known causes...
[BFA] Done. 0s
Finished: FAILURE
need help on executing ant on slave

Click on Jenkins - > Manage Jenkins -> configure system -> Under Ant, define your installer and then in your job select that ant configuration.

Whats your configuration in your build? Default or let's assume my 1.9.
Now in "configure jenkins": Add a specific ant e.g. with name my 1.9.
easiest way is automatic installation and installation from Apache
if you don't want to do this: uncheck automatic installation and give your path were you installed ant in the field: ANT_HOME

Related

Groovy script works in console but not in job

So I've created a Groovy script, and it works in the console. I then implemented it into my job in the field Execute Groovy Script but then it failed.
Here I have the console, and I do know the imports aren't needed, but I had to try.
But When I run my job with this code, I get this error:
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building remotely on Buildsl (hant) in workspace C:\JS\workspace\node_checker
[Vetus_node_checker] $ groovy C:\JS\workspace\node_checker\hudson633049885410603886.groovy
Caught: groovy.lang.MissingPropertyException: No such property: Jenkins for class: hudson633049885410603886
groovy.lang.MissingPropertyException: No such property: Jenkins for class: hudson633049885410603886
at hudson633049885410603886.run(hudson633049885410603886.groovy:6)
Build step 'Execute Groovy script' marked build as failure
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
It look like you are using the "Execute Groovy script", but to execute scripts like in Script Console you must use the "Execute system Groovy script" step.
The normal execute will start a new Java/JVM with Groovy which is not "connected" to your Jenkins.
Only the system step will execute the script within the existing Java/JVM that is running Jenkins.
So yes I had to run it as a Execute system Groovy script, but I also had to give the full path to the lib I'm using, before it worked. the Script Console didn't need the jenkins.model... part, but the job does.

Jenkins pipeline to call SonarQube code coverage for node.js project

I am trying to do code coverage for node js project via Jenkins, I’ve one doubt that where to add the “sonar-project.properties” file, it in root repository that means in sonar-scanner installed repository or in the jenkins path i.e. “/var/lib/jenkins/workspace/$JOB_NAME/”,
can some help to fix this I’m getting error while executing the pipeline.
Error log as follows:
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/sonardemo/bin/sonar-scanner
/var/lib/jenkins/workspace/demosonar#tmp/durable-f32cf5e2/script.sh: 1: /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/sonardemo/bin/sonar-scanner: not found
[Pipeline] }
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?

How to build JMeter script using .jmx file in Jenkins

I have created the .jmx scripts for performance testing and I tried to run through those scripts using GUI mode and NOn-GUI mode in the local system using command window and Jmeter tool and it worked fine.But I want to run this scripts in Jenkins remotely using GitHub.
So is there any possible way for me to run the JMeter scripts in Jenkins.
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Build step 'Invoke Artifactory Maven 3' changed build result to FAILURE
Build step 'Invoke Artifactory Maven 3' marked build as failure
Actually it will be the same, you will just need to add a Jenkins build step in order to fetch the .jmx file from Github prior to running JMeter.
For free-style projects it can be configured in GUI
In case of Groovy pipeline it would be something like:
git branch: 'some', credentialsId: 'your_credentials_id', url: 'https://github.com/apache/jmeter'
References:
Jenkins Source Code Management with Git
Jenkins Pipeline Syntax
Continuous Integration 101: How to Run JMeter With Jenkins

sbt-launch.jar failed - Could not load main class

I have a jenkins build to check sbt, which is failing with the below error:
[sbt-check] $ /var/hudson/tools/java1.8.0_51/bin/java /var/hudson/tools/sbt-0.13.12/bin/sbt-launch.jar -Dsbt.log.noformat=true -jar clean assembly
Error: Could not find or load main class .var.hudson.tools.sbt-0.13.12.bin.sbt-launch.jar
Build step 'Build using sbt' changed build result to FAILURE
Build step 'Build using sbt' marked build as failure
Successfully triggered JIRA to update builds of this job
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 9 second
Notifying upstream projects of job completion
Finished: FAILURE
The sbt package is installed on the server. I downloaded package SBT-0.13.12.TGZ from http://www.scala-sbt.org/download.html and created its RPM to install it on my server. Package is installed and I have configured the path of sbt-launch in manage-jenkins.

Gatling plugin for Jenkins without pom.xml

Has anyone tried to use gatling plugin for jenkins, but without maven? I don't have maven project, but I generate results using Gatling from terminal (bash script). Using -rf switch I change results folder destination to /var/lib/jenkins/jobs/Gatling_test/builds/newest_build/results, but anyway there is error:
Archiving Gatling reports...
ERROR: Publisher com.excilys.ebi.gatling.jenkins.GatlingPublisher aborted due to exception
java.lang.IllegalArgumentException: Could not find a Gatling report in results folder.
at com.excilys.ebi.gatling.jenkins.GatlingPublisher.saveFullReports(GatlingPublisher.java:97)
at com.excilys.ebi.gatling.jenkins.GatlingPublisher.perform(GatlingPublisher.java:65)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
at hudson.model.Run.execute(Run.java:1618)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:247)
Finished: FAILURE
Build just run shell script, and post-build action is set to Track a Gatling load simulation.
Thanks for any suggestions.
I think that you should send your results into the workspace of the job, not the job itself.
In the code the plugin looks for results in the workspace of the build.
Hope this helps!

Resources