Details
-
Bug
-
Status: Resolved (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
-
Jenkins ver. 2.138.3 (Docker Hub)
Wanings NG 1.0.0-beta5
Description
(discussion is split from JENKINS-54759)
Issue
console parsers currently run on the master and for security reasons, this excludes the customizable Groovy Parser.
for an user this is surprising and adding a custom warning parser will need changes in the buildscript to dump output to a log file, ideally adding a parser would not otherwise affect existing jobs .
- not piping would be the most clear, and similar to the scripts you would run on a local build
- piping it just to a file will remove all visible status during execution
- naively splitting it (eg. | tee file.log) will mean the error state of the script doing the build will vanish. see here
- additionally storing and restoring the errors state of the script adds boilerplate code
just to reiterate how invasive this change is, here is my current (POSIX Shell) workaround with variant 4):
before:
sh buildscript.sh ARGS...
after:
pipe_retval() { local LOGFILE=$1; shift (((("$@" 2>&1; echo $? >&3) | tee "$LOGFILE" >&4) 3>&1) | (read xs; exit $xs)) 4>&1 } pipe_retval build.log sh buildscript.sh ARGS...
Attachments
Issue Links
- depends on
-
JENKINS-44450 Block scoped usage
-
- Open
-
- is duplicated by
-
JENKINS-56055 GroovyParser cannot scan console log output
-
- Resolved
-
- links to
The workaround (pipe to tee) works nicely for jobs that don't allow parallel executions - I just tee to a file called build.log and then parse that. I have many parameterized jobs that allow parallel executions. I could prepend the build number to the log file (like build_12454.log), but then I'll need to write another script to clean up old logs in the workspace. Has anyone else solved this?
EDIT: I invented a solution -
EDIT2: Ignore everything I've said. It turns out when Jenkins is running parallel instances of a job, it creates new workspace folders for each instance (e.g. workspace, workspace@2, workspace@3, etc...)
I will revert to just tee'ing to a file called build.log - and it will get overwritten with each new build!
It was a journey, but I got there in the end!