Jenkins CodeDeploy plugin errors - jenkins

So I am using the Jenkins codedeploy plugin to trigger an S3 bucket put of a zip file that is being pulled from my BitBucket repo so then CodeDeploy can deploy the revision to my EC2 instances. Some services via Jenkins succeed, but others fail with this log error. Note: the permissions on /tmp directory is 700.
I thought in order to avoid this warning error, "npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})" I could do npm install --no-optional but that clearly wasnt the reason why the build was not successful. Another good thing to note is that multiple services are using the same code deploy application and deployment group to install to the same instance. i.e each service is pulled from a different branch and pushed to the same instance via Code Deploy. I know it sounds super complex, but any help here is really appreciated!
Started by user xxxx
Building in workspace /var/lib/jenkins/workspace/Livit-Dev_Node
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://xxxx # timeout=10
Fetching upstream changes from https://xxxx
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress xxxx+refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/BRIDG-oauth-
implementation^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/BRIDG-oauth-
implementation^{commit} # timeout=10
Checking out Revision 0a2ebd5f1633483cea93d8a627870ac794a6556c
(refs/remotes/origin/BRIDG-oauth-implementation)
> git config core.sparsecheckout # timeout=10
> git checkout -f 0a2ebd5f1633483cea93d8a627870ac794a6556c
Commit message: "Merged in Test-Commit (pull request #22)"
> git rev-list --no-walk f7b3a6a9a26e413412bb5ddadec504da9500ba35 #
timeout=10
[Livit-Dev_Node] $ /bin/sh -xe /tmp/jenkins6283232840818429990.sh
+ npm -v 5.6.0
+ npm install --no-optional
npm WARN livit-backend#1.0.0 No repository field.
npm WARN livit-backend#1.0.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3
(node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform
for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current:
{"os":"linux","arch":"x64"})
up to date in 6.31s
Zipping files into /tmp/#13-767184457865657281.zip
Failed CodeDeploy post-build step; exception follows.
Unable to get file permissions
hudson.os.PosixException: Unable to get file permissions null
at hudson.util.IOUtils.mode(IOUtils.java:133)
at hudson.util.io.ZipArchiver.visit(ZipArchiver.java:55)
at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
at hudson.util.DirScanner$Glob.scan(DirScanner.java:131)
at hudson.FilePath$1.invoke(FilePath.java:473)
at hudson.FilePath$1.invoke(FilePath.java:469)
at hudson.FilePath.act(FilePath.java:1009)
at hudson.FilePath.act(FilePath.java:987)
at hudson.FilePath.archive(FilePath.java:469)
at hudson.FilePath.zip(FilePath.java:456)
atcom.amazonaws.codedeploy.AWSCodeDeployPublisher.zipAndUpload(AWSCodeDeployPublisher.java:358)
at com.amazonaws.codedeploy.AWSCodeDeployPublisher.perform(AWSCodeDeployPublisher.java:230)
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:744)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at

Related

Unable to build a Jenkins project. prompting java issues

Running as SYSTEM
Building in workspace /Users/mac/.jenkins/workspace/trainSchedule
The recommended git tool is: NONE
No credentials specified
git rev-parse --resolve-git-dir /Users/mac/.jenkins/workspace/trainSchedule/.git # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins # timeout=10
Fetching upstream changes from https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins
git --version # timeout=10
git --version # 'git version 2.30.1 (Apple Git-130)'
git fetch --tags --force --progress -- https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 1603f84d1f50794623c71673920fc3111280045f (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 1603f84d1f50794623c71673920fc3111280045f # timeout=10
Commit message: "specify a newer version of node and npm"
First time build. Skipping changelog.
[Gradle] - Launching build.
[trainSchedule] $ /Users/mac/.jenkins/workspace/trainSchedule/gradlew build
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '19'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE

Jenkins - Couldn't find any revision to build

I have been using Jenkins for a few days, and before: I used the GITEA plugin
Now that I have switched my projects to GitBucket, I would like to use the "Build by Webhook" Feature.
I followed many tutorials, and now : i'm stuck on a simple/big problem.
In advance, I'm sorry to have to blur the sensitive links, I know it can be annoying.
Here is the full error :
using credential 10
Wiping out workspace first.
Contributing variables:
Cloning the remote Git repository
Cloning repository https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT
> git init /Jenkins/workspace/GitBUcket # timeout=10
Fetching upstream changes from https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT
> git --version # timeout=10
> git --version # 'git version 2.20.1'
using GIT_ASKPASS to set credentials Utilisateur GitBucket Perso
> git fetch --tags --force --progress -- https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
Seen 0 remote branches
> git show-ref --tags -d # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Here is my configuration on Jenkins : https://i.stack.imgur.com/jdlTt.png
Thank you very much in advance
EDIT : My only branche is master --> https://i.imgur.com/lXJ0xyN.png
This is what you can try:
Manage Jenkins -> Global Tool Configuration -> Git
Check if Path to Git executable is set: C:\PATH\git.exe
Dashboard -> select your job -> Configure -> Source Code Management -> select Git
Insert your Repository URL and Credentials(Optional) then under Branches to build change */master to */main.

How to run a command from the GitHub directory that Jenkins clones into?

I put "make" in Jenkins's Execute Shell, following the tutorial here https://github.com/jbankes/Hello_Jenkins, but Jenkins does not run the make from the underlying Github repository, as shown in the error message below.
What is the right way to demand Jenkins to run "make" from its monitored GitHub repository?
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/test003
The recommended git tool is: NONE
No credentials specified
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/zhoulaifu/Hello_Jenkins # timeout=10
Fetching upstream changes from https://github.com/zhoulaifu/Hello_Jenkins
> git --version # timeout=10
> git --version # 'git version 2.20.1'
> git fetch --tags --force --progress -- https://github.com/zhoulaifu/Hello_Jenkins +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision bc3931a313e4f3945c257ae3247e63265b1debb7 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f bc3931a313e4f3945c257ae3247e63265b1debb7 # timeout=10
Commit message: "Otherside (#5)"
> git rev-list --no-walk bc3931a313e4f3945c257ae3247e63265b1debb7 # timeout=10
[test003] $ /bin/sh -xe /tmp/jenkins2704537311990415428.sh
+ make
make: *** No targets specified and no makefile found. Stop.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
In the repository Make file located inside original folder. So to be able to run Make you need navigate to it.
After git clone execute cd original/ and then run Make.

How to add Bitbucket repository in to jenkins?

I have a ruby on rails code in bitbucket private repository. And i have added my repository remote into jenkins as follows:
https://bitbucket.org/myuser_name/demo_app
followed by Credentials:
Kind: username and password
and i have given bitbucket username and password into it.
Before i am saving the project configuration i got no error under Repository URL. So i thought i configured source code management correct. But when i am building the project i am getting this error.
Building in workspace /var/lib/jenkins/workspace/demo_app
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://bitbucket.org/myuser_name/demo_app # timeout=10
Fetching upstream changes from https://bitbucket.org/myuser_name/demo_app
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username myuser_name # timeout=10
> git config --local credential.helper store --file=/tmp/git1159546302445779982.credentials # timeout=10
> git -c core.askpass=true fetch --tags --progress https://bitbucket.org/myuser_name/demo_app +refs/heads/*:refs/remotes/origin/*
> git config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://bitbucket.org/myuser_name/demo_app
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress https://bitbucket.org/myuser_name/demo_app +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: error: cannot fork() for git credential-store --file=/tmp/git1159545779982.credentials get: Cannot allocate memory
error: cannot fork() for /bin/echo: Cannot allocate memory
fatal: could not read Password for 'https://myuser_name#bitbucket.org': No such device or address
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
... 11 more
ERROR: null
Finished: FAILURE
So where am i going wrong?
It would be better to include your project with deployment keys instead of username/password.
To add deployment keys to your bitbucket project go to https://bitbucket.org/myuser_name/demo_app/admin/deploy-keys/ .
Add your keys to Jenkins. On the project configuration page 'Source Code Management' -> 'Credentials' -> 'Add'. Choose 'SSH Username and privat key'. Add your username 'git' and your privat key.
I do not know if today changed the way to do this, but some time ago I had to make a hook in Bitbucket to perform this task:
more info

Grails 3.1.2 project by Jenkins: Unknown command-line option '-n'

I copy-pasted jenkins job (which works in Grails 2.4.5) but it fails in new Grails 3.1.2 project:
Started by user Michal Szulc
Building in workspace <http://jenkins.example.com/job/project-server/ws/>
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.project-server_repository.url http://git.example.pl/scm/es/project-server.git # timeout=10
Fetching upstream changes from http://git.example.pl/scm/es/project-server.git
> /usr/bin/git --version # timeout=10
using .gitcredentials to set credentials
> /usr/bin/git config --local credential.helper store --file=/tmp/git6110612657385406031.credentials # timeout=10
> /usr/bin/git -c core.askpass=true fetch --tags --progress http://git.example.pl/scm/es/project-server.git +refs/heads/*:refs/remotes/project-server_repository/*
> /usr/bin/git config --local --remove-section credential # timeout=10
> /usr/bin/git rev-parse refs/remotes/project-server_repository/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/project-server_repository/project-server_repository/master^{commit} # timeout=10
Checking out Revision eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90 (refs/remotes/project-server_repository/master)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90
> /usr/bin/git rev-list eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90 # timeout=10
[project-server] $ /var/lib/jenkins/tools/com.g2one.hudson.grails.GrailsInstallation/3.1.2/bin/grails -Dgrails.work.dir=<http://jenkins.example.com/job/project-server/ws//target> -Dserver.port=40855 clean --non-interactive --plain-output
Error |
Command [clean] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.11-bin.zip'.
Problem with provided build arguments: [-non-interactive, --console, plain].
Unknown command-line option '-n'.
Either it is not a valid build option or it is not supported in the target Gradle version.
Not all of the Gradle command line options are supported build arguments.
Examples of supported build arguments: '--info', '-u', '-p'.
Examples of unsupported build options: '--daemon', '-?', '-v'.
Please find more information in the javadoc for the BuildLauncher class. (Use --stacktrace to see the full trace)
Build step 'Build With Grails' marked build as failure
If I run ./gradlew clean or ./gradlew war in local environment it works perfectly. How to run it by jenkins?
I'm still not sure why this situation has happened but I resolved an issue by changing Build -> Build With Grails -> Targets:
clean "war api.project-server.pl.war"
to:
"war api.project-server.pl.war"

Resources