-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: job-dsl-plugin, workflow-multibranch-plugin
-
Environment:Jenkins 2.19.4, workflow-multibranch 2.9.2, job-dsl 1.53
I have a multibranch pipeline job created by Job DSL that scans a github project.
When it tries to build the branch/job created by the multibranch job it fails trying to clone the sources from github with:
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
Things work when I create or modify the multibranch pipeline job through the UI, but that's not an option because I have to define it through a job dsl script.
The Job DSL script:
multibranchPipelineJob('debug-problem') { branchSources { github { repoOwner('ermshiperete') repository('testproject') scanCredentialsId('72fb065b-94d8-4642-a81e-4ef784922e88') excludes('tags/*') } orphanedItemStrategy { discardOldItems { numToKeep(10) } } triggers { // run once a day if not otherwise run periodic(1440) } } }
Output of failing job:
Branch indexing
Connecting to https://api.github.com using ermshiperete/****** (GitHub ermshiperete for MultiBranch pipeline)
Failed to get git executable
Cloning the remote Git repository
Cloning repository https://api.github.com/ermshiperete/testproject.git
> /usr/bin/git init /var/lib/jenkins/workspace/debug-problem_master-GQUYYD4XVJQFT725TUPAFMPJG2KOOKL3LGLL6UY5O7KBRRBJ4TZQ@script # timeout=10
Fetching upstream changes from https://api.github.com/ermshiperete/testproject.git
> /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials GitHub ermshiperete for MultiBranch pipeline
> /usr/bin/git fetch --tags --progress https://api.github.com/ermshiperete/testproject.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://api.github.com/ermshiperete/testproject.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:85)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:215)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
GitHub has been notified of this commit’s build result
ERROR: null
Finished: FAILURE