You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I've a python script that downloads artifacts from a bamboo job using Bamboo REST API. and then use those artifacts to further generate reports.
To download the artifacts,
1. I get latest job results using
https://<my-domain>/rest/api/latest/result/<jobkey with build number>?expand=artifacts
2. Use artifacts node to get href attribute of artifacts
3. hitting that href downloads the artifact.
I want to run this script on another bamboo plan. I have the plan setup and running but the only confusion I have is where will the downloaded stuff go so that I can use that?
Is there any way I can specify download location with that href hit ?
Hello @Farwa Shahid
Thank you for the question!
You need to call the planDirectoryInfo REST endpoint to find the folder where the artifacts are stored on the server:
For example:
$ curl -s -k -u admin:admin -H 'Accept: application/json' \
https://bamboo825.mydomain.net/rest/api/latest/planDirectoryInfo/BFMS-RT | jq
{
"results": [
{
"planName": "Regression Tests",
"isBranchBuild": false,
"storageTag": "plan-34635781",
"artifact_plan_roots": [
"/var/atlassian/application-data/bamboo/shared/artifacts/plan-34635781"
],
"build_log_job_roots": {
"BFMS-RT-SSD": [
"/var/atlassian/application-data/bamboo/shared/builds/plan-34635781-SSD"
],
"BFMS-RT-REGRES01": [
"/var/atlassian/application-data/bamboo/shared/builds/plan-34635781-REGRES01"
],
"BFMS-RT-REGRES02": [
"/var/atlassian/application-data/bamboo/shared/builds/plan-34635781-REGRES02"
],
"BFMS-RT-TLA": [
"/var/atlassian/application-data/bamboo/shared/builds/plan-34635781-TLA"
],
"BFMS-RT-TR": [
"/var/atlassian/application-data/bamboo/shared/builds/plan-34635781-TR"
]
}
}
]
}
Then you can apply a jq filter to capture only the artifact_plan_roots folder:
$ curl -s -k -u admin:admin -H 'Accept: application/json' \
https://bamboo825.mydomain.net/rest/api/latest/planDirectoryInfo/BFMS-RT \
| jq -r '.results[].artifact_plan_roots[]'
/var/atlassian/application-data/bamboo/shared/artifacts/plan-34635781
More information:
Kind regards,
Eduardo Alvarenga
Atlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
Actually I don't have global administrative permissions to hit this endpoint.
Let me elaborate my question more
I've a plan A that runs and creates artifacts and store them as TAR file , somewhere on bamboo.
I've plan B that needs to DOWNLOAD those artifacts , extract the TAR and use data to create custom reports etc.
I've my plan B up and running which is a python script.
that downloads the artifacts the way I stated above.
import requests
requests.get(<download-link>)
downloads the file in my local Downloads folder, but when running on bamboo, where will these downloaded files go ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Farwa Shahid
Considering you are running the download script from a Script task. The files will be stored on the root of your build working directory. You can expand the ${bamboo.build.working.directory} variable to find the full path for the build location. Normally:
On a Local Agent:
<bamboo-home>/local-working-dir/${bamboo.buildKey}
On a Remote/Elastic Agent:
<bamboo-agent-home>/xml-data/build-dir/${bamboo.buildKey}
More information on variables:
I would also recommend, instead of using a custom script to download artifacts form other plans, that you practice Sharing Artifacts between Jobs, Plans and Deployments.
Best regards,
Eduardo Alvarenga
Atlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.