This section provides information about the steps required for creating and publishing system templates.
Step 1: Create System Template Files
In your SCM repository, create a new directory. For example: templates.
In the directory, create three new files:
templateDefinition.yml
: This should contain the pipeline definition and should be a validyml
file. For more information, see the example templateDefinition.yml file.values.yml.example
: This should be a valid yml file and it is used to specify the details required for thetemplateDefinition.yml
file. For more information, see the examplevalues.yml
file.readme.md
(optional): This is optional and the information in thereadme.md
file will be available as Documentation for the template.
Step 2: Use System Template to Create a Pipeline Source
After creating the relevant files for your template, use the pre-loaded PublishTemplate
template to publish and use your system templates:
In the Pipelines UI:
Add an integration for one of the following Git providers:
Add an Artifactory Integration or JFrog Platform Access Token Integration.
In your SCM repository, create a new directory named
.jfrog-pipelines
.In the directory, create two new files:
pipelines.yml
values.yml
Add the following in the
pipelines.yml
file:Pipelines 1.40.0 and higher
valuesFilePath: ./values.yml include: template: jfrog/PublishTemplate/1.1.0
Pipelines 1.39.0 and lower
valuesFilePath: ./values.yml include: template: jfrog/PublishTemplate/1.0.0
Where:
jfrog
is the predefined namespace to be used for thePublishTemplate
template. This is mandatory and cannot be changed.PublishTemplate
is the predefined name of the pre-loaded template that is used for publishing other templates. This is mandatory and cannot be changed.1.1.0
/ 1.0.0 is the version of thePublishTemplate
template. This is mandatory and cannot be changed.Note
If you are using Pipelines 1.40.0 or higher, use 1.1.0 as the version for the
PublishTemplate
templateIf you are using Pipelines 1.39.0 or lower, use 1.0.0 as the version for the
PublishTemplate
template
Update the
values.yml
with the following values:templateRepository: gitProvider: <git_integration_name> path: <git_repository_path> branch: <template_branch> templateFolder: <template_files_folder> publishTemplate: namespace: <template_namespace> name: <template_name> version: <template_version> pipelineName: <optional; pipeline_alternate_name> artifactoryIntegration: <artifactory_integration_name>
Example
templateRepository: gitProvider: myGithub path: john/templates branch: main templateFolder: templates/my_name_space/myPipelineTemplate publishTemplate: namespace: newTemplates name: myPipelineTemplate version: 1.0.0 pipelineName: PublishTemplate artifactoryIntegration: myArtifactory
Where:
templateRepository
provides information about where the template is stored.gitProvider
is the name of the Git integration you created in the first step.path
is the Git repository path.branch
is the name of the branch where the template is available.templateFolder
is the relative path from the root where the template files are located.
publishTemplate
provides requisite metadata for publishing the template.namespace
is the namespace used for storing the template in Artifactory.name
is the name used for storing the template in Artifactory.version
is the version of the template.pipelineName
is the default name of the pipeline that is used for publishing the template to Artifactory. While PublishTemplate is the default name, this tag can be used to provide an alternative name for the pipeline. It is recommended that you change the default name as there could be a pipeline name conflict if you are using the same template multiple times.artifactoryIntegration
is the name of the Artifactory integration or JFrog Platform Access Token Integration you created in the first step.
In the JFrog Platform, go to Administration → Pipelines → Pipeline Sources and add the PublishTemplate pipeline as a pipeline source.
After your Pipeline Source syncs successfully, you can view the newly added pipeline by navigating to My Pipelines on the left navbar and clicking Pipelines → My Pipelines.