Hello everyone,
I'm trying to automate the post release process inside of Bamboo, I have a the following structure in my build plan (upstream):
After building my project I have a successful build with i.E. #14 and the tag 'v5.10.4.1' in ButBucket (Git).
Following this I created a Deployment Project (downstream) that has these script tasks:
The steps use curl in some form or another and the REST API either from Jira or Bamboo, Step 1 works with any problems as long as the fixVersion hasn't been created in Jira previously.
For Step 2 I did a test from my workstation with success using this command to get the issues and save them as a text file for Step 3 afterwards:
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
I tried doing this as a Script Task during my deployment as either inline or file based, this is my script:
#!/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
I ran into the following problems:
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>
It seems it is not possible to curl the Bamboo REST API from inside of Bamboo it's self but it should be possible, I found this in the Atlassian documentation:
curl -u <ADMIN_USERNAME>:<PASSWORD> <BAMBOO_URL>/build/admin/ajax/getDashboardSummary.action
Maybe someone has solved this already but I can't find a thread or documentation. Many thanks for help or ideas!
Your issue with using curl to access the Bamboo REST API from within Bamboo itself appears to involve a couple of different problems: SSL issues and incorrect URL handling. Let's address each issue and propose a solution.
SSL Issue
The error message curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number suggests a mismatch in the SSL protocol between the curl client and the server. This can be caused by an outdated curl or OpenSSL library on the Bamboo server or by specific server configurations.
Possible Solutions:
HTTP 404 Error
Receiving a 404 error with the HTTP URL might be due to incorrect API endpoint specification or server configuration that does not route HTTP traffic correctly.
Check the API Endpoint:
Ensure that the API endpoint URL is correct. It's worth double-checking the base URL and the API path. Sometimes, path issues or typos can lead to 404 errors.
Script Adjustments
Given the issues you're facing, here are some adjustments and considerations for your script:
bash
#!/bin/bash # Use -k for debugging purposes only; remove in production curl -k -v -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" | grep -o -E '"(Ticket-KEY)-\d*"' | tr -d '"' > /tmp/issueKeys.txt echo "==> The following Jira Tickets from the latest Bamboo Release have been gathered" cat /tmp/issueKeys.txt
Lastly, always consult the latest Atlassian documentation and consider reaching out to Atlassian support or community forums if the problem persists. Custom situations like this can sometimes involve nuances specific to your environment or version of the tools you're using.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.