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

API to decorate console output

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
    • Similar Issues:

      Description

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

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            nels4784 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?

            Show
            nels4784 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?
            Hide
            sag47 Sam Gleske added a comment -

            I encounter the same bug.

            Show
            sag47 Sam Gleske added a comment - I encounter the same bug.
            Hide
            yz George Yermulnik added a comment -

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

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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: