Local Templates

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

Local Templates can be a:

  • Copy of a system template: You can download a copy of a system template and commit it to your pipeline source repository. At this point, your template is disconnected from the centrally available template and will not be updated if the central template is updated.

    or

  • Fully customized template for the pipeline: If you do not want to use an existing template, you can create a new, fully customized YAML file in your pipeline source repository and specify the config using the template pattern.

Related Content

Managing Pipelines TemplatesManaging Pipelines Templates

Example: pipelines.yml

valuesFilePath: <relative path for values.yml> # required for local templates

resources:
  - name: {{ .Values.GitRepo.name }}
    type: GitRepo
    configuration:
      gitProvider: {{ .Values.GitRepo.gitProvider }} 
      path: {{ .Values.GitRepo.path }}   
      branches:
        include: {{ .Values.GitRepo.branches.include }}

  - name: {{ .Values.Image.name }}
    type: Image
    configuration:
      registry: {{ .Values.artifactoryIntegration }}
      sourceRepository: {{ .Values.Image.sourceRepository }}
      imageName: {{ .Values.DockerBuild.dockerImageName }}
      imageTag: 1
      autoPull: true
  
pipelines:
  - name: {{ .Values.Pipeline.name }}
    steps:
      - name: {{ .Values.DockerBuild.name }}
        type: DockerBuild
        configuration:
          dockerFileLocation: .        # requires Dockerfile to be in root
          dockerFileName: {{ .Values.DockerBuild.dockerFileName }}
          dockerImageName: {{ .Values.DockerBuild.dockerImageName }}
          dockerImageTag: ${run_number}  # requires tag to be run number   
          inputResources:
            - name: {{ .Values.GitRepo.name }}  
          integrations:
            - name: {{ .Values.artifactoryIntegration }}

      - name: {{ .Values.DockerPush.name }}
        type: DockerPush
        configuration:
          targetRepository: {{ .Values.DockerPush.targetRepository }}
          integrations:
            - name: {{ .Values.artifactoryIntegration }}
          inputSteps:
            - name: {{ .Values.DockerBuild.name }}
          outputResources:
            - name: {{ .Values.Image.name }}

      - name: {{ .Values.Bash.name }}
        type: Bash
        configuration:
          inputResources:
            - name: {{ .Values.Image.name }}
        execution:
          onExecute:
            - echo “This is a Bash step”

In addition to the local template file, a values.yml file is required in the same repository. This file contains the values required for the local template to create the pipeline definition.

Example: values.yml

artifactoryIntegration: myArtifactoryIntegration

GitRepo:
  name: myGitRepo
  gitProvider: myGitIntegration
  path: myorg/myrepo
  branches:
    include: master

Image:
  name: myDockerImage
  sourceRepository: mySourceRepo      

Pipeline:
  name: myDockerPipeline

DockerBuild:
  name: myDockerBuild   
  dockerFileName: Dockerfile
  dockerImageName: <image name>

DockerPush:
  targetRepository: docker-local 

Bash:
  name: myBashStep