﻿[
  {
    "name":"server",
    "displayName":"Server",
    "type":"plastic_server",
    "description":"Plastic SCM server."
  },
  {
    "name":"repository",
    "displayName":"Repository",
    "type":"string",
    "description":"The repository that the bot will monitor."
  },
  {
    "name":"trunk_branch",
    "displayName":"Trunk branch",
    "type":"string",
    "description": "Trunk Bot will merge all branches into this one."
  },
  {
    "name":"branch_prefix",
    "displayName":"Branch prefix",
    "type":"string",
    "description":"The prefix of the branches to be merged. Example: 'task' will take 'task1234'. This is the same prefix that you use to link branches to the issue tracker. Leave this field empty to track all branches in the repository."
  },
  {
    "name": "bot_user",
    "displayName": "Bot User",
    "type": "user_api_key",
    "description": "The API Key of the Plastic SCM user that the mergebot will use to checkin and perform API calls."
  },
  {
    "name": "queue_again_on_fail",
    "displayName": "Re-enqueue branches that failed due to changes detected in the trunk branch",
    "type": "bool",
    "description": "If new changesets reach your trunk branch while a merge changeset is being tested, it won't be possible to apply it. If you set this, the bot will enqueue the task again and retry with a fresh new merge including the last changes."
  },
  {
    "name":"plastic_group",
    "displayName":"Branch lifecycle and automatic labels",
    "type":"group",
    "description":"",
    "items":[
      {
        "name": "code_review_group",
        "displayName": "Only consider branches with an approved code review",
        "type": "group",
        "description": "The bot will only consider a branch if it has a code review, and the review was marked as approved. If you set this, then you can skip the 'resolved status value' setting if you prefer (it won't be mandatory).This is excellent to enforce that all branches are reviewed by the team prior to merge.",
        "items": [
          {
            "name":"is_enabled",
            "displayName":"Process reviewed branches only",
            "type":"bool",
            "description":"(You will be need to enter the 'Branch status attribute name' and 'Merged status value' fields below to let the trunk-bot track correctly the sucessfully merged branches on this mode)"
          }
        ]
      },
      {
        "name":"status_attribute_group",
        "displayName":"Branch lifecycle configuration with a status attribute",
        "type":"group",
        "description":"Define when a branch is ready to be merged based on a given attribute. Also the values the attribute will take when the bot starts processing the branch.",
        "items":[
          {
            "name":"name",
            "displayName":"Branch status attribute name",
            "type":"string",
            "description":"Branch attribute name that describes the lifecycle status of a branch (e.g. 'status'). It will be automatically created if it doesn't exist yet. This field is mandatory."
          },
          {
            "name":"resolved_value",
            "displayName":"Resolved status value",
            "type":"string",
            "description":"Only branches with this status will be considered by the bot (e.g. 'resolved')."
          },
          {
            "name":"testing_value",
            "displayName":"Testing status value",
            "type":"string",
            "description":"The bot will set this value when it starts processing the branch (e.g. 'testing')."
          },
          {
            "name":"failed_value",
            "displayName":"Failed status value",
            "type":"string",
            "description":"The bot will set this value if the branch is rejected (merge can't happen, tests fail, etc.) (e.g. 'failed'). This value must be different than 'Resolved status value'"
          },
          {
            "name":"merged_value",
            "displayName":"Merged status value",
            "type":"string",
            "description":"The bot will set this status when the branch is correctly processed and merged to the trunk (e.g. 'merged'). This value must be different than 'Resolved status value'"
          }
        ]
      },
      {
        "name":"label_group",
        "displayName":"Automatic labeling",
        "type":"group",
        "description":"Label the changeset after a successful merge",
        "items":[
          {
            "name":"is_enabled",
            "displayName":"Enable automatic labeling",
            "type":"bool",
            "description":"The mergebot will label the changeset created during the merge. It can use 2 options: number autoincrement, and dates."
          },
          {
            "name":"pattern",
            "displayName":"Label pattern",
            "type":"string",
            "description":"Option 1: ${AUTO_INCREMENT_NUMBER}, Option 2: ${BUILD_DATE_FORMATTED, <a_valid_date_format>}. Example: 'LABEL.${AUTO_INCREMENT_NUMBER}_${BUILD_DATE_FORMATTED, yyyy-MM-dd}' will create LABEL.128.2018-10-23. Nested variables are not allowed. Go to the 'Learn more' section of 'trunk-bot' under the 'Mergebot Types' section for further info."
          }
        ]
      }
    ]
  },
  {
    "name":"issues_group",
    "displayName":"Issue Tracker Integration",
    "type":"group",
    "description":"All fields are case-sensitive!",
    "items":[
      {
        "name":"plug",
        "displayName":"Plug",
        "type":"issuetracker_plug",
        "description":"The name of the 'issue tracker plug' that the bot uses to get task status. You probably need to configure it first."
      },
      {
        "name":"project_key",
        "displayName":"Project key",
        "type":"string",
        "description":"Key of the project whose issues will be related to the Plastic branches."
      },
      {
        "name":"title_field",
        "displayName":"Task title field",
        "type":"string",
        "description":"The title field of the task in the issue tracker (e.g. 'summary' in Jira)."
      },
      {
        "name":"status_field_group",
        "displayName":"Task status field",
        "type":"group",
        "description":"Task status field name and values.",
        "items":[
          {
            "name":"name",
            "displayName":"Task status field name",
            "type":"string",
            "description":"The status field of the task to allow the branch to be merged (e.g. 'status' in Jira)."
          },
          {
            "name":"resolved_value",
            "displayName":"Resolved status value",
            "type":"string",
            "description":"The status value to query to check if a task is already resolved before trying to merge it (case-sensitive)."
          },
          {
            "name":"testing_value",
            "displayName":"Testing status value",
            "type":"string",
            "description":"The status value to set when a task is being processed (case-sensitive)."
          },
          {
             "name":"failed_value",
             "displayName":"Failed status value",
             "type":"string",
             "description":"The status value to set when a task fails on any stage (case-sensitive)."
          },
          {
             "name":"merged_value",
             "displayName":"Merged status value",
             "type":"string",
             "description":"The status value to set when a task is sucessfully merged (case-sensitive)."
          }
        ]
      }
    ]
  },
  {
    "name":"ci_group",
    "displayName":"CI Integration",
    "type":"group",
    "description":"",
    "items": [
      {
        "name": "plug",
        "displayName": "Plug",
        "type": "ci_plug",
        "description": "The name of the 'CI plug' that the bot uses to trigger builds and pass tests."
      },
      {
        "name": "plan",
        "displayName": "Plan for build & test a branch",
        "type": "string",
        "description": "The name of the plan to run to test a task."
      },
      {
        "name": "branchAttributesToForward",
        "displayName": "Branch attributes to forward to the build & test plan",
        "type": "string",
        "description": "Comma-separated list of branch attribute names to forward to the underlying CI system as key-value parameters. REMARKS: the trunkbot won't create any of these attribute names in the repository automatically. In case the attribute does not exist, or a branch does not have such attribute set, the trunkbot will create and sent the property with empty value to the CI plan anyway. Also notice that Jenkins will add the 'PLASTICSCM_MERGEBOT_' prefix to the property name (the name of the attribute)."
      },
      {
        "name": "planAfterCheckin",
        "displayName": "Plan to run after checking-in a branch",
        "type": "string",
        "description": "The name of the plan to run after successful checkin of a branch in specified trunk branch (e.g. Use this plan to deploy your code). Leave this field empty if you don't want to run any plan after checkin."
      },
      {
        "name": "branchAttributesToForwardAfterCheckin",
        "displayName": "Branch attributes to forward to the after-checkin plan",
        "type": "string",
        "description": "Similar to the branch attributes to forward to the build & test plan as specified above. But here you might specify a different list of branch attributes to forward to the underlying CI system for the after-checkin plan, in case it is triggered because of a successful build of a branch."
      }
    ]
  },
  {
    "name":"notifier_group",
    "displayName":"Notifications",
    "type":"group",
    "description":"",
    "items":[
      {
        "name":"plug",
        "displayName":"Plug",
        "type":"notifier_plug",
        "description":"The name of the 'notifier plug' to use to send notifications to the team."
      },
      {
        "name":"user_profile_field",
        "displayName":"User profile field",
        "type":"profile_field",
        "description":"The field in the profile to use to identify the correct user to notify. Either this field or the \"Always notify to\" field must be filled-in if you're configuring a notifier plug (but you should probably fill in both of them)."
      },
      {
        "name":"fixed_recipients",
        "displayName":"Always notify to:",
        "type":"string",
        "description":"Comma-separated list of users to notify on every event (plus the branch owner). This list can contain either plastic users (so the actual values will be retrieved from their profiles) or plain usernames in the notification system (e.g. an email address). Either this field or the \"User profile\" field must be filled-in if you're configuring a notifier plug (but you should probably fill in both of them)."
      }
    ]
  }
]