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

Mask Passwords doesn't support multi-line strings

XMLWordPrintable

      Hi,

      Am I missing something or does the Mask Passwords plugin only support single line strings?

      stages {  
        stage('Secret-Masking') {
          script {
            MASKED_SECRET = 'I_AM_MASKED'
            MULTI_LINE_MASKED_SECRET = """I_AM
      _NOT_MASKED"""
            wrap([$class: 'MaskPasswordsBuildWrapper',
                  varPasswordPairs: [[password: MASKED_SECRET]]]) {
              echo 'MASKED_SECRET: ' + MASKED_SECRET
            }
            wrap([$class: 'MaskPasswordsBuildWrapper',
                  varPasswordPairs: [[password: MULTI_LINE_MASKED_SECRET]]]) {
              echo 'MULTI_LINE_MASKED_SECRET: ' + MULTI_LINE_MASKED_SECRET
            }
          }
        }
      }
      

      Output is:
      MASKED_SECRET: ********
      MULTI_LINE_MASKED_SECRET: I_AM
      _NOT_MASKED

      Thanks.

            Unassigned Unassigned
            brendanh Brendan Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: