如何在 Rundeck 中创建作业来测试网站登录?

问题描述

我是 Rundeck 的初学者,我想创建一个作业来测试特定网站中的登录。 我该怎么做?

解决方法

您可以使用 job 创建一个 inline script step,该 import it 使用 CURL 调用站点 API。

例如,要测试 rundeck 本身,您可以在 rundeck 作业中使用以下脚本:

curl -v -c cookie -b cookie -d j_username=admin -d j_password=admin http://localhost:4440/j_security_check \
    -H "Accept: application/json" \
    http://localhost:4440/api/38/system/info/

以及作业定义,您可以将其复制并保存为 YAML 文件,然后 {{3}} 到您的项目进行测试。

- defaultTab: nodes
  description: ''
  executionEnabled: true
  id: 2dc15b18-5b2c-4081-be72-17eb3618d68c
  loglevel: INFO
  name: Login
  nodeFilterEditable: false
  plugins:
    ExecutionLifecycle: null
  scheduleEnabled: true
  sequence:
    commands:
    - fileExtension: .sh
      interpreterArgsQuoted: false
      script: |-
        curl -v -c cookie -b cookie -d j_username=admin -d j_password=admin http://localhost:4440/j_security_check \
            -H "Accept: application/json" \
            http://localhost:4440/api/38/system/info/ | jq
      scriptInterpreter: /bin/bash
    keepgoing: false
    strategy: node-first
  uuid: 2dc15b18-5b2c-4081-be72-17eb3618d68c