-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: kubernetes-plugin
When running a build step in a declarative pipeline, remote processes started by Launcher doesn't redirect their stdin/stdout/stderr. This breaks many plugins which run remote processes on a slave:
Proc proc = launcher.launch().cmds(commands).pwd(filePath).readStdout().readStderr().start(); InputStream stdout = proc.getStdout(); // stdout is null InputStream stderr = proc.getStderr(); // stderr is null
This happens because Kubernetes plugin wraps the steps with a `container` statement, which uses ContainerExecDecorator to run remote commands via the Kubernetes exec API rather than the Jenkins agent.
From my understanding, this is used to implement the `container` statement in the DSL, which can run a command in a sidecar container.
Considering the feature of running command in a sidecar container is still marked as `ALPHA` in the document, there are still some compatibility issues like:
1. Forwarding streams between stdin/stdout/stderr of a remote process and master is currently not supported.
2. Environment variables and effective UID/GID are not inherited from the JNLP process.
3. The process started with Kubernetes exec API always has a parent PID 0.
I would like to change the process of translating declarative pipeline code: Unless the pipeline user specifies an alternative default container to run pipeline steps, the pipeline steps will not be enclosed with a `container` statement.
A possible fix: https://github.com/jenkinsci/kubernetes-plugin/pull/377
- links to