aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2022-04-03 23:46:38 +0200
committerMagnus Granberg <zorry@gentoo.org>2022-04-03 23:46:38 +0200
commit4a7e8d870f80b9d2f8a33a8c65d8c8c7db480637 (patch)
treef34a76a6ff2bd90204f4598036e51dab2ef63d08
parentFix UnicodeDecodeError in log parser (diff)
downloadtinderbox-cluster-4a7e8d87.tar.gz
tinderbox-cluster-4a7e8d87.tar.bz2
tinderbox-cluster-4a7e8d87.zip
Add secret string remote shell command patch
Signed-off-by: Magnus Granberg <zorry@gentoo.org>
-rw-r--r--patches/secretstring.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/patches/secretstring.patch b/patches/secretstring.patch
new file mode 100644
index 0000000..4e0833d
--- /dev/null
+++ b/patches/secretstring.patch
@@ -0,0 +1,74 @@
+diff --git a/master/buildbot/process/buildstep.py b/master/buildbot/process/buildstep.py
+index 7ac18b086..82ff7ce07 100644
+--- a/master/buildbot/process/buildstep.py
++++ b/master/buildbot/process/buildstep.py
+@@ -850,6 +850,7 @@ class ShellMixin:
+ 'sigtermTime',
+ 'initialStdin',
+ 'decodeRC',
++ 'SecretString',
+ ]
+ renderables = _shellMixinArgs
+
+diff --git a/master/buildbot/process/remotecommand.py b/master/buildbot/process/remotecommand.py
+index 90ec4c44d..fb3099b28 100644
+--- a/master/buildbot/process/remotecommand.py
++++ b/master/buildbot/process/remotecommand.py
+@@ -44,7 +44,7 @@ class RemoteCommand(base.RemoteCommandImpl):
+
+ def __init__(self, remote_command, args, ignore_updates=False,
+ collectStdout=False, collectStderr=False, decodeRC=None,
+- stdioLogName='stdio'):
++ stdioLogName='stdio', SecretString=False):
+ if decodeRC is None:
+ decodeRC = {0: SUCCESS}
+ self.logs = {}
+@@ -70,6 +70,7 @@ class RemoteCommand(base.RemoteCommandImpl):
+ self.commandID = None
+ self.deferred = None
+ self.interrupted = False
++ self.SecretString = SecretString
+ # a lock to make sure that only one log-handling method runs at a time.
+ # This is really only a problem with old-style steps, which do not
+ # wait for the Deferred from one method before invoking the next.
+@@ -275,6 +276,8 @@ class RemoteCommand(base.RemoteCommandImpl):
+ def cleanup(data):
+ if self.step is None:
+ return data
++ if self.SecretString and isinstance(self.SecretString, list) and len(self.SecretString) == 2:
++ data = data.replace(self.SecretString[0], '<' + self.SecretString[1] + '>')
+ return self.step.build.properties.cleanupTextFromSecrets(data)
+
+ if self.debug:
+@@ -358,7 +361,8 @@ class RemoteShellCommand(RemoteCommand):
+ collectStdout=False, collectStderr=False,
+ interruptSignal=None,
+ initialStdin=None, decodeRC=None,
+- stdioLogName='stdio'):
++ stdioLogName='stdio',
++ SecretString=False):
+ if logfiles is None:
+ logfiles = {}
+ if decodeRC is None:
+@@ -398,7 +402,8 @@ class RemoteShellCommand(RemoteCommand):
+ super().__init__("shell", args, collectStdout=collectStdout,
+ collectStderr=collectStderr,
+ decodeRC=decodeRC,
+- stdioLogName=stdioLogName)
++ stdioLogName=stdioLogName,
++ SecretString=SecretString)
+
+ def _start(self):
+ if self.args['usePTY'] is None:
+diff --git a/master/buildbot/steps/shell.py b/master/buildbot/steps/shell.py
+index d21ca7b9b..cf56a2802 100644
+--- a/master/buildbot/steps/shell.py
++++ b/master/buildbot/steps/shell.py
+@@ -183,6 +183,7 @@ class ShellCommand(buildstep.ShellMixin, buildstep.BuildStep):
+ 'decodeRC',
+ 'stdioLogName',
+ 'workdir',
++ 'SecretString',
+ ] + buildstep.BuildStep.parms
+
+ invalid_args = []