Pipeline Templates

Pipeline template JSON

A pipeline template uses the following config JSON:

{
  "schema": "v2",
  "variables": [
    {
      "type": "<type>",
      "defaultValue": <value>,
      "description": "<description>",
      "name": "<varName>"
    }
  ],
  "id": "<templateName>",           # The pipeline instance references the template using this
  "protect": <true | false>,
  "metadata": {
    "name": "displayName",          # The display name shown in Deck
    "description": "<description>",
    "owner": "example@example.com",
    "scopes": ["global"]            # Not used
  },
  "pipeline": {                     # Contains the templatized pipeline itself
    "lastModifiedBy": "anonymous",  # Not used
    "updateTs": "0",                # Not used
    "parameterConfig": [],          # Same as in a regular pipeline
    "limitConcurrent": true,        # Same as in a regular pipeline
    "keepWaitingPipelines": false,  # Same as in a regular pipeline
    "description": "",              # Same as in a regular pipeline
    "triggers": [],                 # Same as in a regular pipeline
    "notifications": [],            # Same as in a regular pipeline
    "stages": [                     # Contains the templated stages
      {
        # This one is an example stage:
        "waitTime": "${ templateVariables.waitTime }",  # Templated field.
        "name": "My Wait Stage",
        "type": "wait",
        "refId": "wait1",
        "requisiteStageRefIds": []
      }
    ]
  }
}

Pipeline JSON

A pipeline instance that implements a pipeline template uses the following config:

{
  "schema": "v2",
  "application": "<appName>",     # Set this to the app you want to create the pipeline in.
  "name": "New Pipeline Name",    # The name of your pipeline.
  "template": {
    "type": "front50/pipelineTemplate",
    "artifactAccount": "front50ArtifactCredentials",
    "reference": "spinnaker://<templateName>"
  },
  "variables": {
    "<varName>": <value>,         # Value for the template variable.
    "someOtherVar": <value>
  },
  "inherit": [],
  "triggers": [],
  "parameters": [],
  "notifications": [],
  "description": "",
  "stages": []
}

A more thorough explanation of some fields such as protect can be found in the v1 schema here .


Last modified September 28, 2020: rest of reference cleanup work (a023331)