Cloud customer?
 Upgrade in MyJFrog >

Search





Overview

This pipeline demonstrates the definition of a very basic pipeline for demonstration purposes. It shows through example Pipelines config YAML how to use integrations, resources, and steps to construct a simple workflow.


This basic pipeline project can be forked from the  JFrog GitHub repository and sync successfully with few  changes.

The pipeline demonstrates the following essential concepts:

  • Trigger on commit to Git repository
  • Output of BuildInfo resource
  • Creating pipeline and step environment variables
  • Using integration environment variables
  • Updating the run state
  • Specifying a language runtime
  • Executing steps in parallel
Page Contents

Example YAML Files

The example in the  JFrog GitHub repository provides a single YAML file:

  • pipelines.yml – Declarations of all resources and workflow steps.

It would be equally valid to keep both parts in a single file, if you choose.

All pipeline definitions are global across your JFrog Pipelines project. The names of your steps and resources need to be unique within the JFrog Pipelines project.

Integrations

This pipeline config assumes that the following integrations have been added to the JFrog Pipelines project and are available to resources and steps:

Resources

resources
resources:
  - name: myGitRepo
    type: GitRepo
    configuration:
      gitProvider: my_github                       # <- Change to your integration name
      path: jfrog/jfrog-pipelines-simple-example   # <- Change to your forked repo
      branches:
        include: master

  - name: myBuildInfo
    type: BuildInfo
    configuration:
      sourceArtifactory: art                       # <- Change to your integration name
      buildName: SampleApp
      buildNumber: 1         


Pipeline and Steps

steps
pipelines:  
  - name: basic_pipeline
    configuration:
      environmentVariables:
        readOnly:
          my_env_var: "hello"  
    steps:
      - name: step_1
        type: Bash
        configuration:
          inputResources:
            - name: myGitRepo
          outputResources:
            - name: myBuildInfo             
        execution:
          onExecute:
            - echo $my_env_var
            - if [ -z $app_version ]; then add_pipeline_variables app_version=1.0.0; else app_version=$(bump_semver $app_version minor); fi
            - write_output myBuildInfo "buildNumber=$app_version"
            - add_run_variables run_var="hello"

      - name: step_2
        type: Bash
        configuration:
          inputResources:
            - name: myBuildInfo            
          runtime:
            type: image
            image:
              auto:
                language: java
                versions: ['11']
        execution:
          onExecute:
            - echo $run_var  
            - echo $res_myBuildInfo_buildNumber

      - name: step_3
        type: Bash
        configuration:
          environmentVariables:
            step_env_var1: "hello"
          inputSteps:
            - name: step_2
        execution:
          onExecute:
            - echo $step_env_var1

      - name: step_4
        type: Bash
        configuration:
          inputSteps:
            - name: step_2
        execution:
          onExecute:
            - echo $app_version

      - name: step_5
        type: Bash
        configuration:
          inputSteps:
            - name: step_3
            - name: step_4  
          integrations:
            - name: my_github            # <- Change to your integration name
        execution:
          onExecute:
            - 'curl -H "Authorization: token ${int_my_github_token}" ${int_my_github_url}/rate_limit'   # <- Change to your integration name
  • No labels
Copyright © 2020 JFrog Ltd.