[英]Rundeck - HTTP Workflow Step API Token
在 Rundeck 中,我有一系列 HTTP POST 工作流程步骤。 有没有办法将 API 令牌从初始登录步骤持久化到后续请求? 这可以通过日志过滤器以某种方式完成吗?
您可以为此使用数据值,并使用${data.MYDATAKEY}
作为步骤调用它,并使用@data.MYDATAKEY@
作为内联脚本调用它。
这里有一个例子:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>f9b4b925-3078-4668-bdf5-79e25173a183</id>
<loglevel>INFO</loglevel>
<name>HiWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<description>generate token step</description>
<fileExtension>.sh</fileExtension>
<plugins>
<LogFilter type='key-value-data'>
<config>
<logData>true</logData>
<regex>^(MYTOKEN)\s*=\s*(.+)$</regex>
</config>
</LogFilter>
</plugins>
<script><![CDATA[echo "MYTOKEN=12345"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
<command>
<description>print token or use on any step</description>
<fileExtension>.sh</fileExtension>
<script><![CDATA[echo "the token is @data.MYTOKEN@"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
</sequence>
<uuid>f9b4b925-3078-4668-bdf5-79e25173a183</uuid>
</job>
</joblist>
通过这种方式,您可以在作业定义中使用定义为数据选项的相同 API 令牌。 检查此以了解有关如何工作的更多信息。
更新:我更改了作业定义示例,现在生成一个令牌(模拟)并稍后在任何工作流程步骤中使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.