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

在Bamboo部署任务中调用自身REST API获取Jira工单遇阻求助

Bamboo内部调用自身REST API遇到SSL/404问题求助

我是长期浏览Stack Overflow的用户,时隔很久首次发帖,感谢多年来的帮助!

我正尝试在Bamboo中自动化发布后流程,上游构建计划结构如下:

  • 构建项目
    • 计划
      • 默认阶段
        • 构建JAR任务
          • Git检出任务
          • Maven任务
          • 在仓库创建Git标签任务

项目构建完成后,会生成成功的构建(例如#14),并在BitBucket(Git)中创建标签v5.10.4.1。随后我创建了下游部署项目,包含以下脚本任务:

  1. 在Jira中创建fixVersion
  2. 收集最新Bamboo版本中的所有Jira工单
  3. 将所有Bamboo版本工单添加到Jira版本中

这些步骤通过curl调用Jira或Bamboo的REST API实现,步骤1在Jira中未创建过对应fixVersion时可正常运行。

对于步骤2,我在本地工作站测试成功,使用以下命令获取工单并保存为文本文件供步骤3使用:

curl -X GET --user ${bamboo.user}:${bamboo.password} -H 'X-Atlassian-Token: no-check' "https://server-name/rest/api/latest/result/${bamboo.buildResultKey}.json?expand=jiraIssues" -o >(grep -o -E '"(Ticket-KEY)-\d*"' | tr -d '"' > /tmp/issueKeys.txt) && cat /tmp/issueKeys.txt

我尝试将该脚本作为内联或文件型脚本任务在部署中执行,脚本内容如下:

#!/bin/bash
 
# Variables: ${bamboo.user}:${bamboo.password}; ${bamboo.buildResultKey}
# Gather all the Jira Tickets in the lastest Bamboo Release as the second step
 
echo "==> Gather all the Jira Tickets in the lastest Bamboo Release: yes"
 
curl -X GET --user ${bamboo.user}:${bamboo.password} -H 'X-Atlassian-Token: no-check' "https://server-name/rest/api/latest/result/${bamboo.buildResultKey}.json?expand=jiraIssues" -o >(grep -o -E '"(Ticket-KEY)-\d*"' | tr -d '"' > /tmp/issueKeys.txt)
 
echo "==> The following Jira Tickets from the lastest Bamboo Release have been gathered"

# for debugging run this to verfiy the results in the Bamboo deployment logs
cd /tmp/ && ls -la && cat issueKeys.txt && nl issueKeys.txt

但遇到以下问题:

  • 在Bamboo内使用HTTPS的curl命令时,日志显示:curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
  • 在Bamboo内使用HTTP的curl命令时,日志返回404错误:
13-Dec.-2023 14:05:53   <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
13-Dec.-2023 14:05:53   <html><head>
13-Dec.-2023 14:05:53   <title>404 Not Found</title>
13-Dec.-2023 14:05:53   </head><body>
13-Dec.-2023 14:05:53   <h1>Not Found</h1>
13-Dec.-2023 14:05:53   <p>The requested URL was not found on this server.</p>
13-Dec.-2023 14:05:53   <hr>

看起来无法在Bamboo内部调用自身的REST API,但理论上应该可行,我在Atlassian文档中看到过示例:curl -u <ADMIN_USERNAME>:<PASSWORD> <BAMBOO_URL>/build/admin/ajax/getDashboardSummary.action,恳请提供帮助或思路!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 01:53:13