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

bamboo-spec include not working for common job

Dave Attard February 22, 2023

I have build plans working with bamboo-specs and i would like to pull out the common parts into an include. I have read and re-read the specs and i cant work it out

bamboo-specs
| - bamboo.yml
| - Services
| - build-ServiceA.yml
   | - build-ServiceB.yml
| - Common
| - build-job.yml
---
!include 'Services\build-ServiceA.yml'
---
!include 'Services\build-ServiceB.yml'

folder\build-ServiceA.yml-> working

---
version: 2
plan:
project-key: XXX
key: XXXXX
name: Build Service
stages:
- Build:
jobs:
- Build-Service
Build-Service:
key: JOB1
tasks:
- clean
- script:
interpreter: WINDOWS_POWER_SHELL
scripts:
- |-
Set-Location ./${bamboo.solution}
dotnet restore -v q
description: Restore
- script:
interpreter: WINDOWS_POWER_SHELL
scripts:
- |-
Set-Location ./${bamboo.solution}/${bamboo.serviceFolder}
dotnet publish -c Release -v q -o ${bamboo.working.directory}/packages
description: publish
artifacts:
- name: ${bamboo.solution}
location: packages
pattern: '**/*'
shared: true
required: true
artifact-subscriptions: []
variables:
solution: service
serviceFolder: folder
triggers: []
repositories:
- Repo
branches:
create:
for-new-branch: (release|feature)/.+
delete:
after-deleted-days: 1
after-inactive-days: 30
link-to-jira: true

 

What i would like to do is move the Build-Service job into a common include file. Looking at the spec information on includes i should be able to do this. However when i make the changes. i have tried

  • Build-Service: !include '..\common\build-job.yml'
  • Build-Service: !include 'common\build-job.yml'

folder\build-ServiceA.yml-> error 

Bamboo YAML import failed: Invalid format of the YAML file: Include file ..\COMMON\build-job.yml does not exist
---
version: 2
plan:
project-key: XXX
key: XXXXX
name: Build Service
stages:
- Build:
jobs:
- Build-Service

Build-Service: !include '..\common\build-job.yml'

triggers: []
repositories:
- Repo
branches:
create:
for-new-branch: (release|feature)/.+
delete:
after-deleted-days: 1
after-inactive-days: 30
link-to-jira: true

common\build-job.yml

  tasks:
- clean
- script:
interpreter: WINDOWS_POWER_SHELL
scripts:
- |-
Set-Location ./${bamboo.solution}
dotnet restore -v q
description: Restore
- script:
interpreter: WINDOWS_POWER_SHELL
scripts:
- |-
Set-Location ./${bamboo.solution}/${bamboo.serviceFolder}
dotnet publish -c Release -v q -o ${bamboo.working.directory}/packages
description: publish
artifacts:
- name: ${bamboo.solution}
location: packages
pattern: '**/*'
shared: true
required: true
artifact-subscriptions: []

 

1 answer

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.2.1
TAGS
AUG Leaders

Atlassian Community Events