getting error using jenkins pipe line - jenkins

when i'm trying to copy using jenkins pipe job,getting beloe error. what was the exact issue?
Started by user balajinew
Building in workspace /var/lib/jenkins/workspace/copyjob
[copyjob] $ /bin/bash /tmp/jenkins8729334247736026943.sh
cp: cannot stat ‘/home/ec2-user/jenkins-1.0-SNAPSHOT.jar’: Permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Related

Jenkins cannot read json file

I am trying to use postman/newman to auto test my API collection on Jenkins(build on docker),
I have successfully used the following shell (the url is the sample on postman Official website)
newman run "https://www.postman.com/collections/8a0c9bc08f062d12dcda"
but while I change the url to my own collection(I put in my git project),
url : newman run "http://localhost:8080/job/projectName/ws/pm/collection.json"
the eror messqge shows that
+ newman run http://localhost:8080/job/projectName/ws/pm/collection.json
error: collection could not be loaded
the url "http://localhost:8080/job/xxx/ws/pm/collection.json" did not provide valid JSON data
Unexpected token '<' at 1:1
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fjob%2Fmone
^
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I also tried
url : newman run "localhost:8080/job/projectName/ws/pm/collection.json"
and the error code become
error: collection could not be loaded
unable to read data from file "localhost:8080/job/projectName/ws/pm/collection.json"
ENOENT: no such file or directory, open 'localhost:8080/job/projectName/ws/pm/collection.json'
Anyone can help? Please!!!
I just fix the path and it works!
The path should be pm/collection.json
http://localhost:8080/job/xxx/ws/pm/collection.json is from workspace

Protractor: Jenkins won't build project locally (mac)

As I'm trying to run a sample jenkins project from my machine. However, I it won't build my project locally.
I outline the set up in this jing video
What did I do wrong?
What specific steps should I use to fix it.
Error message from jenkins
Started by user Jacqueline George
Building in workspace /Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining
[LocatorTraining] $ cmd /c call /var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins6260102670441278278.bat
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
Caused: java.io.IOException: Cannot run program "cmd" (in directory "/Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:935)
at hudson.Launcher$ProcStarter.start(Launcher.java:454)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1819)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Build configuration
How I am executing the build
Code after using npm run protractor in shell
Started by user Jacqueline George
Building in workspace /Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining
[LocatorTraining] $ /bin/sh -xe /var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins563599888073808645.sh
+ npm run protractor
npm ERR! path /Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jacquelinegeorge/.npm/_logs/2018-11-13T10_38_04_562Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I made a modification to the build. I selected 'shell' (as I'm a mac user) not windows batch (as my tutor instructed). I also removed customer workspace from my configuration
Added the following command in 'build'
/Users/JacquelineGeorge/Documents/Jenkins/LocatorTraining&&npm run
protractor
It still failed but this message was at least different.
I also tried this with and without ${JENKINS_HOME} under
General>Advanced>use custom workspace
Building in workspace /Users/jacquelinegeorge/.jenkins/workspace/Protractor
[Protractor] $ /bin/sh -xe /var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins8556486662152409824.sh
+ /Users/jacquelinegeorge/Documents/Jenkins/LocatorTraining
/var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins8556486662152409824.sh: line 2: /Users/jacquelinegeorge/Documents/Jenkins/LocatorTraining: is a directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The failure is due to you choose build step of Execute window batch command. But your Jenkins slave machine (where your test script resides) is a linux.
You should choose Execute shell for that build step.
Ok, I'm going to to do a summary of this conversation.
From your project page select configure
Scroll down to build
Under build select shell
enter cd /Users/YourUserNameHere/YourProjectWorkSpace/ProjectFolder/FileName&&npm run protractor
Save
When you click build now. Your project should now build locally from your machine.

ant build failes on Jenkins

When I start the Jenkins build, on arriving on ant-build-step the build is canceled immediately with the following stack:
...
[PROJECT] $ cmd.exe /C "D:\jenkins\tools\hudson.tasks.Ant_AntInstallation\Ant\bin\ant.bat -file build-jenkins.xml -Djenkins.result.dir=${JENKINS.WORKSPACES}/Results "-Dbranch=*/develop" -Djenkins.result.dir=C:/Tools/Jenkins/Results -Djenkins.workspace.dir=C:\Tools\Jenkins\Project-SNAPSHOT\workspace/PRO_56/PRO/java/Project -Dproject.path=C:\Tools\Jenkins\Project-SNAPSHOT\workspace clean.compile.jar.server.snapshot -v && exit %%ERRORLEVEL%%"
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
...
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
I get no debug messages, nothing.
I've got other project with a similar/equal config which work. I think it could be a incompatibility of my plugins.
Has anyone experienced this bug before?
In my case the problem was a big M in the java options of the ant-build-step.
Here no m for Megabit und M für Megabyte.
-Xmx1024M
-Xms1024m

Allure: Jenkins Plugin is not able to generate report

Could you please help with the follow?
Running the protractor test.
Jenkins plugin is not able to generate report.
Error: 404 not found.
Allure plugin: 2.19
Allure commandline: 1.54
Protractor: 5.1.2
Jenkins is run locally: 2.60.1
NodeJS: 6.9.4
NPM: 4.0.5
Error stack trace: allure-report for the report is already in use, add a '--clean' option to overwrite.
Stack trace:
[11:56:19] I/launcher - 0 instance(s) of WebDriver still running
[11:56:19] I/launcher - chrome #01 failed 1 test(s)
[11:56:19] I/launcher - overall: 1 failed spec(s)
[11:56:19] E/launcher - Process exited with error code 1
npm ERR! Test failed. See above for more details.
Build step 'Execute Windows batch command' marked build as failure
[protractor-allure-reporting-example] $ D:\Jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure-commandline\allure-2.2.1\bin\allure.bat generate
D:\Jenkins\workspace\protractor-allure-reporting-example\first-result -o
D:\Jenkins\workspace\protractor-allure-reporting-example\allure-report
Allure: Target directory D:\Jenkins\workspace\protractor-allure-reporting-
example\allure-report for the report is already in use, add a '--clean' option to overwrite
ERROR: Build step failed with exception ru.yandex.qatools.allure.jenkins.exception.AllurePluginException: Can not generate Allure Report, exit code: 1
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:173)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:94)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621)
at hudson.model.Run.execute(Run.java:1760)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
Build step 'Allure Report' marked build as failure
Finished: FAILURE
Seems like you need to clean your workspace before build. Or you can add one more step before report generation that will remove allure-report directory.
Add it in package.json scripts
"posttest": "allure generate allure-results --clean -o allure-report || true && allure report open -o allure-report"
try to check that in the docker container where your allure report generated not able to detect java_home. So try to set your report path where your container ends and then your allure report will able to find java_home.
and able to generate report.
Use below command to check the same:
sh "/var/lib/.../ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/../bin/allure --version"

running protractor tests with jenkins on linux

I have test cases in
/home/name/Develop/myproject/gateway path. I am running tests without any error this path with gulp protractor qa command.
I install jenkins and setted a job. Just name, description and shell command. Here is shell command for build:
cd /home/name/Develop/myproject/gateway && gulp protractor qa
When I try to run this jenkins job I am getting this error on jenkins job console output:
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/deneme2
[deneme2] $ /bin/sh -xe /tmp/hudson4619805372336742976.sh
+ cd /home/name/Develop/myproject/gateway
+ gulp protractor qa
[14:02:54] Using gulpfile /home/name/Develop/myproject/gateway/gulpfile.js
[14:02:54] Starting 'protractor'...
[14:02:54] Starting 'qa'...
[14:02:54] Finished 'qa' after 93 μs
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/atoms/error.js:108
var template = new Error(this.message);
^
UnknownError: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-47- generic x86_64)
at new bot.Error (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
at Object.bot.response.checkResponse (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
at /home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24
at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
at goog.async.run.processWorkQueue (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/goog/async/run.js:124:15)
at process._tickCallback (node.js:368:9)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at new Driver (/home/name/Develop/myproject/gateway/node_modules/selenium-webdriver/chrome.js:810:36)
at [object Object].DirectDriverProvider.getNewDriver (/home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/driverProviders/direct.js:68:16)
at [object Object].Runner.createBrowser (/home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:186:37)
at /home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:276:21
at _fulfilled (/home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/q/q.js:759:13)
at /home/name/Develop/myproject/gateway/node_modules/gulp-protractor/node_modules/q/q.js:525:49
[launcher] Process exited with error code 1
[14:03:55] gulp-notify: [JHipster Gulp Build] Error: protractor exited with code 1
[14:03:55] Finished 'protractor' after 1 min
[14:03:55] E2E Tests failed
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I searched but I couldnt find any solution. Where I am wrong?
Thanks for answers.
I would write a comment, but i'm not allowed to xD
It could be a rights problem. Jenkins does probably not have the rights to access a global installation of gulp or protractor.
Try something like this: ./node_modules/gulp/gulp.js protractor qa

Resources