Cloud customer?
Start for Free>
Upgrade in MyJFrog >
What's New in Cloud >





Overview

This page provides a high-level overview of the structure of a pipeline configuration file.


JFrog Pipelines uses its own declarative language based on YAML syntax, Pipelines DSL, to describe workflows. You create pipelines in text files written in Pipelines DSL, which we refer to as a管道配置. You can create these files in any text editor of your choice.

You must store your pipeline config file(s) in a source code repository (for example, GitHub). When Pipelines has been configured to use this repo as a pipeline source, the config files will be automatically read and the workflows loaded into Pipelines and run.

Page Contents


Pipeline Config Structure

There are two top-levelsectionsthat can be defined in a pipeline config:

  • A2022世界杯阿根廷预选赛赛程section that specifies the2022世界杯阿根廷预选赛赛程used by the automated pipeline.
  • Apipelinessection that specifies the pipeline execution environment andtheStepsto execute.

For ease of illustration, we'll describe how this looks in a single pipeline config file (e.g.,pipelines.yml).

Example of CSS Layers Effect

Pipeline Config File (YAML)

  resources:
  - name:   resource-1
            type:     [resource-type]
            configuration:
               [resource settings]
  - name:   resource-2
            type:     [resource-type]
            configuration:
               [resource settings]
  pipelines:
     - name: my_pipeline
       configuration:
            
     [environment and runtime settings]
            
     - name: step-name 
       type: [step type] 
       configuration: 
          inputResources: 
             [triggering resource] 
          [step settings] 
       execute: 
          [shell commands to execute on condition] 
            
     - name: step-name 
       type: [step type] 
       configuration: 
          inputResources: 
             [triggering resource] 
          [step settings] 
       execute: 
          [shell commands to execute on condition] 
            
" data-title-set="title-no">




































Resources Section

Resources provide the information that steps need in order to execute, or to store information generated by a step. For example, a resource might point to a source code repository, a Docker image, or a Helm chart. A list of all supported resources is available inResources overview.

The basic format of each2022世界杯阿根廷预选赛赛程declaration is:

Tag Description
name A globally unique friendly name for the resource.
type

A predefined string that specifies the type of resource.

For more information, seeResource Types.

configuration

Begins the section of settings required by the resourcetype. This typically includes the name of the integration that connects the resource to the external service.

Resource definitions are global and can be used by all pipelinesin a Project that are in at least one of the same environments. This means that resource names must be unique across all pipeline config files in a Project.

For example, here is a2022世界杯阿根廷预选赛赛程section that defines two resources, aGitRepoand a DockerImage:

resources: - name: my_Git_Repository type: GitRepo configuration: gitProvider: my_GitHub_Integration path: ~johndoe/demo branches: include: master - name: my_Docker_Image type: Image configuration: registry: my_Docker_Registry_Integration imageName: johndoe/demo_image imageTag: latest

Pipelines Section

Thepipelinessection defines the workflow, consisting of steps and the dependencies between them.

The basic format of eachpipelinesdeclaration is:

Tag Description
name

A friendly name for the resource, unique within the project.

configuration An optional section to specify environment variables and/or aruntimeimage for the pipeline to execute in.
preRun

This is an optional step. When configured, this step will always run at the beginning of a pipeline. This is useful when you want to run some checks at the beginning of a run.

LikePipelines Steps,preRunmust include at least one execution command, such asonExecute,onStart,onSuccess,onFailure, oronComplete. In addition, it can include input and output resources.

Example
pipelines: - name: PreAndPostRuns preRun: execution: onExecute: - printenv - echo "Executing Pre Run"
postRun

This is an optional step. When configured, this step will always run at the end of a pipeline. This is useful when you want to run some checks at the end of a run.

LikePipelines Steps,postRunmust include at least one execution command, such asonExecute,onStart,onSuccess,onFailure, oronComplete. In addition, it can include input and output resources.

Example
pipelines: - name: PreAndPostRuns postRun: execution: onExecute: - printenv - echo "Executing Post Run"

This is followed by a collection ofstepsections that specifies the steps to execute.

Thenameof the pipeline will be available in the environment variable$pipeline_name, which can be used to construct the base name for builds.

Pipeline Configuration

The optionalconfigurationsection can specify an execution environment for all steps in the pipeline. While this configuration can be defined per step, it is sometimes more convenient to define it at a pipeline level if it's going to be the same for all steps in the pipeline.

The basic format of eachconfiguration部分是:

Tag Description
environmentVariables

Variables defined here are available for use in every step in the pipeline. These variables are read-only; they cannot be redefined in a step.

If the following variables are set, they will be used:

  • JFROG_CLI_BUILD_NAME: If set, the pipeline uses this value instead of the default pipeline name for the build info collected.
  • JFROG_CLI_BUILD_NUMBER: If set, the pipeline uses this value instead of the default run number for the build info collected.
  • USE_LOCAL_JFROG_CLI: Ifset astrue, the local JFrog CLI on the host or in the image (depending onruntimeconfiguration) is used instead of the version packaged with JFrog Pipelines. This is not recommended and native steps may not be able to run with the local JFrog CLI version.
  • JFROG_XRAY_URL: IfjfrogCliVersionis set to 2, this variable may be used to specify an Xray URL for use when configuring the JFrog CLI with an Artifactory integration. In most cases, the platform URL will be correct andJFROG_XRAY_URLis not required.
nodePool

Optionally specify a specific node pool where your steps will execute. If not specified, then the node pool set as the the default will be used.

For more information, seeChoosing Node Pools.

affinityGroup

Optionally specify an Affinity Group name to specify that all steps in this Pipeline are part of one Affinity Group. This means that all steps will run on the same build node.

For more information, seeRunning multiple steps on the same build node.

runtime

This section allows you to specify the default runtime environment for steps in the pipeline. The options are:

  • Run steps directly on the host machine
  • Run steps inside the node pool's default Docker container or one of its language-specific variants
  • Run steps inside a custom Docker container of your choice

For more information, seeChoosing your Runtime Image.

chronological

Anyruns of the pipeline will not start running while another run of the same pipeline is processing ifchronologicalis set to true. The default is false, allowing runs to execute in parallel if there are nodes available.

dependencyMode

Specifies when the pipeline may run relative to other pipelines connected by resources. If any of these three settings are true, new runs will not be created for resources updated by other pipelines if there is already a waiting run with the same resources and steps. So if a pipeline runs twice consecutively and the following pipeline has waitOnParentComplete set to true, the following pipeline will only run once. When the pipelines do run, they will use the latest resource versions.

The optional settings are:

  • waitOnParentComplete: If true, the pipeline will not start running when a pipeline that outputs a resource that is an input to this pipeline has a waiting or processing run.
  • waitOnParentSuccess: If true, the pipeline will not start running when a pipeline that outputs a resource that is an input to this pipeline has a processing run or the last complete run was not successful.
  • waitOnChildComplete: If true, the pipeline will not start running when a pipeline that has an input resource that is output of this pipeline has a waiting or processing run unless that child pipeline is waiting for this pipeline to complete.
retentionPolicy

Optionally specify if the pipeline run data should be deleted after a specific number of days. Also, provides the ability to keep a minimum number of pipeline runs data:

  • maxAgeDays: Specifies number of days after which the pipeline run data will be deleted (cannot exceed thesystem level setting). Setting this value to 0 means an infinite retention.
  • minRuns: Specifies the minimum number of pipeline runs data to keep, regardless of their age (cannot exceed thesystem level setting).

For more information, seeSetting Retention Policy.

jfrogCliVersion

Optionally specify either 1 to use JFrog CLI v1 or 2 to use JFrog CLI v2 in the steps in the pipeline. The default is currently v1.

integrations

Specifies Integrations, similar to theintegrationssection in a step, to be inputs to all steps in the Pipeline. Integrations listed here may not be listed in theintegrationssection of a step in this Pipeline.

For more information, seePipelines Integrations.

Pipeline-level declarations for integrations are applicable for all steps. You cannot choose the steps that will not use those integrations.

inputResources

Specifies Resources, similar to theinputResourcessection in a step, to be inputs to all steps in the Pipeline. Resources listed here may not be listed in theinputResourcesor outputResourcessections of any step in this Pipeline. Each Resource ininputResourcesshould be specified bynameand分支(if from a multi-branch Pipeline Sources) and thetrigger选项可以设置控制如果res的更新ource should trigger steps in the Pipeline.

For more information, seeUsing Resources.

Pipeline-level declarations for input resources are applicable for all steps. You cannot choose the steps that will not use those input resources.

outputResources

Specifies Resources, similar to the outputResourcessection in a step, to be inputs to all steps in the Pipeline. Resources listed here may not be listed in theinputResourcesor outputResourcessections of any step in this Pipeline. Each Resource ininputResourcesshould be specified bynameand分支(if from a multi-branch Pipeline Sources).

For more information, seeUsing Resources.

Pipeline-level declarations for output resources are applicable for all steps. You cannot choose the steps that will not use those output resources.

Any step can override the pipeline's defaultruntimeconfiguration if needed to configure its own runtime selection.

Pipeline Steps

Each named pipeline declares a collection of namedstepblocks the pipeline will execute.

The basic format of eachstepdeclaration is:

Tag Description
name A friendly name for the step that may be referenced in other steps. Step names must be unique within the same pipeline.
type

A predefined string that specifies the type of step.

For more information, seePipelines Steps.

configuration

Begins the section of settings required by the steptype. This may include:

  • Environment variables local to the step
  • Any runtime configuration for the step
  • Any triggering input steps or resources
  • Any resources output by the step
  • 任何集成使用的步骤
  • All settings required by the step type
execution Specifies the actions to perform for each execution phase of the step.

For example, here is a a simple sequence of two steps. Each uses the genericBashstep to output text to the console:

steps: - name: step_1 type: Bash configuration: inputResources: - name: my_Git_Repository # Trigger execution on code commit execution: onExecute: - echo "Hello World!" - name: step_2 type: Bash configuration: inputSteps: - name: step_1 # Execute this step after the prior step execution: onExecute: - echo "Goodbye World!"

Pipeline Config File Strategies

A pipeline config file can have one or more pipelines defined in it, but the definition of a single pipeline cannot be fragmented across multiple files.Pipeline configfilenames can be any form you choose, although the convention for a single file ispipelines.yml

Some things to note about pipelines:

  • You can have as many管道配置filesas you want. For example, our customers manage config in the following different ways:
    • Maintain a central DevOps repository and keep all pipeline config files for all projects in that repository.
    • Keep pipeline config files that build each microservice with the source code for that microservice.
    • Separating out pipeline steps and resources into separate config files (for example,pipelines.steps.ymlandpipelines.resources.ymlrespectively).


  • No labels
Copyright © 2023 JFrog Ltd.