• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline
    • None

      Internally we use gitlab as out git reposity server.
      Using a jenkins freestyle project and git plugin a checkout via git over ssh works fine using an ssh private key.

      In a workflow project I do not get a working checkout. This is the output I get:

      Starting...
      Running: Git
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url git@git.local.domain:ps/project.git # timeout=10
      Fetching upstream changes from git@git.local.domain:ps/project.git
       > git --version # timeout=10
       > git fetch --tags --progress git@git.local.domain:ps/project.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error fetching remote repo 'origin'
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: End of Workflow
      ERROR: Error fetching remote repo 'origin'
      Finished: FAILURE
      

      .. when using the following project:

      node('master'){
        echo "Starting..."
        git url: 'git@git.local.domain:ps/project.git', credentialsId:67c3072d-b9a7-44fa-a5aa-560ba9c1662f
      }
      

      I got the credentialsID from the working freestyle project.

      When enabling ssh debug-log on the (git/ssh)server side it seems that jenkins/workflow tries to establish the ssh connection without offering a key based authentication and the connection is closed by the client in the ssh preauth phase.

      I didn't get to manage to get debug output from the git-plugin when using the workflow plugin, but here is the exception I get from workflow:

      Dec 16, 2014 3:50:09 PM FINE org.jenkinsci.plugins.workflow.cps.CpsThread
      ran and produced error
      java.lang.reflect.UndeclaredThrowableException
              at org.jenkinsci.plugins.workflow.cps.CpsStepContext.replay(CpsStepContext.java:409)
              at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:164)
              at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
              at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
              at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
              at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
              at WorkflowScript.run(WorkflowScript:4)
              at Unknown.Unknown(Unknown)
              at ___cps.transform___(Native Method)
              at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
              at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:100)
              at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:76)
              at sun.reflect.GeneratedMethodAccessor258.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
              at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
              at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
              at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
              at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
              at com.cloudbees.groovy.cps.Next.step(Next.java:58)
              at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
              at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
              at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:267)
              at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:70)
              at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:176)
              at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:174)
              at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:111)
              at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: hudson.AbortException: Error fetching remote repo 'origin'
              at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:946)
              at hudson.plugins.git.GitSCM.checkout(GitSCM.java:972)
              at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:98)
              at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:70)
              at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
              at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:137)
              at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
              at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
              at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
              at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
              ... 30 more
      

      I'm using:
      Jenkins: 1.593
      Git-Plugin: 2.3.1
      Workflow-Plugin: 1.1

          [JENKINS-26085] Credentials support for git step

          ok, my fault. Using the "general scm" step works fine using credentials.

          Patrick Scharrenberg added a comment - ok, my fault. Using the "general scm" step works fine using credentials.

          Jesse Glick added a comment -

          Right. Still, the git step is more convenient when writing flows without the generator. I wanted to avoid overloading it (and the svn step) with options, but credentialsId is so broadly needed that it makes sense to include.

          Jesse Glick added a comment - Right. Still, the git step is more convenient when writing flows without the generator. I wanted to avoid overloading it (and the svn step) with options, but credentialsId is so broadly needed that it makes sense to include.

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          scm-step/README.md
          scm-step/pom.xml
          scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java
          scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          http://jenkins-ci.org/commit/workflow-plugin/6838a3ce779d6645759e76456d39f1da95128d26
          Log:
          [FIXED JENKINS-26085] Credentials support for git step

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: scm-step/README.md scm-step/pom.xml scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java http://jenkins-ci.org/commit/workflow-plugin/6838a3ce779d6645759e76456d39f1da95128d26 Log: [FIXED JENKINS-26085] Credentials support for git step

          Anders Hammar added a comment -

          Only for git, not for svn? Why?

          Anders Hammar added a comment - Only for git, not for svn? Why?

          Jesse Glick added a comment -

          ahammar JENKINS-27275 tracks the analogous change for the svn step.

          Jesse Glick added a comment - ahammar JENKINS-27275 tracks the analogous change for the svn step.

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          scm-step/README.md
          scm-step/pom.xml
          scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java
          scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly
          scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          http://jenkins-ci.org/commit/workflow-plugin/696119a41c8443c2d5099f7aba1f2e14cb7458b4
          Log:
          [FIXED JENKINS-26085] Credentials support for git step

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: scm-step/README.md scm-step/pom.xml scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java http://jenkins-ci.org/commit/workflow-plugin/696119a41c8443c2d5099f7aba1f2e14cb7458b4 Log: [FIXED JENKINS-26085] Credentials support for git step

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          scm-step/README.md
          scm-step/pom.xml
          scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java
          scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly
          scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          http://jenkins-ci.org/commit/workflow-plugin/eb0548c654af1df70b853d4194581a90b8f443ca
          Log:
          Merge pull request #79 from ndeloof/JENKINS-26085

          [FIXED JENKINS-26085] Credentials support for git step

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/64be5ce6dd7b...eb0548c654af

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: scm-step/README.md scm-step/pom.xml scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java http://jenkins-ci.org/commit/workflow-plugin/eb0548c654af1df70b853d4194581a90b8f443ca Log: Merge pull request #79 from ndeloof/ JENKINS-26085 [FIXED JENKINS-26085] Credentials support for git step Compare: https://github.com/jenkinsci/workflow-plugin/compare/64be5ce6dd7b...eb0548c654af

          Code changed in jenkins
          User: Jesse Glick
          Path:
          CHANGES.md
          http://jenkins-ci.org/commit/workflow-plugin/694a0f0ec1aba1fae0844654402329fbe7448647
          Log:
          JENKINS-26085 Noting merge of #79.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/694a0f0ec1aba1fae0844654402329fbe7448647 Log: JENKINS-26085 Noting merge of #79.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java
          http://jenkins-ci.org/commit/workflow-plugin/d22d9e6f11cb6550d4f11df148abf1608916d987
          Log:
          Merge pull request #99 from jglick/GitStep.credentialsId

          JENKINS-26085 Handle empty credentialsId

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/52d1ebae8f46...d22d9e6f11cb

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java http://jenkins-ci.org/commit/workflow-plugin/d22d9e6f11cb6550d4f11df148abf1608916d987 Log: Merge pull request #99 from jglick/GitStep.credentialsId JENKINS-26085 Handle empty credentialsId Compare: https://github.com/jenkinsci/workflow-plugin/compare/52d1ebae8f46...d22d9e6f11cb

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          scm-step/README.md
          scm-step/pom.xml
          scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java
          scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly
          scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          http://jenkins-ci.org/commit/workflow-scm-step-plugin/f7a7b2806011d4debd0c3074ac61a0ed673e3f42
          Log:
          [FIXED JENKINS-26085] Credentials support for git step

          Originally-Committed-As: 696119a41c8443c2d5099f7aba1f2e14cb7458b4

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: scm-step/README.md scm-step/pom.xml scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly scm-step/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java http://jenkins-ci.org/commit/workflow-scm-step-plugin/f7a7b2806011d4debd0c3074ac61a0ed673e3f42 Log: [FIXED JENKINS-26085] Credentials support for git step Originally-Committed-As: 696119a41c8443c2d5099f7aba1f2e14cb7458b4

            ndeloof Nicolas De Loof
            ps Patrick Scharrenberg
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: