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

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      • 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)

        1. jenkins_error_log.txt
          7 kB
          Mikita Makarenka
        2. jenkins_ui_error.png
          16 kB
          Mikita Makarenka

            Assignee:
            Boguslaw Klimas
            Reporter:
            Mikita Makarenka
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: