Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,213
Community Members
 
Community Events
176
Community Groups

variable could assign in the script

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

 

1 answer

0 votes

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.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events