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

Git parameter does not show branch list in case deleteDir() is present in pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • OS: Linux Mint 18.3 (Debian)
      Jenkins version: 2.107.2
      git-parameter-plugin version: 0.9.2
      Jenkins have only master node

      • At the beginning I have a code (git_url and git_cred are defined, i just hidden them):
        node {
            properties([
                parameters([
                    [
                        $class: 'GitParameterDefinition',
                        name: 'gitBranch',
                        listSize: '0',
                        type: 'PT_BRANCH',
                     ]
                 ])   
            ])
            stage("First stage") {
                git (
                    url: git_url,
                    credentialsId: git_cred
                )
            }
        }
        
      • I click "Build with parameters" on my jenkins job and get the list of branches as expected
      • After that I click "Configure" and change the code in this manner:
        node {
            properties([
                parameters([
                    [
                        $class: 'GitParameterDefinition',
                        name: 'gitBranch',
                        listSize: '0',
                        type: 'PT_BRANCH',
                     ]
                 ])   
            ])
            stage("Clean") {
                cleanWs()
                //or 'dir(env.WORKSPACE) { deleteDir() }' does not really matter
            }
            stage("First stage") {
                git (
                    url: git_url,
                    credentialsId: git_cred
                )
            }
        }
        
      • After that I click "Save" and click "Build with parameters". The list of the branches is returned correctly
      • I wait till the build is finished with the "SUCCESS" result
      • I click "Build with parameters" and get this in my parameter drop down (see "jenkins_ui_error.png" attachment
      • There is the log message (see "jenkins_error_log.txt" attachment)
      • I return the code state to the starting point ( without cleanWs() ), click "Save", click "Build with Parameters" and i see the list of branches again(notice that I didn't clicked "Build" button)

            klimas7 Boguslaw Klimas
            mikita Mikita Makarenka
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: