JFrog Platform - Distribution automation using Pipelines
Tags: devops, continuousdelivery, pipelines, distribution
Published: 2020-06-02 09:30:49

Several organizations that are looking forward to adopting complete DevOps, need a one-stop solution for their CI/CD processes. With the newest addition of JFrog Pipelines, the JFrog platform provides end-to-end automation of your DevOps workflow. 

As Continuous integrations with JFrog Pipelines is a major amendment for many organizations - modifying the build processes can be a slow and gradual process. However, the Continuous delivery process can be automated easily with the one-stop solution of the [JFrog Platform](https://www.jfrog.com/confluence/display/JFROG/JFrog+Pipelines) using Distribution and Pipelines. 

In this blog, we will be focusing on the step-by-step configuration of the JFrog Pipeline to automate the Distribution flow to various Edge nodes.

Pre-requisites:
* [JFrog Distribution](https://www.jfrog.com/confluence/display/JFROG/JFrog+Distribution) - Installed and configured with the [required assets](https://www.jfrog.com/confluence/display/JFROG/Configuring+Distribution+Assets)
* JFrog Pipelines - Installed and [Pipeline source](https://www.jfrog.com/confluence/display/JFROG/Pipelines+Step-By-Step#PipelinesStep-By-Step-add-pipeline-sourceAddaPipelineSource), [Node pools](https://www.jfrog.com/confluence/display/JFROG/Pipelines+Step-By-Step#PipelinesStep-By-Step-CreateaNodePool) defined
* JFrog Pipelines - [Artifactory Integration](https://www.jfrog.com/confluence/display/JFROG/Artifactory+Integration) and [Distribution Integration](https://www.jfrog.com/confluence/display/JFROG/Distribution+Integration) defined

***

**Step1:**
[Creating a release bundle](https://www.jfrog.com/confluence/display/JFROG/CreateReleaseBundle) in Distribution using Pipeline native steps and resources

For Example:
```steps:    
      - name: Create_ReleaseBundle
        type: CreateReleaseBundle
        configuration:
          releaseBundleName:        Demo_RB
          releaseBundleVersion:     V1.2.${run_number}
          inputResources:
            - name:                final_docker_gradleBuild_Info
            - name:                final_docker_npmBuild_Info 
          outputResources:
            - name:                New_ReleaseBundle
          description:              Release Bundle of gradle and npm 
          releaseNotes:
            syntax:                 markdown
            content: |
              ## Heading
                * Bullet
                * Points
```

(Please note; the *inputResources* here are defined as [build info resources](https://www.jfrog.com/confluence/display/JFROG/BuildInfo) in this Pipeline)

Once the bundle is created, we can view it in JFrog Distribution as below;
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jlj5v40marqf3rag06ba.png)

***

**Step2:**
[Sign the release bundle](https://www.jfrog.com/confluence/display/JFROG/SignReleaseBundle) (Can be done with the above step by adding the *sign* parameter as *‘true’*)

For example:
```
   - name: Sign_ReleaseBundle
     type: SignReleaseBundle
     configuration:
     inputResources:
       - name:    New_ReleaseBundle
         trigger: true
     outputResources:
       - name:  Signed_ReleaseBundle
```

***

**Step3:**
Creating the [Distribution rule resource](https://www.jfrog.com/confluence/display/JFROG/DistributionRule) to define the [Edge nodes](https://www.jfrog.com/confluence/display/JFROG/JFrog+Artifactory+Edge) where we want to distribute our releases

For example:
```
   - name:           Distribution_Rule
     type:           DistributionRule
     configuration:
       sourceDistribution:   distribution
       serviceName:          edge-jpd
       siteName:             "edge-jpd"
       cityName:             "*"
       countryCodes:
         - "*"
```

***

**Step4:**
[Distributing the release bundle](https://www.jfrog.com/confluence/display/JFROG/DistributeReleaseBundle) by using the input resources - Release bundle + Distribution rule created in the above steps

For example:
```
   - name: Distribute_ReleaseBundle
     type: DistributeReleaseBundle
     configuration:
       dryRun: false
       inputResources:
         - name: Signed_ReleaseBundle
           trigger: true
         - name: Distribution_Rule
```

After the Distribution is complete - we can view the release bundle completion in JFrog UI of both Source and Destination Edge nodes as below:

In Source - Distribution tracking
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/y3y23fnh2j4epehgyff4.png)


In Edge node - Available packages that were Distributed
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/d78rk4ayvphs3hj28k4c.png)

***

Thus, in some simple steps - we can automate the whole process of distribution using JFrog Pipelines. 

In other words, our continuous delivery processes can be streamlined along with our Continuous integration processes and we are able to have an end-to-end CI/CD implementation.

Wishing you fast and healthy software deliveries! 
*The JFrog Platform*