I'm a very beginner in Jenkins and afraid that I ask you something not clear with a weird question.
I'd like to deploy my simple node app server to Ubuntu via Jenkins.
I tried to write a command in Build at a Job as below :
./script/deploy.sh
deploy.sh file is here.
#!/bin/sh
EOF
npm install
pm2 restart app.js --name="myApp"
exit
EOF
When I run a build, it stucked with error as
FATAL: Could not checkout 0d563b394d506e8450833e9b36d7a7b44834df39
The Full log of Error.
> git checkout -f 0d563b394d506e8450833e9b36d7a7b44834df39
FATAL: Could not checkout 0d563b394d506e8450833e9b36d7a7b44834df39
hudson.plugins.git.GitException: Command "git checkout -f 0d563b394d506e8450833e9b36d7a7b44834df39" returned status code 1:
stdout:
stderr: error: unable to unlink old 'node_modules/express-session/HISTORY.md': Permission denied
error: unable to unlink old 'node_modules/express-session/LICENSE': Permission denied
error: unable to unlink old 'node_modules/express-session/README.md': Permission denied
error: unable to unlink old 'node_modules/express-session/index.js': Permission denied
error: unable to unlink old 'node_modules/express-session/package.json': Permission denied
error: unable to unlink old 'node_modules/express-session/session/cookie.js': Permission denied
error: unable to unlink old 'node_modules/express-session/session/memory.js': Permission denied
error: unable to unlink old 'node_modules/express-session/session/session.js': Permission denied
error: unable to unlink old 'node_modules/express-session/session/store.js': Permission denied
HEAD is now at 0d563b3 commit
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$900(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2341)
Caused: hudson.plugins.git.GitException: Could not checkout 0d563b394d506e8450833e9b36d7a7b44834df39
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2365)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1242)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1816)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
My questions :
1. How to deploy a node app to ubuntu via Jenkins.
- Is my way right? or another way is better?
2. What error is it as following the log.