Bamboo is not getting build variables from path variables
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Bamboo extends functionality to integrate with third-party services, one of which is Service Now. Such integrations are able to automate the running of builds. Bamboo queue API allows Services to pass Bamboo variables as URL path variables, and if these variables are incorrectly formatted Bamboo will not consume them therefore causing the build to fail.
Environment
Bamboo Datacenter
Diagnosis
- Confirm that your build-required environmental variables are defined based on Bamboo variable definition i.e. bamboo.variable.{VARIABLE_NAME}.
- Add the first task called Dump variables to log
Run a new build using the API endpoint
# /rest/api/latest/queue/{PROJECT_KEY}-{PLAN_KEY} curl --location --request POST 'http://localhost:8085/rest/api/latest/queue/BP-TPFPRV?bamboo.variable.BUILD_SEQ_NUMBER=350i424&bamboo.variable.BUILD_MARKER=3400984&bamboo.variable.BUILD_STARTEDBY=admin_user' \ --header 'Authorization: Bearer YWRtaW46ZWVlZWVlMjI=' \
Bamboo build log shows the variables dumped as part of Bamboo variables for that build. If the variables were added correctly as path variables, the variables will be logged in the dump log.
simple 24-Nov-2023 02:29:14 ---- DUMPING VARIABLES TO LOG --- simple 24-Nov-2023 02:29:14 key: [BUILD_MARKER] value: [3400984] type: MANUAL simple 24-Nov-2023 02:29:14 key: [BUILD_SEQ_NUMBER] value: [350i424] type: MANUAL simple 24-Nov-2023 02:29:14 key: [BUILD_STARTEDBY] value: [admin_user] type: MANUAL simple 24-Nov-2023 02:29:14 key: [ManualBuildTriggerReason.userName] value: [admin] type: CUSTOM simple 24-Nov-2023 02:29:14 key: [agentId] value: [1703937] type: CUSTOM
- You can also find them on the build summary page;
Solution
When using Bamboo variables, follow the instructions on how to use variables described in Bamboo variables.