Skip to content
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

[JENKINS-58602] Hide JENKINS_SECRET from pod manifest #552

Merged
merged 4 commits into from
Jul 23, 2019

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Jul 23, 2019

@jglick
Copy link
Member

jglick commented Jul 23, 2019

Some failures in KubernetesPipelineOverridenNamespaceTest [sic].

@Vlatombe
Copy link
Member Author

Yes, currently looking into them, it looks like some flushing issue...

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(once tests pass)

@Vlatombe
Copy link
Member Author

Vlatombe commented Jul 23, 2019

@jglick I narrowed down the failures to something going wrong with the SecretsMasker. If I disable it as follow, the tests pass (but obviously some others would fail). I feel like this is a flushing issue but I can't pinpoint precisely where...

diff --git a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/SecretsMasker.java b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/SecretsMasker.java
index 127c002b..83d90608 100644
--- a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/SecretsMasker.java
+++ b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/SecretsMasker.java
@@ -64,27 +64,7 @@ public final class SecretsMasker extends TaskListenerDecorator {
 
     @Override
     public OutputStream decorate(OutputStream logger) throws IOException, InterruptedException {
-        // TODO better to pick up a standard API from credentials-binding (more efficient)
-        // https://github.com/jenkinsci/credentials-binding-plugin/pull/59#discussion_r288735761
-        return new LineTransformationOutputStream() {
-            @Override
-            protected void eol(byte[] b, int len) throws IOException {
-                String s = new String(b, 0, len, StandardCharsets.UTF_8);
-                for (String value : values) {
-                    s = s.replace(value, "********");
-                }
-                logger.write(s.getBytes(StandardCharsets.UTF_8));
-            }
-            @Override
-            public void flush() throws IOException {
-                logger.flush();
-            }
-            @Override
-            public void close() throws IOException {
-                super.close();
-                logger.close();
-            }
-        };
+        return logger;
     }
 
     @Extension

@jglick
Copy link
Member

jglick commented Jul 23, 2019

See jenkinsci/workflow-durable-task-step-plugin#103. There are some sh steps printing text without a final newline. Try changing e.g.

cat /whatever

into

cat /whatever && echo

@Vlatombe
Copy link
Member Author

Yep, looks like it does the trick.

@jglick
Copy link
Member

jglick commented Jul 23, 2019

I am digging into that bug by the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug Fixes
Projects
None yet
2 participants