How can I find specific text in console output and get ID of log in pipeline?

5 views
Skip to first unread message

Viacheslav Dubrovskyi

unread,
Jan 10, 2019, 9:52:22 AM1/10/19
to Jenkins Users, jgl...@cloudbees.com
Hi.

I use Rich Text Plugin for generate own result table in build.
Before version 2.26 in https://plugins.jenkins.io/workflow-job it was
possible to use grep in job folder for find specific text in console
output and get log ID.

For example:

exec = """
LOG_PATH="$JENKINS_HOME/jobs/test_job/branches/${NameMangler.apply(env.BRANCH_NAME)}/builds/$BUILD_ID/"
      echo "${BUILD_URL}execution/node/\$(grep -l -w "Run
TESTENV=TestEnv_${e}" "\$LOG_PATH"*.log 2>/dev/null | sort -r -V | head
-n1 | xargs -r basename | sed 's/\\.log//')/log/"
"""
stepURL=sh ( script: exec, returnStdout: true).trim()
// result:
https://localhost/job/test_job/job/master/4889/execution/node/3671/log/

But after the changes in workflow-job-plugin-2.26 this was no longer
possible, since the log storage format has changed
(https://github.com/jenkinsci/jep/blob/master/jep/210/README.adoc).

Please help me, how can I find specific text in console output and get
ID of log?

Thank you.

--
WBD,
Viacheslav Dubrovskyi


Reply all
Reply to author
Forward
0 new messages