I want to set up a bamboo job where it must be run manually and some variables must be set. Is there some way to do this? As things are, the person has to remember to use Run Customized and set the variables.
You may use a script to validate the value given to a variable, and declare the variable with a default value that should be overridden.
- Plan variable=
myvar
, value=to-override
Bash script:
if [[ "${bamboo.myvar}" = 'to-override' ]]; then echo "You have to override this variable" exit 1 fi
This may be the first job of the first stage in your pipeline, that runs where ie. bash is available.
Unfortunately I don't think this is currently possible. I had asked Atlassian about this in the past and they suggested I vote for their open issue BAM-12514. Given that it's been open since 2012 I don't expect they're going to hop right on it, but throwing some votes at it can't hurt.
We ended up creating an in-house Bitbucket plugin to trigger a build on a specified commit and prompt for the required variables and trained users to use that rather than Bamboo, but that's obviously not a general-purpose solution. Probably the best you can do is add an initial step that will immediately fail and notify the users if the variables aren't defined. If queue waits are an issue you could configure that job to run on a dedicated local agent to ensure users are notified immediately when they forget the variables rather than hours later when the build hardware is available.
© 2022 - 2024 — McMap. All rights reserved.