Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72766

Declarative Pipeline implicit checkout fails with GitHub app credentials

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-client-plugin
    • None
    • All latest version as of writing. Controller runs on truenas scale.

      I uploaded the log that shows that I configured the github app as mentioned in the docs but the declarative checkout doesn't work, all other features work. I got it working by manually configuring GitSCM but it's a bad experience after doing so much setup work for the Github app. 

      How I fixed it: 
      options

      { skipDefaultCheckout true }

      stages {
      stage('Checkout') {
      steps

      { checkout([ $class: 'GitSCM', branches: [[name: '*/main']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[ credentialsId: 'ssh-github', url: 'git@github.com:rootitnow/rootstrap.git' ]] ]) }

      }

          [JENKINS-72766] Declarative Pipeline implicit checkout fails with GitHub app credentials

          Jordan added a comment - - edited

          I'm experiencing the same issue.  

           
          15:32:53 Started by user
          XXXX
          15:32:53 hudson.plugins.git.GitException: Command "git config remote.origin.url
          http://url
          " returned status code 128:15:32:53 stdout: 15:32:53 stderr: fatal: not in a git directory*15:32:53* 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2842)15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2762)15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2757)15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2063)15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1662)15:32:53 at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:180)15:32:53 at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:393)15:32:53 at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219)15:32:53 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:124)15:32:53 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:71)15:32:53 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)15:32:53 at hudson.model.ResourceController.execute(ResourceController.java:101)15:32:53 at hudson.model.Executor.run(Executor.java:442)15:32:53 [withMaven] downstreamPipelineTriggerRunListener - Failure to introspect build steps: java.io.IOException: RDH/TDExtract #935 did not yet start*15:32:53* [withMaven] downstreamPipelineTriggerRunListener - Failure to introspect build steps: java.io.IOException: RDH/TDExtract #935 did not yet start*15:32:53* Finished: FAILURE

           

           

          It seems as if i can't specify the repo from where to pull the jenkinsfile in the pipeline script

          Jordan added a comment - - edited I'm experiencing the same issue.     15:32:53 Started by user XXXX 15:32:53 hudson.plugins.git.GitException: Command "git config remote.origin.url http://url " returned status code 128: 15:32:53 stdout: 15:32:53 stderr: fatal: not in a git directory*15:32:53* 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2842) 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2762) 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2757) 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051) 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2063) 15:32:53 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1662) 15:32:53 at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:180) 15:32:53 at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:393) 15:32:53 at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219) 15:32:53 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:124) 15:32:53 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:71) 15:32:53 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311) 15:32:53 at hudson.model.ResourceController.execute(ResourceController.java:101) 15:32:53 at hudson.model.Executor.run(Executor.java:442) 15:32:53 [withMaven] downstreamPipelineTriggerRunListener - Failure to introspect build steps: java.io.IOException: RDH/TDExtract #935 did not yet start*15:32:53* [withMaven] downstreamPipelineTriggerRunListener - Failure to introspect build steps: java.io.IOException: RDH/TDExtract #935 did not yet start*15:32:53* Finished: FAILURE     It seems as if i can't specify the repo from where to pull the jenkinsfile in the pipeline script

          Mark Waite added a comment -

          jjitzchaki are you sure that you are using a GitHub App credential in your failure case? Are you sure that you're using an implicit checkout with a declarative Pipeline? Your failure message seems to be in a different location.

          Mark Waite added a comment - jjitzchaki are you sure that you are using a GitHub App credential in your failure case? Are you sure that you're using an implicit checkout with a declarative Pipeline? Your failure message seems to be in a different location.

          Jordan added a comment -

          I'm connecting to local Bitbucket actually.  But it turned out that I needed to uncheck light weight check out.  I'd liek to know why it was an issue but otherwise it works for me now.  Apologies for misunderstanding this issue.

          Jordan added a comment - I'm connecting to local Bitbucket actually.  But it turned out that I needed to uncheck light weight check out.  I'd liek to know why it was an issue but otherwise it works for me now.  Apologies for misunderstanding this issue.

          Mark Waite added a comment -

          jjitzchaki it would be best if you could create a new issue that describes your configuration precisely enough so that others can duplicate it, preferably with bitbucket.org as the branch source.

          Mark Waite added a comment - jjitzchaki it would be best if you could create a new issue that describes your configuration precisely enough so that others can duplicate it, preferably with bitbucket.org as the branch source.

          Jordan added a comment -

          I'll create a new issue.  How do I set the branch source?  I dont see  it on the create dialog.

          Jordan added a comment - I'll create a new issue.  How do I set the branch source?  I dont see  it on the create dialog.

          Mark Waite added a comment -

          How do I set the branch source?

          My phrasing was unclear. In the instructions that you provide to duplicate the issue, it will be easier on others if you use https://bitbucket.org as the SCM repository instead of using a Bitbucket server that is only available inside your organization (like https://bitbucket.example.com)

          Mark Waite added a comment - How do I set the branch source? My phrasing was unclear. In the instructions that you provide to duplicate the issue, it will be easier on others if you use https://bitbucket.org as the SCM repository instead of using a Bitbucket server that is only available inside your organization (like https://bitbucket.example.com )

          Hi, I use multibranch pipeline and face the exact same issue with git client plugin and githubapp credentials. Is there any workaround for the same?

          Maitrey Mishra added a comment - Hi, I use multibranch pipeline and face the exact same issue with git client plugin and githubapp credentials. Is there any workaround for the same?

          Mark Waite added a comment -

          maitreymishra23 you asked:

          Is there any workaround for the same?

          The earlier comments indicate that one workaround was to uncheck the "lightweight checkout" on the job defintion. Have you done that?

          Mark Waite added a comment - maitreymishra23 you asked: Is there any workaround for the same? The earlier comments indicate that one workaround was to uncheck the "lightweight checkout" on the job defintion. Have you done that?

            Unassigned Unassigned
            tanguille Tanguille
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: