The system template files should be stored in the template source repository in a specific order for them to be uploaded to Pipelines:
There must be a directory called templatesin the root directory of the repository.
In the templates directory, there must be a subdirectory path of the form:
namespace/<name>/<files>.
Where:
namespace is the name the template belongs to.
name is the name of the template.
files are the template-related files.
Note
The namespace and subdirectories can only contain letters, underscores, and numbers.
The following files can be added as part of the templates:
File
Description
Mandatory/Optional
templateDefinition.yml
This should contain the pipeline definition and should be a valid
ymlfile.Mandatory
values.yml.example
Use this file as a sample for creating a values.yml file. This should be a valid yml file and it is used to specify the details required for templateDefinition.yml file.
Optional
readme.md
This should contain the documentation for the template.
Optional
Using {{gitBranch}}
Both
templateDefintion.ymlandvalues.ymlsupport the in-built keyword{{gitBranch}}. The value of{{gitBranch}}is substituted with the branch against which the pipeline source was created. For more information, see Creating Multibranch Pipelines.When used in a conditional or comparison logic,
{{gitBranch}}placeholders must be wrapped within double quotes.Example:
{{ if eq "{{gitBranch}}" "master" }}
templateDefinition.yml: This is a sample templateDefinition.yml. This can be edited to create your own version of the file.
templateDefinition.yml
pipelines:
- name: basic
steps:
- name: basic1
type: Bash
configuration:
runtime:
type: image
execution:
onExecute:
- printenv {{ .Values.foo.bar }}
- name: basic2
type: Bash
configuration:
runtime:
type: image
inputSteps:
- name: basic1
execution:
onExecute:
- printenv {{ .Values.foo.baz }}
- name: basic3
type: Bash
configuration:
runtime:
type: image
inputSteps:
- name: basic2
execution:
onExecute:
- printenv {{ .Values.foo.zoo }}
values.yml.example: Use this file as a sample to create the values.yml file.
values.yml.example
artifactoryIntegration: myArtifactoryIntegration
GitRepo:
name: myGitRepo
gitProvider: myGitIntegration
path: myorg/myrepo
branches:
include: master
foo:
name: bar
Image:
name: myDockerImage
sourceRepository: mySourceRepo
Pipeline:
name: myDockerPipeline
DockerBuild:
name: myDockerBuild
dockerFileName: Dockerfile
dockerImageName: <image name>
DockerPush:
targetRepository: docker-local
Bash:
name: myBashStep