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

Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Critical Critical
    • git-parameter-plugin
    • Jenkins version 2.3, all Plugins up to date. Debian 8 64 Bits x86.

      I try to setup a pipeline project to build tags using a Jenkinsfile from SCM (Git). Therefore I want to be be able to set the tag I wish to build via the Git Parameter Plugin. If I setup the project like this and hit the "Build with Parameters" button the git parameter plugin tells me "!No Git repository configured in SCM configuration".

        1. params.PNG
          params.PNG
          15 kB
        2. pipeline.PNG
          pipeline.PNG
          32 kB
        3. Screenshot_20160817_145201.png
          Screenshot_20160817_145201.png
          42 kB
        4. Screenshot_20160817_145625.png
          Screenshot_20160817_145625.png
          18 kB
        5. screenshot-1.png
          screenshot-1.png
          40 kB
        6. screenshot-2.png
          screenshot-2.png
          30 kB
        7. screenshot-3.png
          screenshot-3.png
          72 kB
        8. Selection_104.png
          Selection_104.png
          50 kB

          [JENKINS-34876] Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

          Release 0.7.0

          Boguslaw Klimas added a comment - Release 0.7.0

          Yan Wang added a comment -

          I just tried 0.7.0 and I can choose git branches and tags in the drop down.

          But I failed to use it as a variable in * Branch Specifier*, seems the variable is not parsed at all.

          Yan Wang added a comment - I just tried 0.7.0 and I can choose git branches and tags in the drop down. But I failed to use it as a variable in * Branch Specifier*, seems the variable is not parsed at all.

          Hi, wyvernnot
          I have configured a simple job:
          Parameter:

          Git Config:

          And job work fine

          Could you get me something more information? About your configuration.

          Regards
          Boguslaw

          Boguslaw Klimas added a comment - Hi, wyvernnot I have configured a simple job: Parameter: Git Config: And job work fine Could you get me something more information? About your configuration. Regards Boguslaw

          Yan Wang added a comment -

          Hi, I am using Jenkins@2.7.4 with a pipeline project.

          here is the params settings

          here is the pipeline settings

          Yan Wang added a comment - Hi, I am using Jenkins@2.7.4 with a pipeline project. here is the params settings here is the pipeline settings

          Yan Wang added a comment -

          Oh, I just tried String Parameters and it does not work neither.

          So I guess the problem is not with Git Parameter plugin but SCM plugin.

          Related issue is: https://issues.jenkins-ci.org/browse/JENKINS-34540

          Yan Wang added a comment - Oh, I just tried String Parameters and it does not work neither. So I guess the problem is not with Git Parameter plugin but SCM plugin. Related issue is: https://issues.jenkins-ci.org/browse/JENKINS-34540

          Minh Chung added a comment -

          klimas7 Thank you for working on this ticket. I apologize for bringing it back up but I was wondering would it be possible to parametize git branches from the checkouts done in the Jenkinsfile pipeline? I was able to get this this to work in the Pipeline for the primary git source but my Jenkinsfile has additional git sources I also need to check out and would like to parametize those git source branches for selection. 

          Minh Chung added a comment - klimas7 Thank you for working on this ticket. I apologize for bringing it back up but I was wondering would it be possible to parametize git branches from the checkouts done in the Jenkinsfile pipeline? I was able to get this this to work in the Pipeline for the primary git source but my Jenkinsfile has additional git sources I also need to check out and would like to parametize those git source branches for selection. 

          it looks like is a problem in scripted pipeline. When i changed the script to declarative it worked

          Julian Mosquera added a comment - it looks like is a problem in scripted pipeline. When i changed the script to declarative it worked

          JJ Ruescas added a comment -

          julian_linux, were you able to get it fixed. I'm experiencing a similar issue.

          JJ Ruescas added a comment - julian_linux , were you able to get it fixed. I'm experiencing a similar issue.

          Nick Nieslanik added a comment - - edited

          Hi!  I am using Jenkins LTS 2.190.2 via Docker container and I'm experiencing this issue using a SCM declarative pipeline.  I have an Extensible Choice param in the job that is letting me pick a branch, and then I am referring to the branch variable selection as

          ${webapp_branch}

          in the pipeline settings for the Jenkinsfile in SCM (specifically GIT).  Based on my reading of this issue, it seems as if folks think this is fixed?  I am definitely able to repo consistently across a number of declarative pipeline jobs on my server.  I have config extremely similar to wyvernnot's screenshots from 2016.  klimas7  Any insight here?

           

          Screenshots:

          choice settings

          pipeline settings

           

          Error from build:

           

          hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/${webapp_branch}:refs/remotes/origin/${webapp_branch}" returned status code 128:
          stdout: 
          stderr: fatal: Couldn't find remote ref refs/heads/${webapp_branch}	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2174)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1866)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:547)
          	at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:358)
          	at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:197)
          	at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:173)
          	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:113)
          	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
          	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
          	at hudson.model.ResourceController.execute(ResourceController.java:97)
          	at hudson.model.Executor.run(Executor.java:429)
          Finished: FAILURE
          

           

           

          Nick Nieslanik added a comment - - edited Hi!  I am using Jenkins LTS 2.190.2 via Docker container and I'm experiencing this issue using a SCM declarative pipeline.  I have an Extensible Choice param in the job that is letting me pick a branch, and then I am referring to the branch variable selection as ${webapp_branch} in the pipeline settings for the Jenkinsfile in SCM (specifically GIT).  Based on my reading of this issue, it seems as if folks think this is fixed?  I am definitely able to repo consistently across a number of declarative pipeline jobs on my server.  I have config extremely similar to  wyvernnot 's screenshots from 2016.  klimas7   Any insight here?   Screenshots: choice settings pipeline settings   Error from build:   hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/${webapp_branch}:refs/remotes/origin/${webapp_branch}" returned status code 128: stdout: stderr: fatal: Couldn't find remote ref refs/heads/${webapp_branch} at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2174) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1866) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:547) at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:358) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:197) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:173) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:113) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Finished: FAILURE    

          Ievgen added a comment -

          Hi there. Got the same issue again. Git tag parameter been not delivered to git checkout action.
          Jenkins:Jenkins 2.289.1
          Parameter plugin: 

          Ievgen added a comment - Hi there. Got the same issue again. Git tag parameter been not delivered to git checkout action. Jenkins: Jenkins 2.289.1 Parameter plugin:  0.9.13

            klimas7 Boguslaw Klimas
            enno Andreas Oetken
            Votes:
            15 Vote for this issue
            Watchers:
            31 Start watching this issue

              Created:
              Updated: