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

[YAML spec] How to make a 'plan permission' for multiple build plan?

Valerii February 22, 2023

Hi Team,

I'm trying to configure my build plan with a YAML spec and have a problem with plan permissions.

I have created the file "permission.yml" and Imported it in "bamboo.yml"

"permission.yml" has the following instructions:

---
version: 2
plan: PROJECT-PLANKEY

plan-permissions:
  - users: [ user1, user2, user3 ]
    permissions:
- view
- build
...

--- version: 2 plan: PROJECT-PLANKEY2 plan-permissions: - users: [ user1, user2, user3 ] permissions:
- view
- build
...

And in this case I have an error.

Also, I have tried to add permission in every file with a plan configuration, but it gives the same error

22-Feb-2023 05:52:12 Bamboo YAML import failed: Invalid format of the YAML file: expected a single document in the stream
22-Feb-2023 05:52:12 in 'reader', line 2, column 1:
22-Feb-2023 05:52:12 version: 2
22-Feb-2023 05:52:12 ^
22-Feb-2023 05:52:12 but found another document
22-Feb-2023 05:52:12 in 'reader', line 84, column 1:
22-Feb-2023 05:52:12 ---
22-Feb-2023 05:52:12 ^
22-Feb-2023 05:52:12
22-Feb-2023 05:52:12
22-Feb-2023 05:52:12 Do you need help? Please visit http://docs.atlassian.com/bamboo/docs-0802/Bamboo+Specs+troubleshooting

Could you help me find a solution?

 

3 answers

1 vote
Andrew Trapani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 11, 2024

If case anyone comes here, I fixed this by moving all of the plan-permissions section to the main `bamboo.yml` file OR putting each of the plan-permissions sections into separate files and including them in the `bamboo.yml` file.

---
version: 2
plan: PROJECT-PLANKEY2

plan-permissions:
- users: [ user1, user2, user3 ]
(... and all lines

When I created new files and did an `!include my-new-spec-1.yml` in the main `bamboo.yml`, it complained with the same errors described above.

It complained at the Line of Code above `version: 2`.


The problem was my new spec files included the above plan permissions section at the bottom, but this causes spec compiler errors.

Cut the plan-permissions section from the bottom of the new spec files and past them into the bamboo.yml main file

So then the resolved `bamboo.yml` file might look something like this:

---
!include 'my-new-spec-1.yml'
---
!include 'my-new-spec-2.yml'
---
version: 2
plan:
key: MNS1
plan-permissions:
- roles:
(... and the rest of the lines just from the plan permissions,
where my-new-spec-1.yml has a plan key of MNS1)

OR, create separate files for each of the plan permissions

---
!include 'my-new-spec-1.yml'
---
!include 'my-new-spec-2.yml'
---
!include 'my-new-spec-1-permissions.yml'
(... and so on)

Where `my-new-spec-1-permissions.yml` contains the plan-permissions:

---
version: 2
plan:
key: MNS1
plan-permissions:
- roles:
(... and the rest of the lines just from the plan permissions,
where my-new-spec-1.yml has a plan key of MNS1)
1 vote
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2023

Hello @Valerii

Just remove the first three dots (...) from the initial permissions block and it should work.

---
version: 2
plan: PROJECT-PLANKEY

plan-permissions:
- users: [ user1, user2, user3 ]
permissions:
- view
- build
---
version: 2
plan: PROJECT-PLANKEY2

plan-permissions:
- users: [ user1, user2, user3 ]
permissions:
- view
- build
...

The three dots indicate the "End of Document" in standard YAML and that will confuse the parser as it had not really ended at that stage.

Sincerely,

Eduardo Alvarenga
Atlassian Support APAC

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

Dave Attard February 22, 2023

i am having a similar issue with includes that contain multiple "documents"

bamboo specs include file with multiple documents (atlassian.com)

23-Feb-2023 17:37:02	Bamboo YAML import failed: Invalid format of the YAML file: expected a single document in the stream
23-Feb-2023 17:37:02	 in 'reader', line 2, column 1:
23-Feb-2023 17:37:02	    version: 2
23-Feb-2023 17:37:02	    ^
23-Feb-2023 17:37:02	but found another document
23-Feb-2023 17:37:02	 in 'reader', line 42, column 1:
23-Feb-2023 17:37:02	    ---
23-Feb-2023 17:37:02	    ^
23-Feb-2023 17:37:02	
23-Feb-2023 17:37:02	
23-Feb-2023 17:37:02	Do you need help? Please visit http://docs.atlassian.com/bamboo/docs-0902/Bamboo+Specs+troubleshooting
23-Feb-2023 17:37:02	

 

bamboo.yml

---
!include 'Deployment\ServiceA-Deployment.yml'

 Deployment\ServiceA-Deployment.yml

---
version: 2
deployment:
name: My deployment
source-plan: PLAN-KEY
release-naming:
next-version-name: release-1.0
applies-to-branches: true
auto-increment: true
environments:
- QA
QA:
tasks:
- clean
- artifact-download:
destination: /workdir
- script:
- echo 'hello world'
- echo "I’m done"
---
version: 2
deployment:
name: My deployment

deployment-permissions:
- users:
- local-admin
- remote-admin
groups:
- bamboo-remote-users
permissions:
- view
- edit

 

0 votes
Valerii February 28, 2023

Hi @Eduardo Alvarenga ,

I have tried to remove "..." (three dots) but it doesn't help. The same error.

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2023

Hello @Valerii

As your issue goes beyond a syntax error, I advise you to open a Support Ticket with Atlassian.

Please do not expose any private information here as it is a public forum.

Cheers,

Eduardo Alvarenga
Atlassian Support APAC

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events