[JIRA] (JENKINS-40191) job created by multibranch pipeline created by job dsl script uses wrong github URL

15 views
Skip to first unread message

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:17:01 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep created an issue
 
Jenkins / Bug JENKINS-40191
job created by multibranch pipeline created by job dsl script uses wrong github URL
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin, workflow-multibranch-plugin
Created: 2016/Dec/02 3:16 PM
Environment: Jenkins 2.19.4, workflow-multibranch 2.9.2, job-dsl 1.53
Labels: pipeline
Priority: Major Major
Reporter: ickersep

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:
{{
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}}

Things work when I create or modify the multibranch pipeline job through the UI.

The Job DSL script is:

{{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) }

}
}
}}

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:18:02 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
Change By: ickersep
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:

{{
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:

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:21:02 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
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.

The Job DSL script:

{ code}
    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)
            }
        }
    }
{code}

Output of failing job:

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:22:05 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
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:


{noformat}
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
{noformat}



Things work when I create or modify the multibranch pipeline job through the UI.

The Job DSL script:

{code}
    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)
            }
        }
    }
{code}

Output of failing job:

{noformat}
{noformat}

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:23:02 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
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:


{noformat}
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
{noformat}



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 .

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:24:01 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
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:


{noformat}
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
{noformat}

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:

{code
:groovy }

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:24:02 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
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:


{noformat}
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
{noformat}

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:

{code: groovy javascript }

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:24:02 AM12/2/16
to jenkinsc...@googlegroups.com
ickersep updated an issue
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:


{noformat}
stderr: fatal: unable to access 'https://api.github.com/ermshiperete/testproject.git/': The requested URL returned error: 403
{noformat}

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:

{code :javascript }

ickersep@java.net (JIRA)

unread,
Dec 2, 2016, 10:48:01 AM12/2/16
to jenkinsc...@googlegroups.com
            github {
                repoOwner('ermshiperete')
                repository('testproject')
                scanCredentialsId('72fb065b-94d8-4642-a81e-4ef784922e88')
                excludes('tags/*')
            }

use this:

            git {
                remote('https://github.com/ermshiperete/testproject')
                credentialsId('72fb065b-94d8-4642-a81e-4ef784922e88')
                excludes('tags/*')
            }

scm_issue_link@java.net (JIRA)

unread,
Dec 21, 2016, 5:15:02 PM12/21/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Daniel Spilker
Path:
docs/Home.md
job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/workflow/BranchSourcesContext.groovy
job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/workflow/GitHubBranchSourceContext.groovy
job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/workflow/BranchSourcesContextsSpec.groovy
http://jenkins-ci.org/commit/job-dsl-plugin/2ac48b01fad3314225c32443af06bc34ad52a283
Log:
fixed problem with API URI

[FIXES JENKINS-40191]

scm_issue_link@java.net (JIRA)

unread,
Dec 21, 2016, 5:15:02 PM12/21/16
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Dec 21, 2016, 5:15:03 PM12/21/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Daniel Spilker
Path:
docs/Home.md
job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/workflow/BranchSourcesContext.groovy
job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/workflow/GitHubBranchSourceContext.groovy
job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/workflow/BranchSourcesContextsSpec.groovy

mail@daniel-spilker.com (JIRA)

unread,
Dec 24, 2016, 9:56:02 AM12/24/16
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages