Operations 1 min read

Using the File Operations Plugin in Jenkins Pipelines

This article demonstrates how to install the Jenkins File Operations plugin, generate its DSL configuration, run a pipeline that creates a file, lists directory contents, and includes a sample pipeline script with logs and screenshots illustrating each step.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Using the File Operations Plugin in Jenkins Pipelines

The author asks if anyone uses the File Operations plugin, noting its convenience compared to shell commands.

Installation of the plugin is shown via screenshots.

Next, the DSL (Domain Specific Language) for the plugin is generated, illustrated with an image.

The pipeline is then executed, as shown in another screenshot.

The pipeline script used is:

pipeline {
   agent any

   stages {
      stage('Hello') {
         steps {
             script {
                 fileOperations([fileCreateOperation(fileContent: 'devops', fileName: 'test.json')])
                 sh " ls -l "
                 sleep 20
             }
         }
      }
   }
}

Finally, the build logs are displayed in a screenshot.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ci/cdDevOpsJenkinsFile Operations
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.