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

Job DSL - gitParam() does not list tags before saving configuration manually

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Blocker Blocker
    • git-parameter-plugin
    • None
    • Jenkins 2.70, Jenkins Job DSL 1.64, Git Parameter Plug-In 0.8.0, Git plugin 3.5.0, GitLab

      I'm using Jenkins Job DSL.

      I found 'TAG' does not fetch any tag soon after building seed job, although it does after I move to job configuration and pushing Save button.

      Here is minimal code to reproduce the issue:

      job('gitParam-doesnt-fetch-tags') {
        scm {
          git {
            remote {
              branch('**')
              url('git@gitlab.our-company.com:organization/repo.git')
              credentials('our-gitlab-user-pass')
            }
          }
        }
        parameters {
          gitParam('GIT_TAG') {
            type('TAG')
          }
        }
      }

      Workaround

      Use GitParameterDefinition() instead of gitParam().

      job('gitParam-doesnt-fetch-tags') {
        scm {
          git {
            remote {
              branch('**')
              url('git@gitlab.our-company.com:organization/repo.git')
              credentials('our-gitlab-user-pass')
            }
          }
        }
        parameters {
          buildParameterNodes['GIT_TAG'] = NodeBuilder.newInstance().'net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition' {
            name('GIT_TAG')
            type('PT_TAG')
            sortMode('DESCENDING_SMART') // this seems required
          }
        }
      }

      Detailed explanation of the issue

      After building seed job, I get this job to reproduce the issue.

      When I move to "Parameterized build", no git tags are displayed.

      After moving to configuration, changing nothing, and pushing Save button,

      then parameterized build screen shows tags as I expected.

            klimas7 Boguslaw Klimas
            laysakura Sho Nakatani
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: