Add System Template (1.31.0 and higher)

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

This section provides information about the steps required for creating and publishing system templates.

Step 1: Create System Template Files

  1. In your SCM repository, create a new directory. For example: templates.

  2. In the directory, create three new files:

    • templateDefinition.yml: This should contain the pipeline definition and should be a valid yml 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 the templateDefinition.yml file. For more information, see the example values.yml file.

    • readme.md (optional): This is optional and the information in the readme.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:

  1. In the Pipelines UI:

  2. In your SCM repository, create a new directory named .jfrog-pipelines.

  3. In the directory, create two new files:

    • pipelines.yml

    • values.yml

  4. 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 the PublishTemplate 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 the PublishTemplate 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 template

      • If you are using Pipelines 1.39.0 or lower, use 1.0.0 as the version for the PublishTemplate template

  5. 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.

  6. In the JFrog Platform, go to Administration → Pipelines → Pipeline Sources and add the PublishTemplate pipeline as a pipeline source.

    publish_template_source.png
    publish_template.png

    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.