build job( build docker image ,code from github) in slave machine by configuration,but it do not build success...if change job in master ,it build success
slave build message :
Started by user admin
Building remotely on jenkins-slave (slave) in workspace /home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq
Cloning the remote Git repository
Cloning repository git#github.com:xxxxxxx/wcount.git
> git init /home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq # timeout=10
Fetching upstream changes from git#github.com:xxxxxxx/wcount.git
> git --version # timeout=10
using GIT_SSH to set credentials 71bnh6gke9kmabye9qu2qsazzpofjsa
> git -c core.askpass=true fetch --tags --progress git#github.com:xxxxxxx/wcount.git +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url git#github.com:xxxxxxx/wcount.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url git#github.com:xxxxxxx/wcount.git # timeout=10
Fetching upstream changes from git#github.com:xxxxxxx/wcount.git
using GIT_SSH to set credentials 71bnh6gke9kmabye9qu2qsazzpofjsa
> git -c core.askpass=true fetch --tags --progress git#github.com:xxxxxxx/wcount.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse origin/master^{commit} # timeout=10
Checking out Revision 5730301886fa5c02522705de817c5ddac0f0dbce (origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 5730301886fa5c02522705de817c5ddac0f0dbce
> git rev-list 5730301886fa5c02522705de817c5ddac0f0dbce # timeout=10
ERROR: Build step failed with exception
java.lang.IllegalArgumentException: configured dockerFolder '/home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq' does not exist.
at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:93)
at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:75)
master workspace is /home/jenkins_home/workspace
slave workspace is /home/jenkins/workspace
i can find /home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq directory in slave node。
i guess this build in master node,but i see the task in slave queue
jenkins docker-build-step plugin don't support task run on slave node,so you can change some code to support it 。
add a jar to slave which can create image and push image。then master invoke this jar in slave
Not sure if that's the case here, but it seems that Jenkins sets a path to Dockerfile in Docker build/create task at Build stage as $WORKSPACE/docker so you either have to ensure you have that folder (containing Dockerfile and other needed files) in your workspace/git repo or just remove docker from path ENV above (which is a better solution, imho) and Jenkins will read Dockerfile from main workspace/git directory. Hope that helps.
Related
I have configured a jenkins test job just to clone a git repo and provided the "Repository URL" like below
https://oauth2:glpat-Vn4Vgvft7-2W4P1m4b4Z#gitlab.com/test/batch/test.git
but while running the job I am getting the console error output as below
Cloning the remote Git repository
Cloning repository https://oauth2:glpat-Vn4Vgvft7-2W4P1m4b4Z#gitlab.com/test/batch/test.git
> git init /jenkins/jobs/test/workspace # timeout=10
Fetching upstream changes from https://oauth2#gitlab.com/test/batch/test.git
> git --version # timeout=10
Setting http proxy: 10.203.195.26:8080
> git fetch --tags --progress https://oauth2#gitlab.com/test/batch/test.git
+refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
The question is, while it is cloning it is showing the URL as https://oauth2:pass#gitlab.com
but why the password is not coming while fetching?
I am trying to build simple Jenkins build job in my local workspace. I have built simple mvc gradle application. Jenkins build job has been setup with required gradel task but getting below error for jmx
Running as SYSTEM
Building in workspace C:\Users\harshal\.jenkins\workspace\MVCApp
The recommended git tool is: NONE
No credentials specified
> git.exe rev-parse --resolve-git-dir C:\Users\harshal\.jenkins\workspace\MVCApp\.git # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/harshalpatil2012/HelloWorld-MVC-App.git # timeout=10
Fetching upstream changes from https://github.com/harshalpatil2012/HelloWorld-MVC-App.git
> git.exe --version # timeout=10
> git --version # 'git version 2.9.0.windows.1'
> git.exe fetch --tags --progress -- https://github.com/harshalpatil2012/HelloWorld-MVC-App.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
Checking out Revision a7cf612bd16cc92d5e56137284de5318ce9beec2 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f a7cf612bd16cc92d5e56137284de5318ce9beec2 # timeout=10
Commit message: "spring gradle demo app"
> git.exe rev-list --no-walk a7cf612bd16cc92d5e56137284de5318ce9beec2 # timeout=10
[MVCApp] $ C:\Windows\system32\cmd.exe -xe C:\Softwares\apache-tomcat-8.5.75\temp\jenkins5788250459304119055.sh
Microsoft Windows [Version 10.0.18363.1556]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\harshal\.jenkins\workspace\MVCApp>[Gradle] - Launching build.
[MVCApp] $ cmd.exe /C "C:\Users\harshal\.jenkins\workspace\MVCApp\gradlew.bat clean build && exit %%ERRORLEVEL%%"
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
I have disabled jmx as below but still not sure why I am gettign same error in build execution.
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
I have deployed JENKINS war in my local tomcat 8.5 using intellj
The error is telling you that there is some service or process using port 1099. You need to find what process is using that port, then kill/end it (or change the port gradle is using) and rerun your job. I'm not a Windows user but the same principle should follow: Using NetStat.exe you can see the used ports in your machine with their processes. Also this answer can also help you.
This issue was due to the Intellj trying to connect to JMX during startup. I switched to eclipse and Jenins setup was working correctly via my eclipse tomcat server deployment.
Super frustrating because this is working on one of my windows slaves, but not this one- and I cant find any config differences.
On the working slave I see this:
[Pipeline] checkout
Cloning the remote Git repository
Cloning repository git#bitbucket.org:myteam/myapp.git
> git init C:\Jenkins\workspace\test-slave123456 # timeout=10
Fetching upstream changes from git#bitbucket.org:myteam/myapp.git
> git --version # timeout=10
using GIT_SSH to set credentials mygitcreds
> git fetch --tags --progress git#bitbucket.org:myteam/myapp.git +refs/heads/*:refs/remotes/origin/* # timeout=45
> git config remote.origin.url git#bitbucket.org:myteam/myapp.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url git#bitbucket.org:myteam/myapp.git # timeout=10
Fetching upstream changes from git#bitbucket.org:myteam/myapp.git
using GIT_SSH to set credentials mygitcreds
> git fetch --tags --progress git#bitbucket.org:myteam/myapp.git +refs/heads/*:refs/remotes/origin/* # timeout=45
> git rev-parse "origin/test-slave^{commit}" # timeout=10
Checking out Revision 30f11ef09ab13f73fb9a6b75983e1bf32437f51d (origin/test-slave)
Enabling Git LFS pull
> git config core.sparsecheckout # timeout=10
> git checkout -f 30f11ef09ab13f73fb9a6b75983e1bf32437f51d # timeout=45
> git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials mygitcreds
> git lfs pull origin # timeout=45
Commit message: "test slave"
> git rev-list --no-walk 30f11ef09ab13f73fb9a6b75983e1bf32437f51d # timeout=10
But on the failing slave:
[Pipeline] checkout
Cloning the remote Git repository
Cloning repository git#bitbucket.org:myteam/myapp.git
> git init C:\Jenkins\workspace\test-slave123456 # timeout=10
Fetching upstream changes from git#bitbucket.org:myteam/myapp.git
> git --version # timeout=10
using GIT_SSH to set credentials mygitcreds
> git fetch --tags --progress git#bitbucket.org:myteam/myapp.git +refs/heads/*:refs/remotes/origin/* # timeout=45
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress git#bitbucket.org:myteam/myapp.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: gituserfromcredbinding#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Its the same pipeline job, same repo, same creds, and the slave should be configured the same but when I change the agent to point to the other slave it cant clone.
On the working slave all i had to do was install git for windows (turn off windows cred store), install java, and then run the jnlp jar.
Tried to do the same thing on the non working slave so I dont know why that one could be failing.
Bitbucket is not able to authenticate you on the slave where it is not working.
Reason could be:
You have not setup the ssh key for the slave where it is not working
Or
The key which is there is not associated to the account you are
trying to use.
If creds etc everything is same, what you can try :
1.Copy the keys present inside the "known_hosts" file in the working slave.
2.Paste the keys copied in step 1 above into the "known_hosts" file of non-working slave.
If in case keys are also same in both the slaves try :
ssh into non-working slave and manually try to clone once. Reason being if you have never used that slave(non-working) earlier then it might ask for : "The authenticity of host, Are you sure you want to continue connecting (yes/no)" , for which you have to say Yes, only one time.
I change git bash from ver: 2.22.0 to ver:2.12.0 (and I select the 'Enable windows cred store'), the windows slave works again
I have a multibranch pipeline project in Jenkins. I have had two main branches (master and production) running for some time correctly. But one of the steps is to build a new version of node docker image (on a slave Raspberry pi) for the ultimate base for the production system. I felt it would be better to isolate that step in its own branch so that we can control when we upgrade the version.
So I made a branch off master called "node" and altered the Jenkinsfile to just have the step that build node in it. I also upped the version of node it was to build (to 7.10.0).
Multibranch indexing finds the new branch, but then does nothing with it. How do I find out why?
Here is the output from the scan/indexing run
Started by timer
[Sun May 07 21:43:00 BST 2017] Starting branch indexing...
> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to alan#kanga.home:dev/pasv5
> git config remote.origin.url alan#kanga.home:dev/pasv5 # timeout=10
Fetching origin...
Fetching upstream changes from origin
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
using GIT_ASKPASS to set credentials
> git ls-remote alan#kanga.home:dev/pasv5 # timeout=10
> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to alan#kanga.home:dev/pasv5
> git config remote.origin.url alan#kanga.home:dev/pasv5 # timeout=10
Fetching & pruning origin...
Fetching upstream changes from origin
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune
Getting remote branches...
Seen branch in repository origin/master
Seen branch in repository origin/node
Seen branch in repository origin/production
Seen 3 remote branches
Checking branch master
‘Jenkinsfile’ found
Met criteria
No changes detected: master (still at 8c4fddfa66f26af0089f0e55afcd2ac9e13152ef)
Checking branch production
‘Jenkinsfile’ found
Met criteria
No changes detected: production (still at fa97e2fd76895c958a484b21fb4d4852ad000c9b)
Checking branch node
Done.
[Sun May 07 21:43:01 BST 2017] Finished branch indexing. Indexing took 0.27 sec
Finished: SUCCESS
Note on master and production it notes Jenkinsfile found, but on node it doesn't. Why?
My fault - under the "Advanced" options in the project configuration of git, you can list the branches to consider. I had put in there master and production and not node. As soon as I changed that, it started processing the new branch.
Solutions
When configing the branchs to build remove the wildcard *:
*/master to be only master
This error only occours when a GIT SCM is related to the JOB.
Ex: I have a daily job to build an Android project.
First i thought that it was a cron problem, currently im using 50 10 * * *, but i have tried H 10 * * * without any success. When the time comes, it always build the job (Failure or Success) and it queue another job.. and so on...
Would last have run at Friday, May 22, 2015 10:01:58 AM BRT; would next run at Saturday, May 23, 2015 10:01:58 AM BRT.
Even a build with parameter it queue a another job everytime.
So it stays in a build loop, forever..
Config:
Jenkins ver. 1.614.
Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-46-generic x86_64)
GIT client plugin: 1.17.1
GIT plugin: 2.3.5
Console Output:
Started by an SCM change
Building in workspace .../jobs/PROJECT_NAME/workspace
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url ssh://GIT_ADDRESS/ # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
> git reset --hard # timeout=10
> git clean -fdx # timeout=10
Fetching upstream changes from ssh://GIT_ADDRESS/
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress ssh://GIT_ADDRESS/ +refs/heads/master:refs/remotes/origin/master
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Multiple candidate revisions
Scheduling another build to catch up with PROJECT_NAME
Checking out Revision e6d726c2d31cb0d7e6fad4362ee85e6fac1712c6 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f e6d726c2d31cb0d7e6fad4362ee85e6fac1712c6
> git rev-list e6d726c2d31cb0d7e6fad4362ee85e6fac1712c6 # timeout=10
[Gradle] - Launching build.
[android] $ gradle clean build assemble
...
Maybe the problem is this?
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Multiple candidate revisions
Scheduling another build to catch up with PROJECT_NAME
The build loop:
Job Config:
Global Config:
Review the beginning of the console logs, for both the job that you manually started, and the job that gets queued next automatically.
In the beginning of the console log, it gives a reason for why the build was triggered, for example 09:46:05 Started by an SCM change or 16:06:58 Started by user Slav. Please add to the question the start of both console logs.
Edit:
Now that we know that Jenkins detects an SCM change trigger we can further speculate that what's causing this behaviour is an SCM post-commit hook of some sort, or another script activation sending a request to Jenkins.
Post-commit hooks should not work if SCM polling is not enabled, but nothing else makes sense, so let's investigate that avenue. Add /pollingLog/ to the build URL of the build number that was triggered "by SCM change". There is a chance that nothing would be found, but if there is, but let's make sure.
Next, if possible, bind Jenkins to a different IP address and/or port. If there are "rogue" scripts that are triggering secondary builds, they won't be able to adapt to changed address.
Edit 2:
Looks like there is a bug in git client plugin itself, it was fixed in version 1.6.2. Please check the version of your git plugins.
Sources: https://issues.jenkins-ci.org/browse/JENKINS-10767 and https://issues.jenkins-ci.org/browse/JENKINS-20286
Above screen shot looks fine but i am sure there must be some other configuration.
can you provide detail (rest of the) configuration too?
Please give below code in Build periodically section and try if that resolves the issue
H(0-50) 10 * * *
Make sure your repo doesn't have more than one branch that matches your Branch Specifier by using the full path to the branch: "refs/heads/master" instead of "*/master"