Details
-
New Feature
-
Resolution: Fixed
-
Minor
-
None
Description
The `containerTemplate` is used to run the Jenkins slave and e.g. a `mvn` container to build your code
It can also be used to e.g. run e.g. a MongoDB in the background that is used by your tests - I guess that is a valid usecase.
When doing this, it might be useful for debugging purposes to access the logs of the container at some point in the build, before the container terminates - as the user that writes the build might not have access to kubernetes, and also the container will terminate when {{node { }} is finished.
We suggest adding a pipeline step that takes a container name as argument and either prints the container logs to the build log or returns them:
def log = containerLog name: "mongo", returnLog: true containerLog name: "mongo", returnLog: false // print to log by default containerLog "mongo"
We would be willing to implement this ourselves, if you are willing to accept this into the main codebase.
It might also be worthwhile to add a flag to the `containerTemplate` definition allowing to stream the container logs into the build log when they occur (), in order to be able to easier correlate events from the build with events from the container log..
Attachments
Issue Links
- links to