Thanks for any of your advice, Mark!

Maybe I should make myself more clear:
I have 2 projects under my bitbucket account, I want to build project 1 
(i.e to build a docker image with Dockerfile) but it will use the pipeline 
scripts in project 2. So I create a pipeline job for project 1 and use my 
credentials to check it out, but in my project 1 Jenkinsfile, I use the 
following line to call a script in my project 2 repo.   
 "fileLoader.fromGit('script_to_call', '
https://bitbucket.org/myproject/script-repo.git', 'master')

So the problem is that Jenkins used my credential and checked out project 1 
without any issue, and then executed the pipeline in Jenkinsfile, but when 
it tried to check out project 2, it won't use the same credential:
.......

[Pipeline] checkoutCloning the remote Git repository
Cloning repository https://bitbucket.org/myproject/scripts-repo.git 
<https://bitbucket.org/assam1/jenkins-job-scripts.git>
.....
 > git fetch --tags --progress https://bitbucket.org/myproject/scripts-repo.git 
 > <https://bitbucket.org/assam1/jenkins-job-scripts.git> 
 > +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'hudson.plugins.git.GitException 
<http://stacktrace.jenkins-ci.org/search?query=hudson.plugins.git.GitException>:
 Command "git fetch --tags --progress https://bitbucket.org/ 
<https://bitbucket.org/assam1/jenkins-job-scripts.git>myproject/scripts-repo.git
 <https://bitbucket.org/assam1/jenkins-job-scripts.git> 
+refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: Invalid username or password. If you log in via a third party 
service you must ensure you have an account password set in your account 
profile. 

fatal: Authentication failed for 'https://bitbucket.org/ 
<https://bitbucket.org/assam1/jenkins-job-scripts.git/>
myproject/scripts-repo.git 
<https://bitbucket.org/assam1/jenkins-job-scripts.git>/ 
<https://bitbucket.org/assam1/jenkins-job-scripts.git/>' 
I am really confused which account profile it refers to. If I am adding the 
credential in Jenkinsfile as I mentioned in my earlier post, it will work.
 "fileLoader.fromGit('script_to_call', '
https://bitbucket.org/myproject/script-repo.git', 'master', 
'xxxxxx-xxxx-xxx-xxxxxxx')

Just don't want to specify 2 times with the same credentials - there should 
be a way to pass it between the 2 repos when they are checked out in one 
building process.

thanks! 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/63cedb3d-2659-4f56-ba2e-a7691d9898f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to