You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从Jenkins向Rundeck传递参数?新手传递IP参数失败求助

Troubleshooting Jenkins-to-Rundeck Parameter Passing Issue

Hey there! Let's work through this parameter passing problem step by step—this is a common gotcha when first integrating Jenkins and Rundeck, so I’ll walk you through exactly what to check and fix:

1. First, Make Sure Rundeck is Ready to Receive the Parameter

You can’t pass a parameter to Rundeck if the job isn’t set up to accept it. Here’s how to fix that:

  • Open your Rundeck job and go to Edit mode.
  • Navigate to the Workflow tab, then click Add Parameter.
  • Create a parameter named ip_address (this name must match exactly what you’re sending from Jenkins—case-sensitive!), set the type to String, and add a default value like 127.0.0.1 for testing.
  • Save the job changes.

2. Fix the Jenkins Rundeck Plugin Configuration

This is where most people trip up—your parameter format in Jenkins is off. Here’s the correct setup:

  • In Jenkins’ post-build action for Rundeck, look for the Job Options (or "Arguments") field.
  • Instead of ip_address=$IP_ADDRESS, you need to use the format -ip_address ${IP_ADDRESS}. The leading dash is critical—Rundeck expects options to be passed with -optionName value syntax.
  • Double-check that you’re referencing Jenkins’ parameter correctly: use ${IP_ADDRESS} (curly braces are more reliable than just $IP_ADDRESS in some Jenkins environments).

3. Correctly Reference the Parameter in Your Rundeck Job

Even if the parameter is sent correctly, you need to call it properly in Rundeck:

  • Go back to your Rundeck job’s Workflow, add a Command step.
  • Instead of echo $IP_ADDRESS, use Rundeck’s option reference syntax: echo ${option.ip_address}. This tells Rundeck to pull the value of the ip_address option you defined earlier.
  • Test this first directly in Rundeck: run the job manually, input an IP, and confirm the echo step outputs it correctly. This ensures Rundeck’s end is working.

4. Debug with Logs if Issues Persist

If it still isn’t working, dig into the logs to pinpoint where the breakdown is:

  • In Jenkins, check the build log for the Rundeck plugin section—look for the actual API call or command it sends to Rundeck. You should see something like -ip_address 10.10.20.30 in the request.
  • In Rundeck, go to System > Logs to view job execution logs. Look for any errors about unrecognized options, or check if the ip_address value is being logged correctly when the job runs.

Quick Extra Tips

  • Case sensitivity is king! Make sure ip_address in Rundeck, Jenkins’ option field, and Jenkins’ parameter name all match exactly (no mixing uppercase/lowercase).
  • If Jenkins and Rundeck are on separate servers, confirm the Jenkins server can reach Rundeck’s API endpoint (no firewall blocks, correct credentials in the plugin).
  • You can test parameter passing directly via Rundeck’s API to rule out Jenkins plugin issues. Use a curl command like:
    curl -X POST -u your-rundeck-user:your-password http://your-rundeck-server:4440/api/40/job/[your-job-id]/run -H "Content-Type: application/json" -d '{"options": {"ip_address": "10.10.20.30"}}'
    
    If this works, the problem is definitely in Jenkins’ plugin configuration.

内容的提问来源于stack exchange,提问作者Sathish Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:58:17