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

Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

    XMLWordPrintable

Details

    • Improvement
    • Status: Reopened (View Workflow)
    • Critical
    • Resolution: Unresolved
    • git-parameter-plugin
    • Jenkins version 2.3, all Plugins up to date. Debian 8 64 Bits x86.

    Description

      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".

      Attachments

        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

        Issue Links

          Activity

            enno Andreas Oetken created issue -

            Same here!

            mandrean Sebastian Mandrean added a comment - Same here!

            Me as well. You can't pass a parameter into the `Branch specifier` field of the pipeline SCM section, can you? I tried, unsuccessfully.

            jstroot Jonathan Strootman added a comment - Me as well. You can't pass a parameter into the `Branch specifier` field of the pipeline SCM section, can you? I tried, unsuccessfully.
            rtyler R. Tyler Croy made changes -
            Field Original Value New Value
            Workflow JNJira [ 171076 ] JNJira + In-Review [ 184154 ]
            klimas7 Boguslaw Klimas made changes -
            Assignee Andreas Oetken [ enno ] Boguslaw Klimas [ klimas7 ]
            gareth_western Gareth Western made changes -
            Link This issue duplicates JENKINS-28447 [ JENKINS-28447 ]
            jglick Jesse Glick added a comment -

            Not a duplicate. Rather missing Pipeline integration with this plugin.

            jglick Jesse Glick added a comment - Not a duplicate. Rather missing Pipeline integration with this plugin.
            jglick Jesse Glick made changes -
            Labels workflow
            ganthore Mark Austin made changes -
            Comment [ I observed the same problem.

            I came up with a workaround, note that you need git 2.0 in order to do this...

            1) I wrote a script that is executed inside of the git checkout root:

            [code]
            git tag -l --sort=version:refname | sort -r | xargs echo -n | sed 's/ /,/g' | sed '1s/^/key=/' > versions.properties
            [code] ]
            ganthore Mark Austin made changes -
            Attachment Screenshot_20160817_145201.png [ 33634 ]
            ganthore Mark Austin made changes -
            Attachment Screenshot_20160817_145625.png [ 33635 ]
            ganthore Mark Austin added a comment -

            I observed the same behavior, but I came up with a hacky workaround...

            I wrote a shell script that will dump git tags into a sorted list that can be ingested as a property file when using the the Extended Choice Parameter plugin.

            1) Run this script in the root of your git checkout dir:

            genVers.sh
            git tag -l --sort=version:refname | sort -r | xargs echo -n | sed 's/ /,/g' | sed '1s/^/key=/' > /tmp/versions.properties
            

            2) Install the Extended Choice Parameter plugin and add it to your job
            https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin

            3) Point the config to the property file you generated and set the key. See my attached example:

            4) Test it

            ganthore Mark Austin added a comment - I observed the same behavior, but I came up with a hacky workaround... I wrote a shell script that will dump git tags into a sorted list that can be ingested as a property file when using the the Extended Choice Parameter plugin. 1) Run this script in the root of your git checkout dir: genVers.sh git tag -l --sort=version:refname | sort -r | xargs echo -n | sed 's/ /,/g' | sed '1s/^/key=/' > /tmp/versions.properties 2) Install the Extended Choice Parameter plugin and add it to your job https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin 3) Point the config to the property file you generated and set the key. See my attached example: 4) Test it
            klimas7 Boguslaw Klimas made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            sc250024 Scott Crooks added a comment -

            ganthore With your script, does this assume that the Git repo has already been checked out? I'm just wondering how to run the script before the Pipeline starts. It seems you need to run the script before the pipeline actually starts so that you can populate some variable with your desired tag. The question would be, where would the one line BASH command be executed?

            sc250024 Scott Crooks added a comment - ganthore With your script, does this assume that the Git repo has already been checked out? I'm just wondering how to run the script before the Pipeline starts. It seems you need to run the script before the pipeline actually starts so that you can populate some variable with your desired tag. The question would be, where would the one line BASH command be executed?

            Hi Guys,
            I working on resolving this issue. I have prototype solution.
            Which supports Pipline job.
            I hope to resolved this in release 0.7.0 Releases schedule

            Regards

            klimas7 Boguslaw Klimas added a comment - Hi Guys, I working on resolving this issue. I have prototype solution. Which supports Pipline job. I hope to resolved this in release 0.7.0 Releases schedule Regards
            anudeeplalam Anudeep Lalam made changes -
            Priority Minor [ 4 ] Critical [ 2 ]
            ganthore Mark Austin added a comment - - edited

            Hey Scott,

            Yes that is correct. I'd have the git repo poll and then ensure that the script is executed after each poll. I know it's not ideal, but it works for now until klimas7 gets things patched up.

            ganthore Mark Austin added a comment - - edited Hey Scott, Yes that is correct. I'd have the git repo poll and then ensure that the script is executed after each poll. I know it's not ideal, but it works for now until klimas7 gets things patched up.
            sc250024 Scott Crooks added a comment - - edited

            ganthore,

            Can you be a bit more detailed about your job setup? I get that the BASH command you have above will grab the list of tags, and that it will put that in a file, and that the Extended Choice parameter will read that file at build time. What I don't get is when that BASH command is executed? In Jenkins pipeline, there's no option to run a BASH script before the Extended Choice plugin grabs the list of tags.

            sc250024 Scott Crooks added a comment - - edited ganthore , Can you be a bit more detailed about your job setup? I get that the BASH command you have above will grab the list of tags, and that it will put that in a file, and that the Extended Choice parameter will read that file at build time. What I don't get is when that BASH command is executed? In Jenkins pipeline, there's no option to run a BASH script before the Extended Choice plugin grabs the list of tags.
            ganthore Mark Austin added a comment - - edited

            Hey Scott,

            I guess we could just run a script like this as an alternative on the Jenkins master so that the main workspace has access to the properties file:

            git ls-remote -t https://github.com/jenkinsci/github-plugin | awk '{print $2}' | cut -d '/' -f 3 | cut -d '^' -f 1 | sort -b -t . -k 1,1nr -k 2,2nr -k 3,3r -k 4,4r -k 5,5r | uniq | xargs echo -n | sed 's/ /,/g' | sed '1s/^/key=/' > /tmp/versions.properties
            

            That way we don't have to force Jenkins to double checkout the git repo per my older example.

            There are a number of ways you could do this. The end goal is to make sure that the script runs on a regular basis or immediately after the jenkins workspace has polled the git repo.

            For instance, you could have the script execute on the jenkins master directly through something as simple as a cron job.

            Or, you could also try running it with a post-merge git hook in the workspace, that way it runs each time after a "git pull" occurs. Here is a basic example that you could modify for your needs:
            https://gist.github.com/sindresorhus/7996717

            If you're familiar with incron (http://inotify.aiken.cz/?section=incron&page=why&lang=en), you could have that daemon execute the script each time it notices a file change in the git checkout folder on the workspace.

            ... or just wait for this bug to get patched.

            Hope this helps...

            ganthore Mark Austin added a comment - - edited Hey Scott, I guess we could just run a script like this as an alternative on the Jenkins master so that the main workspace has access to the properties file: git ls-remote -t https: //github.com/jenkinsci/github-plugin | awk '{print $2}' | cut -d '/' -f 3 | cut -d '^' -f 1 | sort -b -t . -k 1,1nr -k 2,2nr -k 3,3r -k 4,4r -k 5,5r | uniq | xargs echo -n | sed 's/ /,/g' | sed '1s/^/key=/' > /tmp/versions.properties That way we don't have to force Jenkins to double checkout the git repo per my older example. There are a number of ways you could do this. The end goal is to make sure that the script runs on a regular basis or immediately after the jenkins workspace has polled the git repo. For instance, you could have the script execute on the jenkins master directly through something as simple as a cron job. Or, you could also try running it with a post-merge git hook in the workspace, that way it runs each time after a "git pull" occurs. Here is a basic example that you could modify for your needs: https://gist.github.com/sindresorhus/7996717 If you're familiar with incron ( http://inotify.aiken.cz/?section=incron&page=why&lang=en ), you could have that daemon execute the script each time it notices a file change in the git checkout folder on the workspace. ... or just wait for this bug to get patched. Hope this helps...
            sc250024 Scott Crooks added a comment - - edited

            ganthore We currently "solve" the problem by doing essentially what you suggested at build time using a pipeline stage:

            parallel (
            	getRepo1Tags: {
            		sh("git ls-remote --quiet --tags --heads ${repo1GitUrl} | awk '{print \$2}' | grep -vi '{}' | cut -d/ -f1,2 --complement > ${repo1TmpTags}")
            	},
            	getRepo2Tags: {
            		sh("git ls-remote --quiet --tags --heads ${repo2GitUrl} | awk '{print \$2}' | grep -vi '{}' | cut -d/ -f1,2 --complement > ${repo2TmpTags}")
            	}
            )
            

            After that we use the "input" command in pipeline to pause the build and wait for user input.

            def listofRepo1TagsBranches = readFile(repo1TmpTags).trim()
            def repo1TagBranch = input([message: 'Select a Git branch / tag', parameters: [[$class: 'ChoiceParameterDefinition', choices: listofRepo1TagsBranches, description: '', name: 'Repo 1 branch / tag to build']]])
            
            def listofRepo2TagsBranches = readFile(repo2TmpTags).trim()
            def repo2TagBranch = input([message: 'Select a Git branch / tag', parameters: [[$class: 'ChoiceParameterDefinition', choices: listofRepo2TagsBranches, description: '', name: 'Repo 2 branch / tag to build']]])
            

            This works if you're not using automated deployments. However, for our staging environments, we rely on a webhook to be called so that code is automatically pushed to staging. I'm not sure how you would parameterize this without this plugin getting updated for pipeline support. Anyway, I'll figure out another solution in the meantime.

            sc250024 Scott Crooks added a comment - - edited ganthore We currently "solve" the problem by doing essentially what you suggested at build time using a pipeline stage: parallel ( getRepo1Tags: { sh( "git ls-remote --quiet --tags --heads ${repo1GitUrl} | awk '{print \$2}' | grep -vi '{}' | cut -d/ -f1,2 --complement > ${repo1TmpTags}" ) }, getRepo2Tags: { sh( "git ls-remote --quiet --tags --heads ${repo2GitUrl} | awk '{print \$2}' | grep -vi '{}' | cut -d/ -f1,2 --complement > ${repo2TmpTags}" ) } ) After that we use the "input" command in pipeline to pause the build and wait for user input. def listofRepo1TagsBranches = readFile(repo1TmpTags).trim() def repo1TagBranch = input([message: 'Select a Git branch / tag' , parameters: [[$class: 'ChoiceParameterDefinition' , choices: listofRepo1TagsBranches, description: '', name: ' Repo 1 branch / tag to build']]]) def listofRepo2TagsBranches = readFile(repo2TmpTags).trim() def repo2TagBranch = input([message: 'Select a Git branch / tag' , parameters: [[$class: 'ChoiceParameterDefinition' , choices: listofRepo2TagsBranches, description: '', name: ' Repo 2 branch / tag to build']]]) This works if you're not using automated deployments. However, for our staging environments, we rely on a webhook to be called so that code is automatically pushed to staging. I'm not sure how you would parameterize this without this plugin getting updated for pipeline support. Anyway, I'll figure out another solution in the meantime.

            Code changed in jenkins
            User: Boguslaw Klimas
            Path:
            pom.xml
            src/findbugs/excludesFilter.xml
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractJobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractProjectJobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapperFactory.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/UnsupportedJobType.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java
            src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages.properties
            src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages_pl.properties
            src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinitionTest.java
            http://jenkins-ci.org/commit/git-parameter-plugin/3885d16c08943acd696a1c618d78687c4d63a0cb
            Log:
            JENKINS-34876 Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Boguslaw Klimas Path: pom.xml src/findbugs/excludesFilter.xml src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractJobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractProjectJobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapperFactory.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/UnsupportedJobType.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages.properties src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages_pl.properties src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinitionTest.java http://jenkins-ci.org/commit/git-parameter-plugin/3885d16c08943acd696a1c618d78687c4d63a0cb Log: JENKINS-34876 Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

            Hi
            I was created branch feature/JENKINS-34876 where I added support to pipeline job.
            I was left to implement one method - perhaps is not necessary I must check it. If you want, you can build plugin from source and check it
            I plan to release plugin about 10 sep

            Regards
            Boguslaw

            klimas7 Boguslaw Klimas added a comment - Hi I was created branch feature/JENKINS-34876 where I added support to pipeline job. I was left to implement one method - perhaps is not necessary I must check it. If you want, you can build plugin from source and check it I plan to release plugin about 10 sep Regards Boguslaw
            abayer Andrew Bayer made changes -
            Labels workflow pipeline workflow
            abayer Andrew Bayer made changes -
            Labels pipeline workflow pipeline

            Code changed in jenkins
            User: Boguslaw Klimas
            Path:
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractProjectJobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java
            src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages.properties
            src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages_pl.properties
            http://jenkins-ci.org/commit/git-parameter-plugin/5fc8a95ef5d23d704ca4e60ff668671be924ee20
            Log:
            JENKINS-34876 Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Boguslaw Klimas Path: src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractProjectJobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages.properties src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages_pl.properties http://jenkins-ci.org/commit/git-parameter-plugin/5fc8a95ef5d23d704ca4e60ff668671be924ee20 Log: JENKINS-34876 Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

            Code changed in jenkins
            User: klimas7
            Path:
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java
            http://jenkins-ci.org/commit/git-parameter-plugin/b9c7ef390108df624f14c88a45b0be5156ebfe86
            Log:
            JENKINS-34876 Git Parameters not working for Pipeline projects and Jenkinsfile from SCM

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: klimas7 Path: src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java http://jenkins-ci.org/commit/git-parameter-plugin/b9c7ef390108df624f14c88a45b0be5156ebfe86 Log: JENKINS-34876 Git Parameters not working for Pipeline projects and Jenkinsfile from SCM
            klimas7 Boguslaw Klimas made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]

            Code changed in jenkins
            User: Boguslaw Klimas
            Path:
            pom.xml
            src/findbugs/excludesFilter.xml
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractJobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractProjectJobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapper.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapperFactory.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/UnsupportedJobType.java
            src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java
            src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages.properties
            src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages_pl.properties
            src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinitionTest.java
            http://jenkins-ci.org/commit/git-parameter-plugin/9b1243d06a5af91494417c8cd697d14af4669bf7
            Log:
            Merge pull request #36 from jenkinsci/feature/JENKINS-34876

            Feature/jenkins 34876

            Compare: https://github.com/jenkinsci/git-parameter-plugin/compare/f047198dda1e...9b1243d06a5a

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Boguslaw Klimas Path: pom.xml src/findbugs/excludesFilter.xml src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractJobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/AbstractProjectJobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapper.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/JobWrapperFactory.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/UnsupportedJobType.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages.properties src/main/resources/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/Messages_pl.properties src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinitionTest.java http://jenkins-ci.org/commit/git-parameter-plugin/9b1243d06a5af91494417c8cd697d14af4669bf7 Log: Merge pull request #36 from jenkinsci/feature/ JENKINS-34876 Feature/jenkins 34876 Compare: https://github.com/jenkinsci/git-parameter-plugin/compare/f047198dda1e...9b1243d06a5a
            anudeeplalam Anudeep Lalam added a comment -

            Hi,

            When can we expect the release of Git Parameter Plugin latest version i.e. 0.7.0

            anudeeplalam Anudeep Lalam added a comment - Hi, When can we expect the release of Git Parameter Plugin latest version i.e. 0.7.0

            Hi,
            I didn't have enough time in weekend, I'll do it today.
            Sorry, for that

            Regards
            Boguslaw

            klimas7 Boguslaw Klimas added a comment - Hi, I didn't have enough time in weekend, I'll do it today. Sorry, for that Regards Boguslaw
            anudeeplalam Anudeep Lalam added a comment -

            Hi klimas7,

            Thanks for the prompt response..

            anudeeplalam Anudeep Lalam added a comment - Hi klimas7 , Thanks for the prompt response..

            Release 0.7.0

            klimas7 Boguslaw Klimas added a comment - Release 0.7.0
            klimas7 Boguslaw Klimas made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            wyvernnot 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.

            wyvernnot 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.
            wyvernnot Yan Wang made changes -
            Attachment Selection_104.png [ 33910 ]
            klimas7 Boguslaw Klimas made changes -
            Attachment screenshot-1.png [ 33911 ]
            klimas7 Boguslaw Klimas made changes -
            Attachment screenshot-2.png [ 33912 ]
            klimas7 Boguslaw Klimas made changes -
            Attachment screenshot-3.png [ 33913 ]

            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

            klimas7 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
            wyvernnot Yan Wang made changes -
            Attachment pipeline.PNG [ 33919 ]
            wyvernnot Yan Wang made changes -
            Attachment params.PNG [ 33920 ]
            wyvernnot 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

            wyvernnot 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
            wyvernnot 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

            wyvernnot 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
            gnuhchnim 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. 

            gnuhchnim 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_linux Julian Mosquera added a comment - it looks like is a problem in scripted pipeline. When i changed the script to declarative it worked
            jjruescas JJ Ruescas added a comment -

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

            jjruescas JJ Ruescas added a comment - julian_linux , were you able to get it fixed. I'm experiencing a similar issue.
            nicknieslanik_livongo 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
            

             

             

            nicknieslanik_livongo 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    
            irudyi 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: 

            irudyi 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
            irudyi Ievgen made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]

            People

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

              Dates

                Created:
                Updated: