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.

        1. image-2017-08-07-08-16-44-796.png
          34 kB
          Sho Nakatani
        2. image-2017-08-07-08-18-06-468.png
          50 kB
          Sho Nakatani
        3. image-2017-08-07-08-18-45-450.png
          31 kB
          Sho Nakatani
        4. image-2017-08-07-08-19-29-921.png
          74 kB
          Sho Nakatani
        5. image-2017-08-07-08-20-19-796.png
          35 kB
          Sho Nakatani

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

              Created:
              Updated:
              Resolved: