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

pipeline/freestylejob cannot get empty param value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • ubuntu
      jenkins 2.249.3

      jdk8

      There are 2 questions :

      1。 pipeline/freestylejob cannot get empty param value。
      2。 pipeline under docker agent can  get empty param value。
      

      I define the pipelie with parameter like below

      parameters {
           string(name: 'ANDROID_PLATFORM', defaultValue: '')
      }
      

      in stage i try to print this parameter 'ANDROID_PLATFORM', like below

      stage("0.clean ws") {
      steps {
        sh '''#!/bin/bash
      env
      '''
      }
      }
      
      
      

      start this pipeline with empty string ANDROID_PLATFORM, the env command not print this value.
      in python code i try to get ANDROID_PLATFORM like this

        os.environ.get("ANDROID_PLATFORM")

      but this return None.I want this return "", an empty string value。

      workaround in python maybe work well like this:

        os.environ.get("ANDROID_PLATFORM", "")

        1. screenshot-1.png
          6 kB
          bright.ma
        2. screenshot-2.png
          77 kB
          bright.ma

            Unassigned Unassigned
            mmh19891113 bright.ma
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: