Job Output as HTML

59 views
Skip to first unread message

Ed Carter

unread,
Jul 10, 2020, 9:59:23 AM7/10/20
to rundeck-discuss
HI there,

I am looking at the log filter plugin, specifically to render job output as HTML. I'm confused how to style the HTML though. Do you have any examples of how I could make the output of a powershell or bash script look pretty to the user executing the job in the rundeck console?

Thanks!

Ed

rac...@rundeck.com

unread,
Jul 10, 2020, 11:05:49 AM7/10/20
to rundeck-discuss

Hi Ed,

Check this example, the filter basically renders any HTML output on GUI:

<joblist>
  <job>
    <context>
      <options preserveOrder='true'>
        <option name='age' required='true' value='18' />
      </options>
    </context>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>7e99966c-5ef6-46ad-bc7c-a2dcf2a02e11</id>
    <loglevel>INFO</loglevel>
    <name>HTMLExample</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <fileExtension>.sh</fileExtension>
        <plugins>
          <LogFilter type='render-datatype'>
            <config>
              <datatype>text/html</datatype>
              <sanitizeHtml>true</sanitizeHtml>
              <striped>false</striped>
            </config>
          </LogFilter>
        </plugins>
        <script><![CDATA[echo "<strong>USER:</strong> @job.username@"
echo "<strong>AGE:</strong> @option.age@"]]></script>
        <scriptargs />
        <scriptinterpreter>/bin/bash</scriptinterpreter>
      </command>
    </sequence>
    <uuid>7e99966c-5ef6-46ad-bc7c-a2dcf2a02e11</uuid>
  </job>
</joblist>

You can see the difference, here without HTML filter, and here using HTML output filter.

Hope it helps!

Ed Carter

unread,
Jul 13, 2020, 6:09:17 AM7/13/20
to rundeck-discuss
Thank you very much for this. Exactly what I was looking for.
Reply all
Reply to author
Forward
0 new messages