The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
The bamboo deploy tasks:
variable name downtime_id
value null
script
interpreter:shell
script location: inline
#!/usr/bin/env bash
start=$(date +%s)
end=$(date -d "+1 day" +%s)
echo $start
echo $end
echo ${bamboo.local_deploy_environment}
echo ${bamboo.DD_API_KEY_PASSWORD}
echo ${bamboo.DD_APP_KEY_PASSWORD}
echo ${bamboo.downtime_id}
{bamboo.downtime_id}=`curl --silent -X POST "https://api.datadoghq.eu/api/v1/downtime" \
-H "Content-type: application/json" \
-H "DD-API-KEY: ${bamboo.DD_API_KEY_PASSWORD}" \
-H "DD-APPLICATION-KEY: ${bamboo.DD_APP_KEY_PASSWORD}" \
-d '{"scope": "environment-name:${bamboo.local_deploy_environment}","start":'"${start}"',"end":'"${end}"'}'| awk -F, '{print $19}'|awk -F: '{print $2}'`
echo ${bamboo.downtime_id}
got error message when deploy: bamboo.downtime_id=50005497: command not found
build 19-Jul-2021 06:35:17 1626676517 2build 19-Jul-2021 06:35:17 1626762917 3build 19-Jul-2021 06:35:17 devops-test 4build 19-Jul-2021 06:35:17 ******** 5build 19-Jul-2021 06:35:17 ******** 6build 19-Jul-2021 06:35:17 1234 7error 19-Jul-2021 06:35:17 /home/bamboo/bamboo-agent-home/temp/9437185-231637028-269254920-ScriptBuildTask-88981604564562628.sh: line 15: bamboo.downtime_id=50005497: command not found 8build 19-Jul-2021 06:35:17 .downtime_id
Hi @Stan Zhou ! Welcome to the community!
It seems to me that you would not need to have curly braces around bamboo.downtime_id when setting its value. Please make a test using it this way:
bamboo.downtime_id=`curl...
Hope this helps!
Hi @Cristiano Mariano , thank you for your reply.
I know, the normal way access the variable without curly braces, had tried before it failed.
The way to solve the issue is using the Jinject Bamboo variables plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.