YAML Specs: General syntax

Still need help?

The Atlassian Community is here for you.

Ask the community

This document shows how to use some of the YAML Specs code syntaxes.

Requirements

In order to add job requirements in the YAML code, you can use the following format:

Capability typeYAML syntax
Custom
requirements:
     - CustomCapabilityName
Executable
requirements:
     - system.builder.{capabilityType}.{executableLabel}
JDK
requirements:
     - system.jdk.{JDKlabel}
Perforce
requirements:
     - system.p4Executable
Mercurial
requirements:
     - system.hg.executable
Xcode SDK
requirements:
     - system.builder.xcode.{SDKName}
Git
requirements:
     - system.git.executable
Docker
requirements:
     - system.docker.executable

As an example, the code below shows how to add all the requirements types available in Bamboo:

...
  # Job's requirements
  requirements:
     # Custom capabilities
     - isCustom
     - customExecutable
     # Executable capabilities
     - system.builder.mvn2.Maven 2
     - system.builder.command.Ansible
     # JDK capabilities
     - system.jdk.JDK
     - system.jdk.JDK 1.8
     # Perforce capability
     - system.p4Executable
     # Mercurial capability
     - system.hg.executable
     # Xcode SDK capabilities
     - system.builder.xcode.SDK1
     - system.builder.xcode.SDK2
     # Git capability
     - system.git.executable
     # Docker capability
     - system.docker.executable

In Bamboo 7.1.0, you can also get YAML examples by exporting an existing plan to YAML Specs.

To export a plan to YAML Specs, follow the instructions below:

  1. Go to your build plan and select Actions > Configure plan.
  2. On the plan configuration page, select Actions > View plan as YAML

Check an example of a plan below:

---
version: 2
plan:
  project-key: YAML
  key: PLAN
  name: PLAN
stages:
- Default Stage:
    manual: false
    final: false
    jobs:
    - Default Job
Default Job:
  key: JOB1
  requirements:
  - Operating System: Windows
  - system.p4Executable
  - system.docker.executable
  - system.builder.mvn2.Maven 2
  - system.builder.ant.Ant
  - system.jdk.JDK
  - isCustom: 'true'
  - system.builder.msbuild.MSBuild v4.0 (32bit)
  - system.builder.grailsBuilder.Grails 3.3
  - system.hg.executable
  - system.jdk.JDK 1.8
  - system.git.executable
  - system.builder.xcode.SDK1
triggers: []
branches:
  create: manually
  delete: never
  link-to-jira: true
notifications: []
labels: []
other:
  concurrent-build-plugin: system-default
---
version: 2
plan:
  key: YAML-PLAN
plan-permissions:
- users:
  - user
  permissions:
  - view
  - edit
  - build
  - clone
  - admin
...


Read more


Last modified on Aug 8, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.