• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • pipeline

      At least within a block step, it should be possible to set something like a ConsoleLogFilter to decorate the output written to TaskListener. Possible use cases:

      • Replacement for decorateLogger in SimpleBuildWrapper.
      • Ability to mask passwords from BindingStep in credentials-binding (unless there is an equivalent to getSensitiveBuildVariables moved up to Run).

          [JENKINS-27392] API to decorate console output

          Code changed in jenkins
          User: Jesse Glick
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
          http://jenkins-ci.org/commit/workflow-plugin/4ad6605229b6f248fa06c8d9be9bd8bcdb547f80
          Log:
          JENKINS-27392 Prepared test for SimpleBuildWrapper.createLoggerDecorator.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java http://jenkins-ci.org/commit/workflow-plugin/4ad6605229b6f248fa06c8d9be9bd8bcdb547f80 Log: JENKINS-27392 Prepared test for SimpleBuildWrapper.createLoggerDecorator.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
          basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStep.java
          pom.xml
          http://jenkins-ci.org/commit/workflow-plugin/874c4618f43316e096562499f0f6a3636951919a
          Log:
          JENKINS-27392 Using SimpleBuildWrapper.createLoggerDecorator from CoreWrapperStep.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStep.java pom.xml http://jenkins-ci.org/commit/workflow-plugin/874c4618f43316e096562499f0f6a3636951919a Log: JENKINS-27392 Using SimpleBuildWrapper.createLoggerDecorator from CoreWrapperStep.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsBuildWrapper.java
          src/main/java/com/michelin/cio/hudson/plugins/passwordparam/PasswordParameterValue.java
          src/test/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsWorkflowTest.java
          http://jenkins-ci.org/commit/mask-passwords-plugin/453e8b54b64ad2b54335b1f4265fd90e33d8bf2e
          Log:
          JENKINS-27392 Implement SimpleBuildWrapper in order to support Workflow project type .

          This pull request integrates https://github.com/jenkinsci/mask-passwords-plugin/pull/3

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsBuildWrapper.java src/main/java/com/michelin/cio/hudson/plugins/passwordparam/PasswordParameterValue.java src/test/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsWorkflowTest.java http://jenkins-ci.org/commit/mask-passwords-plugin/453e8b54b64ad2b54335b1f4265fd90e33d8bf2e Log: JENKINS-27392 Implement SimpleBuildWrapper in order to support Workflow project type . This pull request integrates https://github.com/jenkinsci/mask-passwords-plugin/pull/3

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          COMPATIBILITY.md
          http://jenkins-ci.org/commit/workflow-plugin/8ae0c5d4c33362e7b82a9a39e10b0073eb17f5a7
          Log:
          JENKINS-27392 - Noting Workflow support in Mask Passwords 2.8

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: COMPATIBILITY.md http://jenkins-ci.org/commit/workflow-plugin/8ae0c5d4c33362e7b82a9a39e10b0073eb17f5a7 Log: JENKINS-27392 - Noting Workflow support in Mask Passwords 2.8

          Code changed in jenkins
          User: Jesse Glick
          Path:
          support/src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java
          http://jenkins-ci.org/commit/workflow-support-plugin/e3bea833905716718ed37ef55c5eb5298c21ec3f
          Log:
          [FIXED JENKINS-27392] Handling ConsoleLogFilter.
          Originally-Committed-As: 38cd1ea642bd45e45331e89c8cef7ffb8e3740fa

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: support/src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java http://jenkins-ci.org/commit/workflow-support-plugin/e3bea833905716718ed37ef55c5eb5298c21ec3f Log: [FIXED JENKINS-27392] Handling ConsoleLogFilter. Originally-Committed-As: 38cd1ea642bd45e45331e89c8cef7ffb8e3740fa

          Code changed in jenkins
          User: Jesse Glick
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/16c2ccf3948b2f5e1ad0c0ab72556cc4da070db2
          Log:
          JENKINS-27392 Prepared test for SimpleBuildWrapper.createLoggerDecorator.
          Originally-Committed-As: 4ad6605229b6f248fa06c8d9be9bd8bcdb547f80

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/16c2ccf3948b2f5e1ad0c0ab72556cc4da070db2 Log: JENKINS-27392 Prepared test for SimpleBuildWrapper.createLoggerDecorator. Originally-Committed-As: 4ad6605229b6f248fa06c8d9be9bd8bcdb547f80

          Code changed in jenkins
          User: Jesse Glick
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
          basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStep.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/60cb60720b2ed1ab64ecaeb72c8c8649dec998b6
          Log:
          JENKINS-27392 Using SimpleBuildWrapper.createLoggerDecorator from CoreWrapperStep.
          Originally-Committed-As: 874c4618f43316e096562499f0f6a3636951919a

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStep.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/60cb60720b2ed1ab64ecaeb72c8c8649dec998b6 Log: JENKINS-27392 Using SimpleBuildWrapper.createLoggerDecorator from CoreWrapperStep. Originally-Committed-As: 874c4618f43316e096562499f0f6a3636951919a

          Jeffrey Nelson added a comment - - edited

          I am trying to use this wrapper with the cloudbees workflow/pipeline plugin. Refer to the following code snippet:

          node {
              stage 'Test It'
              
              wrap([$class: 'MaskPasswordsBuildWrapper']) {
                  sh '''if [ "$MARATHON_PASSWORD" -eq "theMarathonPassword" ]; then
                            echo it works!
                         fi'''
              }
          }

          I have a global password setup named: MARATHON_PASSWORD with value: theMarathonPassword. However, running this pipeline job results in output:

          Entering stage Test It
          Proceeding
          [Pipeline] stage (Test It)
          [Pipeline] General Build Wrapper : Start
          [Pipeline] wrap {
          [Pipeline] sh
          [AAA-TestPipeline] Running shell script
          + '[' '' -eq ******** ']'
          /apps/jenkins/slave1/workspace/CWL/AAA-TestPipeline/.jenkins-4173bdf1/script.sh: line 2: [: : integer expression expected
          [Pipeline] } //wrap
          [Pipeline] General Build Wrapper : End
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          Finished: SUCCESS

          In other words, the masking part is working, but accessing the global passwords is not. Am I missing something, or is this a bug?

          Jeffrey Nelson added a comment - - edited I am trying to use this wrapper with the cloudbees workflow/pipeline plugin. Refer to the following code snippet: node { stage 'Test It' wrap([$class: 'MaskPasswordsBuildWrapper' ]) { sh ''' if [ "$MARATHON_PASSWORD" -eq "theMarathonPassword" ]; then echo it works! fi''' } } I have a global password setup named: MARATHON_PASSWORD with value: theMarathonPassword. However, running this pipeline job results in output: Entering stage Test It Proceeding [Pipeline] stage (Test It) [Pipeline] General Build Wrapper : Start [Pipeline] wrap { [Pipeline] sh [AAA-TestPipeline] Running shell script + '[' '' -eq ******** ' ]' /apps/jenkins/slave1/workspace/CWL/AAA-TestPipeline/.jenkins-4173bdf1/script.sh: line 2: [: : integer expression expected [Pipeline] } //wrap [Pipeline] General Build Wrapper : End [Pipeline] } //node [Pipeline] Allocate node : End [Pipeline] End of Pipeline Finished: SUCCESS In other words, the masking part is working, but accessing the global passwords is not. Am I missing something, or is this a bug?

          Sam Gleske added a comment -

          I encounter the same bug.

          Sam Gleske added a comment - I encounter the same bug.

          Same issue here =(
          Is there a way to access global passwords set with Mask Passwords plugin?

          George Yermulnik added a comment - Same issue here =( Is there a way to access global passwords set with Mask Passwords plugin?

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: