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

bamboo requirement capability variable with pipe | operator doesn't work in Bamboo YAML specs

ananda3 May 24, 2023

We have a requirements capability variable

var = org1|org2|org3

when used this variable in bamboo yaml specs, it gets treated as string text and not as it gets processed from UI config.

Please help how this can be handled.

1 answer

1 vote
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2023

Hello @ananda3

Bamboo YAML Specs will match a Regex under Requirements.

For example, I want my plan to accept my_requirement as either org1, org2 or org3:

---
version: 2
plan:
project-key: ABC
key: GHI
name: GHI
stages:
- Default Stage:
manual: false
final: false
jobs:
- Default Job
Default Job:
key: JOB1
tasks:
- checkout:
force-clean-build: 'false'
description: Checkout Default Repository
artifact-subscriptions: []
requirements:
- my_requirement: ^(org1|org2|org3)$
...

Please check your YAML code for a valid regular expression.

Thank you,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

ananda3 May 25, 2023

@Eduardo Alvarenga this way I agree that my_requirement will be accepted as it is hardcoded in specs. However, my use case is that I want it to be configured from outside of the bamboo specs and dynamically bind with in the specs via project variable.

As mentioned, we have Requirements required capability defined with as a variable (e.g. my_requirement). Now, the condition that is put in place in UI config is

"my_requirement matches org1|org2|org3"

I want to map my requirement in bamboo specs as following:

project_org_variable = org1|org2|org3

requirements:
- my_requirement: ${bamboo_project_org_variable}

 But, this doesn't work. Our use case is that if org1 is down then we can just update the project variable to org2|org3 and there is no need to update bamboo specs for this.

If I follow above approach, it comes as below in the spec file

requirements:
- my_requirement: 'org1|org2|org3'

I need a way to get rid of these quotes.

Like Eduardo Alvarenga likes this
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2023

Hello @ananda3

Adding variables to the Agent can Capabilities requirement fields is currently not supported in Bamboo.

We have a feature request you can vote on and follow to be notified of any changes in the future.

Make sure you add a comment with your specific business case so the developers can consider it to expedite the feature implementation.

Cheers,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Like Steffen Opel _Utoolity_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events