-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins LTS 2.452.1
durable-task-plugin: 555.v6802fe0f0b_82
kubernetes-plugin: 4253.v7700d91739e5
at a particular place in one of our pipelines sh() calls start failing
that happens with both the binary_wrapper and the script_wrapper of `durabletask.BourneShellScript`.
while `org.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true`:
- with the binary wrapper I get the error log:
sh: 324: /home/jenkins/agent/caches/durable-task/durable_task_monitor_555.v6802fe0f0b_82_linux_64: Argument list too long
- with the script wrapper this error log:
sh: 324: nohup: Argument list too long
but I am not sure if I have any influence on the arguments passed to the BourneShellScript wrappers
according to the jenkins system logs, this is the call that is failing with the above error
Jul 03, 2024 10:31:18 AM FINE org.jenkinsci.plugins.durabletask.BourneShellScript launching [/home/jenkins/agent/caches/durable-task/durable_task_monitor_555.v6802fe0f0b_82_linux_64, -controldir=/home/jenkins/agent/workspace/fix_end-notifications-notworking@tmp/durable-4984d89e, -result=/home/jenkins/agent/workspace/fix_end-notifications-notworking@tmp/durable-4984d89e/jenkins-result.txt, -log=/home/jenkins/agent/workspace/fix_end-notifications-notworking@tmp/durable-4984d89e/jenkins-log.txt, -cookiename=JENKINS_SERVER_COOKIE, -cookieval=durable-1ca101f886c7abfd4d0b13c85b8d02399b77afa195cd70e975190c3f7c5192c4, -script=/home/jenkins/agent/workspace/fix_end-notifications-notworking@tmp/durable-4984d89e/script.sh, -daemon, -debug] Jul 03, 2024 10:31:18 AM FINE org.jenkinsci.plugins.durabletask.BourneShellScriptstarting check in /home/jenkins/agent/workspace/fix_end-notifications-notworking@tmp/durable-4984d89e
any ideas what can be wrong, or how I can diagnose further what is wrong?
After more debugging, I found out that the ContainerExecDecorator of the jenkins-kubernetes-plugin, when it tries to execute a command on a container, it exports first all env-variables. so depending on the length of the values inside the environment variables, it might be that the maximum length of a command that can be passed to sh is reached:
in more details:
to execute a command inside a container with io.fabric8.kubernetes ( what is used by the plugin to interact with kubernetes)
something like this is executed
the ContainerExecDecorator ( as of version 4253.v7700d91739e5 ) passes export commands to sh first, then calls a wrapper around the script that has to be executed, for example the following is passed to the sh command:
where ENVN_VALUE can be some very long value ( like for example the content of a big json file )
and this is what causes the sh() steps to fail