Operations 2 min read

Using Jenkins File Operations Plugin for File Management in Pipelines

This article introduces the Jenkins File Operations plugin, explains how to install it, generate the required DSL, and run a pipeline that creates, lists, and cleans up files, providing a complete code example and build log screenshots for reference.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Using Jenkins File Operations Plugin for File Management in Pipelines

The Jenkins File Operations plugin enables convenient file handling—upload, download, move, rename, and delete—directly within Jenkins pipelines. After installing the plugin from the official Jenkins site, you can generate the DSL needed to configure file operations.

To run a pipeline using the plugin, define a Jenkinsfile that includes an agent any and a stage where a script block calls fileOperations([fileCreateOperation(fileContent: 'devops', fileName: 'test.json')]) , followed by a shell command sh " ls -l " and a sleep 20 to observe the results.

Example pipeline code:

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

The build log shows the created file and the output of the ls -l command, confirming that the plugin works as expected. Additional screenshots illustrate the installation process, DSL generation, pipeline execution, and build log details.

ci/cdautomationdevopspipelineJenkinsfile 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

login 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.