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





Overview

This pipeline demonstrates the definition of a simple pipeline that creates and signs a release bundle, and distributes it to an Artifactory edge node. An example Pipelines DSL is used to show how to use integrations, resources, and steps to construct a simple, automated workflow. The pipeline is triggered by any change in any of the BuildInfo resources used to create the release bundle.

This pipeline demonstrates the following:

This pipeline starts from where the Pipeline Example: Docker Build and Push left off. While that pipeline built and pushed a Docker build, this pipeline takes the Buildinfo from that example and creates the release bundle and distributes it to an edge node.

A successful run of the pipeline in this quickstart looks like this:

Page Contents


Before you Begin

Before trying this quickstart, ensure that you have:


Running This Example

Perform the steps below to run this pipeline:

  1. Sign in
    Sign in to JFrog Platform with your Artifactory credentials.

  2. Add integrations

    1. Go to Application | Pipelines | Integrations to add these integrations:

      • GitHub Integration: This integration is used to add the Pipeline source.
        myGithub is the name of the GitHub integration used in this example.
      • Distribution IntegrationThis integration connects your JFrog Pipeline Automation platform to a Distribution instance.
        myDist is the name of the Distribution integration used in this example.
      • Artifactory Integration: This integration is used to authenticate with Artifactory to to get artifacts including Docker images, and maintain build information.
        myArtifactory is the name of Artifactory integration used in this example.
    2. Write down the names of the Artifactory and Distribution integrations as these are required for the next step. Ensure that the names are unique and easy to remember.

  3. Fork GitHub repository

    The Pipelines DSL for this example is available in the jfrog-pipelines-cd-sample repository in the JFrog GitHub account.

    The DSL file is a yaml file that contains the pipeline definitions. The example uses two YAML files, pipelines.yml and values.yml. The pipelines.yml file contains the declarations for all resources and workflow steps. The values.yml file contains the values required for the pipelines.yml file. For a full breakup of all the resources, pipelines and steps used in the yml file, see the pipelines.yml section below.

    Fork this repository to your account or organization. This is important since you need admin access to repositories that are used as Pipeline Sources or GitRepo resources, which is required to add webhooks to these repositories and listen for change events.

  4. Update values.yml

    The pipelines configuration is available in the values.yml file. If required, edit this file in your fork of this repo and replace the following:

    TagDescriptionExample
    gitProviderProvide the name of the Github integration you added in the previous step. gitProvider: myGithub
    sourceArtifactory Provide your Artifactory integration. sourceArtifactory: myArtifactory
    sourceDistributionProvide your Distribution integration.sourceDistribution: myDist

    All pipeline names are global across your JFrog Pipelines. The names of your pipelines and resources need to be unique within JFrog Pipelines.

  5. Add Pipeline Source

    The Pipeline Source represents the Git repo where our Pipelines definition files are stored. A pipeline source connects to the repository through an integration, which was added in the previous step.

    1. Add a Pipeline Source. Enter .yml in the Pipeline Config File Filter field. This automatically adds your configuration to the platform and a pipeline is created based on your YAML.

    2. After your Pipeline Source syncs successfully, navigate to Pipelines | My Pipelines in the left navbar to see the newly added pipeline. In this example, cd_demo_release_mgmt is the name of our pipeline.

    3. Click the name of the pipeline. This renders a real-time, interactive diagram of the pipeline and the results of its most current run.



  6. Execute the pipeline

    You can now commit to the repo to trigger your pipeline, or trigger it manually through the UI. The steps in the pipeline execute in sequence. Multiple steps can execute in parallel if the node pool has multiple build nodes available.



pipelines.yml

The pipelines.yml file is made up of resources, pipelines and steps, as shown below:

Resources

This example uses the following types of resources:

BuildInfo

A BuildInfo resource is the metadata associated with a build in Artifactory.

JFrog Pipelines automatically creates BuildInfo when any of the Build steps like MvnBuild, NpmBuild, GradleBuild, or DockerBuild are used to generate packages. BuildInfo is published to Artifactory through the PublishBuildInfo step, by setting a flag in Build steps or by providing that resource in steps like NpmPublish, GoPublishModule, GoPublishBinary, and DockerPush.

resources
  # Build info of build to bundle
  - name: gosvc_promoted_build_info
    type: BuildInfo
    configuration:
      sourceArtifactory: {{ .Values.artifactoryIntegration }}
      buildName: dbp_build
      buildNumber: 1  

Tag

Description

Required/Optional

name

gosvc_promoted_build_info is the name of the BuildInfo resource, which is the metadata associated with the build in Artifactory.

This name is used to refer to the resource in steps, and must be unique across all repositories in your JFrog Pipelines environment. 

Required

sourceArtifactory

myArtifactory is the name of the Artifactory Integration.

Required
buildName

dbp_build is the name of the build to associate with the BuildInfo.

dbp_build is the name of the Docker build and push pipeline.

Optional
buildNumberThe number of the build to associate with the BuildInfo.Optional



ReleaseBundle

A ReleaseBundle resource specifies a set of artifacts in Artifactory that are distributed to Artifactory Edge nodes as a JFrog Distribution Release Bundle.

This resource can be used with CreateReleaseBundle or DistributeReleaseBundle. This resource can be used to represent both signed and unsigned Release Bundle

resources
  - name: release_bundle
    type: ReleaseBundle
    configuration:
      sourceDistribution:  {{ .Values.distributionIntegration }}
      name: demo_rb
      version: v1.0.0

  - name: signed_bundle
    type: ReleaseBundle
    configuration:
      sourceDistribution:  {{ .Values.distributionIntegration }}
      name: demo_rb
      version: v1.0.0

Tag

Description

Required/Optional

namerelease_bundle and signed_bundle are ReleaseBundle resources. While release_bundle is the release bundle, signed_bundle is the signed version of the release bundle.Required
sourceDistribution

myDist is the name of the Distribution Integration.

Required
version 

Version number of the release bundle.

Required


DistributionRule

DistributionRule resource is the set of Destination rules that can be applied to distributing a release bundle using JFrog Distribution. 

resources
  - name: distribution_rules
    type: DistributionRule
    configuration:
      sourceDistribution:  {{ .Values.distributionIntegration }}
      serviceName: "*"
      siteName: "*"
      cityName: "*"
      countryCodes:
        - "*"  

Tag

Description

Required/Optional

namedistribution_rules is the name of the DistributionRule resource.Required
sourceDistributionmyDist is the name of the Distribution Integration.Required
serviceName The Artifactory Edge Node service name with a wildcard pattern.Required
siteNameThe Artifactory Edge Node site name with a wildcard pattern.Required
cityNameThe Artifactory Edge Node city name with a wildcard pattern.Required
countryCodes The Artifactory Edge Node country codes with a wildcard pattern.Required

Pipelines

cd_demo_release_mgmt, the pipeline definition for signing a release bundle and releasing it to an Artifactory edge node.

Steps

The cd_demo_release_mgmt pipeline is made up of the following native steps:

CreateReleaseBundle

The CreateReleaseBundle native step produces a Release Bundle for distribution to an Artifactory Edge Node . The step can be used to create a signed or unsigned release bundle. 

steps
      - name: bundle
        type: CreateReleaseBundle
        configuration:
          releaseBundleName: demo_rb
          releaseBundleVersion: v1.0.${run_number}
          dryRun: false
          sign: false
          description: "some random test description"
          inputResources:
            - name: gosvc_promoted_build_info
              trigger: false
          outputResources:
            - name: release_bundle
          releaseNotes:
            syntax: markdown
            content: |
              ## Heading
                * Bullet
                * Points

Tag

Description of usage

Required/Optional

namebundle is the name that identifies the CreateReleaseBundle step.Required
inputResources 

Must specify either a named BuildInfo resource(s) or an Aql resource.

If BuildInfo inputresources are provided, the query for the release bundle is constructed using the buildNamebuildNumber, and targetRepo of each BuildInfo input.

Required
outputResources 

Must specify a ReleaseBundle resource.

The nameversion, and isSigned settings in the output ReleaseBundle are updated to the step's releaseBundleNamereleaseBundleVersion, and sign values respectively (or any environment variable values that replaced environment variable placeholders for those values).

Required
releaseBundleNameAn alphanumeric name for the release bundle. demo_rb is the name used in this example.Required
releaseBundleVersionVersion string for the release bundleRequired
dryRun

When set to true parse and validate only to test whether a release bundle version can be created.

Default is true.

Optional
sign

Specifies whether the release bundle version is signed.

Default is false.

Optional
storeAtSourceArtifactoryControls whether to store release bundle version in the source Artifactory while signing.Optional
descriptionDescription of the release bundle.Optional
releaseNotes

Describes the release notes for the release bundle version.

syntax specifies the format of release notes: plain_textmarkdown, or asciidoc. Default is plain_text.

content is the release notes string in the specified syntax format. Use the | character to denote a string preserving newlines.

Optional

SignReleaseBundle

The SignReleaseBundle native step signs a Release Bundle in preparation for distributing it to Edge nodes. 

steps
      - name: sign
        type: SignReleaseBundle
        configuration:
          inputResources:
            - name: release_bundle
          outputResources:
            - name: signed_bundle

Tag

Description of usage

Required/Optional

namesign is the name that identifies the SignReleaseBundle step.Required
inputResources 

Must specify a ReleaseBundle resource whose name and version properties identify the release bundle to be signed.

This step accepts release_bundle, which is the ReleaseBundle resource, as the inputResource.

Required
outputResources 

Must specify a ReleaseBundle resource. This ReleaseBundle is updated with the name and version properties of the input ReleaseBundle (release_bundle), and sets the isSigned property to true.

This step specifies signed_bundle, which is the other ReleaseBundle resource, as the outputResource.

Required


DistributeReleaseBundle

The DistributeReleaseBundle native step triggers the distribution of a Release Bundles to an Artifactory Edge Node. This step requires a signed release bundle and one or more distribution rules to successfully execute

steps
      - name: distribute
        type: DistributeReleaseBundle
        configuration:
          dryRun: false
          inputResources:
            - name: signed_bundle
            - name: distribution_rules

Tag

Description of usage

Required/Optional

namedistribute is the name that identifies the DistributeReleaseBundle step.Required
inputResources Must specify a ReleaseBundle resource (signed_bundle) and one DistributionRule resource (distribution_rules) Required
dryRun

Controls whether this should be a dry run to test if the release bundle can distribute to the Edge nodes matching the distribution rule.

The default is true.

Optional
  • No labels
Copyright © 2022 JFrog Ltd.