-
-
Notifications
You must be signed in to change notification settings - Fork 128
[JENKINS-71509] Clean up of GradleEnterpriseExceptionTaskListenerDecorator
#318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,7 @@ public GradleEnterpriseExceptionTaskListenerDecorator(Run run) { | |
| @Nonnull | ||
| @Override | ||
| public OutputStream decorate(@Nonnull OutputStream logger) { | ||
| if (isBuildAgentErrorsEnabled()) { | ||
| if (run != null) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fix. We cannot call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use a more expressive condition to "know" we're on the controller ? Maybe
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We could, though it should not matter—if running on an agent, certainly
Seems redundant since
Right. |
||
| return new GradleEnterpriseExceptionLogProcessor(logger, run); | ||
| } | ||
| return logger; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,11 @@ class BuildScanInjectionGradleWithDurableTaskStepUseWatchingIntegrationTest exte | |
| then: | ||
| j.assertLogContains('password=****', secondRun) | ||
| j.assertLogNotContains(secret, secondRun) | ||
|
|
||
| cleanup: | ||
| System.err.println('---%<--- agent logs') | ||
| agent.computer.logText.writeLogTo(0, System.err) | ||
| System.err.println('--->%---') | ||
|
Comment on lines
+79
to
+82
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Otherwise you would not notice the errors. Currently
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooh I see, I wondered as well why I could not see the error |
||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,19 +32,19 @@ class GradleSnippets { | |
| static WorkflowJob pipelineJobWithCredentials(JenkinsRule j) { | ||
| def pipelineJob = j.createProject(WorkflowJob) | ||
|
|
||
| pipelineJob.setDefinition(new CpsFlowDefinition(""" | ||
| pipelineJob.setDefinition(new CpsFlowDefinition(''' | ||
| stage('Build') { | ||
| node('foo') { | ||
| withCredentials([string(credentialsId: 'my-creds', variable: 'PASSWORD')]) { | ||
| if (isUnix()) { | ||
| sh "echo password=\$PASSWORD" | ||
| sh 'echo password=$PASSWORD' | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original test was improperly interpolating the password in Groovy code on the controller, rather than using the environment variable, and so actually running the shell with e.g. echo password=actual secret herePipeline prints a warning about this to the build log. Does not make much difference for purposes of the masking issue (since either way the shell step output contains the secret), but better to test the script that users are actually supposed to write.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not see this warning in the test logs 🤔 but I understand the issue, quite sneaky! |
||
| } else { | ||
| bat "echo password=%PASSWORD%" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| """, false)) | ||
| ''', false)) | ||
| return pipelineJob | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably unnecessary, but core method does not specify nullability of the
buildargument, so being defensive.