{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/bamboo-spec/latest.json",
  "title": "Bamboo CI Specification",
  "description": "Full spec reference: <https://docs.atlassian.com/bamboo-specs-docs/12.1.2/specs.html>",
  "x-lintel": {
    "source": "https://www.schemastore.org/bamboo-spec.json",
    "sourceSha256": "03808ea111ee9ccda6ac0b3895ef97af090f74670e06330d8af5bb83fce3edf8",
    "fileMatch": [
      "**/bamboo-specs/*.yaml",
      "**/bamboo-specs/*.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "server-name": {
      "title": "Server Name",
      "description": "Identifies which Bamboo server the spec applies to. Can be a regular expression pattern.",
      "type": "string"
    },
    "default-environment-permissions": {
      "title": "Default Environment Permissions",
      "description": "These permissions apply to all environments defined in this deployment project",
      "type": "array",
      "items": {
        "$ref": "#/$defs/permission"
      }
    },
    "deployment": {
      "title": "Deployment",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/deployment"
        }
      ]
    },
    "deployment-permissions": {
      "title": "Deployment Permissions",
      "description": "These permissions apply to the deployment project",
      "type": "array",
      "items": {
        "$ref": "#/$defs/permission"
      }
    },
    "docker": {
      "$ref": "#/$defs/docker"
    },
    "environment-permissions": {
      "title": "Environment Permissions",
      "description": "Permissions specific to an environment",
      "type": "array",
      "items": {
        "type": "object",
        "patternProperties": {
          "[a-zA-Z0-9\\s+_-]": {
            "type": "array",
            "items": {
              "$ref": "#/$defs/permission"
            }
          }
        }
      }
    },
    "environments": {
      "description": "An environment represents the servers or groups of servers where the software release has been deployed to, and the tasks that are needed for the deployment to work smoothly",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "notifications": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "recipients": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "users": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "emails": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              ]
            }
          },
          "events": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/$defs/events"
                },
                {
                  "type": "object"
                }
              ]
            }
          }
        }
      }
    },
    "plan": {
      "$ref": "#/$defs/plan"
    },
    "plan-permissions": {
      "title": "Plan Permissions",
      "type": "array",
      "items": {
        "$ref": "#/$defs/permission"
      }
    },
    "release-naming": {
      "description": "You can define how releases should be named when they are created by Bamboo",
      "anyOf": [
        {
          "$ref": "#/$defs/releaseNaming"
        },
        {
          "type": "string"
        }
      ]
    },
    "repositories": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "patternProperties": {
              "[a-zA-Z0-9_]": {
                "type": "object",
                "properties": {
                  "scope": {
                    "type": "string",
                    "enum": [
                      "project",
                      "global"
                    ]
                  },
                  "type": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  },
                  "branch": {
                    "type": "string"
                  },
                  "viewer": {
                    "type": "string"
                  },
                  "ssh-key": {
                    "type": "string"
                  },
                  "ssh-key-passphrase": {
                    "type": "string"
                  },
                  "username": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  },
                  "shared-credentials": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "project",
                              "global"
                            ]
                          }
                        }
                      }
                    ]
                  },
                  "lfs": {
                    "type": "boolean"
                  },
                  "use-shallow-clones": {
                    "type": "boolean"
                  },
                  "submodules": {
                    "type": "boolean"
                  },
                  "change-detection": {
                    "type": "object",
                    "properties": {
                      "quiet-period": {
                        "type": "object",
                        "properties": {
                          "quiet-period-seconds": {
                            "type": "integer"
                          },
                          "max-retries": {
                            "type": "integer"
                          }
                        }
                      },
                      "exclude-changeset-pattern": {
                        "type": "string"
                      },
                      "file-filter-type": {
                        "type": "string"
                      },
                      "file-filter-pattern": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      }
    },
    "stages": {
      "description": "Stages group jobs to individual steps within a plan's build process.",
      "type": "array",
      "items": {
        "type": "object",
        "patternProperties": {
          "[a-zA-Z0-9\\s+_-]": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "$ref": "#/$defs/stage"
              }
            ]
          }
        }
      }
    },
    "triggers": {
      "$ref": "#/$defs/triggers"
    },
    "variables": {
      "$ref": "#/$defs/keyValue"
    },
    "version": {
      "type": "integer",
      "default": 2
    },
    "branch-overrides": {
      "description": "Overrides for specific branches in the plan",
      "type": "array",
      "items": {
        "type": "object",
        "patternProperties": {
          "[a-zA-Z0-9\\s+_-]": {
            "$ref": "#"
          }
        }
      }
    },
    "other": {
      "type": "object"
    },
    "branches": {
      "$ref": "#/$defs/branches"
    },
    "dependencies": {
      "$ref": "#/$defs/dependencies"
    }
  },
  "$defs": {
    "deployment": {
      "type": "object",
      "title": "Deployment projects",
      "description": "A deployment project in Bamboo is a container for holding the software project you are deploying: releases that have been built and tested, and the environments to which releases are deployed",
      "properties": {
        "name": {
          "type": "string"
        },
        "source-plan": {
          "type": "string"
        }
      }
    },
    "docker": {
      "title": "Docker",
      "description": "Builds and deployments are normally run on the Bamboo agent's native operating system",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "image": {
              "type": "string"
            },
            "volumes": {
              "type": "object",
              "default": {}
            },
            "use-default-volumes": {
              "type": "boolean",
              "default": false
            },
            "docker-run-arguments": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "image"
          ]
        }
      ]
    },
    "events": {
      "type": "string",
      "enum": [
        "plan-failed",
        "plan-completed",
        "plan-status-changed",
        "plan-comment-added",
        "plan-responsibility-changed",
        "job-completed",
        "job-status-changed",
        "job-failed",
        "job-error",
        "job-first-failed",
        "job-hung",
        "job-queue-timeout",
        "job-queued-without-capable-agents"
      ]
    },
    "job": {
      "title": "Job",
      "description": "A job is a single build unit within a plan and is made up of one or more tasks.",
      "properties": {
        "docker": {
          "$ref": "#/$defs/docker"
        },
        "final-tasks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/taskItem"
          }
        },
        "key": {
          "type": "string"
        },
        "other": {
          "type": "object",
          "properties": {
            "clean-working-dir": {
              "type": "boolean"
            }
          }
        },
        "requirements": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "patternProperties": {
                  ".": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        },
        "tasks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/taskItem"
          }
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/job/$defs/artifact"
          }
        },
        "artifact-subscriptions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/artifactSubscription"
          }
        }
      },
      "type": "object",
      "$defs": {
        "artifact": {
          "type": "object",
          "title": "Artifact",
          "description": "Artifacts are files created by a job build (e.g. JAR files)",
          "properties": {
            "location": {
              "description": "The relative path to find your artifact; it's a path relative to the workspace directory; do not use absolute paths.",
              "type": "string"
            },
            "name": {
              "description": "Name of the artifact; in case artifact is shared, name must be unique within the plan.",
              "type": "string"
            },
            "pattern": {
              "description": "Name or Ant pattern of file(s) to keep.",
              "type": "string"
            },
            "required": {
              "type": "boolean"
            },
            "shared": {
              "type": "boolean",
              "description": "You can share an artifact among other jobs or plans.",
              "default": false
            }
          }
        },
        "task": {
          "description": "A task is a small unit of work, such as source code checkout, or running a script",
          "type": "object",
          "properties": {
            "interpreter": {
              "type": "string"
            },
            "clean": {
              "type": "object"
            },
            "checkout": {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "force-clean-build": {
                  "type": "string",
                  "default": false
                }
              }
            },
            "inject-variables": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "file": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "conditions": {
                      "type": "array",
                      "description": "Task execution conditions.",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              ]
            },
            "test-parser": {
              "description": "The Test Results Parser task in Bamboo parses test data",
              "anyOf": [
                {
                  "$ref": "#/$defs/testParser"
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "$ref": "#/$defs/testParser"
                    },
                    "ignore-time": {
                      "type": "boolean"
                    },
                    "test-results": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "type"
                  ]
                }
              ]
            },
            "scripts": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/script"
              }
            }
          }
        }
      }
    },
    "keyValue": {
      "description": "Variables can be used to make values available when building plans in Bamboo.",
      "type": "object",
      "patternProperties": {
        "[a-zA-Z0-9_]": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "boolean"
            },
            {
              "type": "number"
            }
          ]
        }
      }
    },
    "notification": {
      "type": "object",
      "properties": {
        "recipients": {
          "type": "array",
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "users": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            },
            {
              "type": "object",
              "properties": {
                "groups": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          ]
        },
        "events": {
          "type": "array",
          "minLength": 1,
          "items": {
            "$ref": "#/$defs/events"
          }
        }
      }
    },
    "permission": {
      "type": "object",
      "description": "Plan permissions allow a user to control access to the functions of the build plan.",
      "properties": {
        "groups": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "permissions": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/permission/$defs/permission"
              }
            },
            {
              "$ref": "#/$defs/permission/$defs/permission"
            }
          ]
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "users": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "$defs": {
        "permission": {
          "description": "Plan permissions allow a user to control access to the functions of the build plan",
          "type": "string",
          "enum": [
            "view",
            "edit",
            "build",
            "admin",
            "clone",
            "deploy"
          ]
        }
      }
    },
    "plan": {
      "description": "A plan defines everything about your continuous integration build process in Bamboo.",
      "type": "object",
      "properties": {
        "project-key": {
          "type": "string"
        },
        "key": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "predefinedTask": {
      "type": "string",
      "enum": [
        "inject-variables",
        "clean",
        "checkout",
        "artifact-download"
      ]
    },
    "releaseNaming": {
      "type": "object",
      "properties": {
        "next-version-name": {
          "type": "string"
        },
        "applies-to-branches": {
          "type": "boolean"
        },
        "auto-increment": {
          "type": "boolean"
        },
        "auto-increment-variables": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "script": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "script": {
              "type": "string"
            }
          }
        }
      ]
    },
    "stage": {
      "title": "Stage",
      "description": "Stages group jobs to individual steps within a plan's build process.",
      "type": "object",
      "properties": {
        "manual": {
          "description": "Will await for execution by user",
          "type": "boolean"
        },
        "final": {
          "description": "Will be executed regardless of other stages state (pass or fail)",
          "type": "boolean"
        },
        "jobs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "task": {
      "description": "A task is a small unit of work, such as source code checkout, or running a script.",
      "type": "object",
      "properties": {
        "source-plan": {
          "type": "string"
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/job/$defs/artifact"
          }
        },
        "triggers": {
          "type": "array",
          "items": {
            "type": "object",
            "patternProperties": {
              "(build|stage|environment)-success": {
                "$ref": "#/$defs/task/$defs/trigger"
              }
            }
          }
        },
        "notifications": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/notification"
          }
        }
      },
      "$defs": {
        "trigger": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string"
                },
                "branch": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "patternProperties": {
                "[a-zA-Z0-9\\s+_-]": {
                  "type": "string"
                }
              }
            }
          ]
        }
      }
    },
    "testParser": {
      "type": "string",
      "enum": [
        "junit",
        "mstest",
        "nunit",
        "mocha",
        "testng"
      ]
    },
    "triggers": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "$ref": "#/$defs/triggers/$defs/polling"
          },
          {
            "$ref": "#/$defs/triggers/$defs/cron"
          },
          {
            "$ref": "#/$defs/triggers/$defs/remote"
          },
          {
            "$ref": "#/$defs/triggers/$defs/tag"
          },
          {
            "type": "string"
          }
        ]
      },
      "$defs": {
        "polling": {
          "type": "object",
          "properties": {
            "polling": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "object",
                  "properties": {
                    "period": {
                      "type": "integer"
                    },
                    "cron": {
                      "type": "string",
                      "description": "Cron expression for polling trigger."
                    },
                    "repositories": {
                      "type": "array",
                      "description": "Repositories to poll.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string",
                      "description": "Trigger description."
                    },
                    "conditions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "patternProperties": {
                          "[a-zA-Z0-9\\s+_-]+": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "boolean"
                                }
                              }
                            ]
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "remote": {
          "type": "object",
          "properties": {
            "remote": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "ip": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "cron": {
          "type": "object",
          "description": "Execute deployment by schedule.",
          "properties": {
            "cron": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "expression": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "tag": {
          "type": "object",
          "properties": {
            "tag": {
              "type": "object",
              "description": "UNDOCUMENTED. Bamboo detects new tags in repository and builds for all these tags",
              "properties": {
                "filter": {
                  "type": "string",
                  "description": "Use a regular expression to only build for tag that match specific names."
                },
                "tagInBranch": {
                  "type": "boolean",
                  "description": "Only run build if the branch contains the matched tag. The build will be triggered only if the tag revision is in the vcs branch."
                },
                "description": {
                  "type": "string",
                  "description": "Trigger description."
                },
                "conditions": {
                  "type": "array",
                  "description": "Only run Build if other Plans are currently passing.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "green-plan": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Plan Keys"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "additionalProperties": false
        }
      }
    },
    "branches": {
      "title": "Branches",
      "description": "Branch management configuration for the plan.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "create": {
              "type": "string",
              "description": "Branch creation strategy."
            },
            "delete": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "after-deleted-days": {
                      "type": "integer"
                    },
                    "after-inactive-days": {
                      "type": "integer"
                    },
                    "after-issue-status-changed": {
                      "type": "boolean"
                    },
                    "after-successful-builds": {
                      "type": "integer"
                    }
                  }
                }
              ]
            },
            "integration": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "merge-from": {
                      "type": "string"
                    },
                    "push-on-success": {
                      "type": "boolean"
                    },
                    "enabled": {
                      "type": "boolean"
                    }
                  }
                }
              ]
            },
            "link-to-jira": {
              "type": "boolean"
            },
            "notifications": {
              "type": "array"
            }
          }
        }
      ]
    },
    "dependencies": {
      "title": "Dependencies",
      "description": "Plan dependencies configuration.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "enabled-for-branches": {
              "type": "boolean"
            },
            "require-all-stages-passing": {
              "type": "boolean"
            },
            "block-strategy": {
              "type": "string"
            },
            "plans": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "dependencies": {
              "type": "array"
            }
          }
        }
      ]
    },
    "artifactSubscription": {
      "title": "Artifact subscription",
      "type": "object",
      "properties": {
        "artifact": {
          "type": "string",
          "description": "Artifact name to download."
        },
        "destination": {
          "type": "string",
          "description": "Destination directory in workspace."
        },
        "required": {
          "type": "boolean"
        }
      },
      "required": [
        "artifact"
      ]
    },
    "mavenTask": {
      "title": "Maven",
      "type": "object",
      "properties": {
        "executable": {
          "type": "string"
        },
        "jdk": {
          "type": "string"
        },
        "goal": {
          "type": "string"
        },
        "tests": {
          "type": "string"
        },
        "environment": {
          "type": "string"
        },
        "working-dir": {
          "type": "string"
        },
        "project-file": {
          "type": "string"
        },
        "use-return-code": {
          "type": "boolean"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "anyTask": {
      "title": "Any task",
      "description": "Run a task provided by a plugin.",
      "type": "object",
      "properties": {
        "plugin-key": {
          "type": "string"
        },
        "configuration": {
          "type": "object"
        },
        "description": {
          "type": "string"
        }
      },
      "required": [
        "plugin-key"
      ]
    },
    "vcsBranchTask": {
      "title": "VCS Branch",
      "type": "object",
      "properties": {
        "branch": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "vcsTagTask": {
      "title": "VCS Tag",
      "type": "object",
      "properties": {
        "tag": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "vcsCommitTask": {
      "title": "VCS Commit",
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "taskItem": {
      "description": "A task entry. Either a predefined task string, or an object with a single task type key.",
      "anyOf": [
        {
          "$ref": "#/$defs/predefinedTask"
        },
        {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 1,
          "properties": {
            "script": {
              "$ref": "#/$defs/job/$defs/task"
            },
            "maven": {
              "$ref": "#/$defs/mavenTask"
            },
            "inject-variables": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "file": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "conditions": {
                      "type": "array",
                      "description": "UNDOCUMENTED. Task execution conditions.",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              ]
            },
            "any-task": {
              "$ref": "#/$defs/anyTask"
            },
            "vcs-branch": {
              "$ref": "#/$defs/vcsBranchTask"
            },
            "vcs-tag": {
              "$ref": "#/$defs/vcsTagTask"
            },
            "vcs-commit": {
              "$ref": "#/$defs/vcsCommitTask"
            },
            "test-parser": {
              "$ref": "#/$defs/job/$defs/task/properties/test-parser"
            },
            "checkout": {
              "$ref": "#/$defs/job/$defs/task/properties/checkout"
            },
            "clean": {
              "type": "object"
            }
          },
          "additionalProperties": {
            "description": "UNDOCUMENTED. Other task types supported by Bamboo Specs.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object"
              },
              {
                "type": "array"
              },
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        {
          "$ref": "#/$defs/script"
        },
        {
          "$ref": "#/$defs/job/$defs/task"
        }
      ]
    }
  },
  "additionalProperties": {
    "$ref": "#/$defs/job"
  }
}
