Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jenkinsci/workflow-remote-loader-plugin
Load Pipeline scripts from remote locations (e.g. Git) - replaced by Pipeline: Groovy Libraries plugin
https://github.com/jenkinsci/workflow-remote-loader-plugin
adopt-this-plugin deprecated
Last synced: 19 days ago
JSON representation
Load Pipeline scripts from remote locations (e.g. Git) - replaced by Pipeline: Groovy Libraries plugin
- Host: GitHub
- URL: https://github.com/jenkinsci/workflow-remote-loader-plugin
- Owner: jenkinsci
- License: mit
- Created: 2015-09-28T19:17:44.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-01T21:46:14.000Z (5 months ago)
- Last Synced: 2024-08-25T00:45:05.329Z (4 months ago)
- Topics: adopt-this-plugin, deprecated
- Language: Java
- Homepage: https://plugins.jenkins.io/workflow-remote-loader/
- Size: 122 KB
- Stars: 91
- Watchers: 106
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Pipeline Remote File Loader Plugin
## Summary
**The [Pipeline: Groovy Libraries](https://plugins.jenkins.io/pipeline-groovy-lib/) plugin replaces this plugin**.
The [Pipeline shared libraries section of the Jenkins User Handbook](https://jenkins.io/doc/book/pipeline/shared-libraries/) describes the [Pipeline: Groovy Libraries](https://plugins.jenkins.io/pipeline-groovy-lib/) plugin in detail.The plugin simplifies the usage of the shared functionality in [Pipeline](https://www.jenkins.io/doc/book/pipeline/) scripts.
It allows Pipeline scripts to be stored in remote SCM iles and loads them on-demand.Supported features:
* Groovy file loading from Git and Github (requires an installed Git plugin)## Usage
The plugin adds a global `fileLoader` DSL variable, which provides methods for loading Pipeline objects from remote sources.
### Available methods
The `fileLoader` variable provides the following methods:
* `fromGit(String libPath, String repository, String branch, String credentialsId, String labelExpression, boolean skipNodeCreation)` - loading of a single Groovy file from the specified Git repository
* `withGit(String repository, String branch, String credentialsId, String labelExpression, boolean skipNodeCreation)` - wrapper closure for multiple files loading from a same Git repo
* `fromSVN(String libPath, String repository, String credentialsId, String labelExpression, boolean skipNodeCreation)` - loading of a single Groovy file from the specified SVN repository
* `withSVN(String repository, String credentialsId, String labelExpression, boolean skipNodeCreation)` - wrapper closure for multiple files loading from a same SVN repo* `load(String libPath)` - loading of an object from a Groovy file specified by the relative path. Also can be used within `withGit()` closure to load multiple objects at once
Parameters:
* `libPath` - a relative path to the file, ".groovy" extension will be added automatically
* `repository`
* for Git - string representation of a path to Git repository. Supports all formats supported by [Git Plugin](https://plugins.jenkins.io/git/)
* for SVN - string representation of a path to/or inside an SVN repository.
* `branch` - Optional: Branch to be used (it's also possible to specify labels). Default value: `master`
* `credentialsId` - Optional: Credentials to be used for the Git repo checkout. Default value: `null` (unauthorized access)
* `labelExpression` - Optional: label expression, which specifies a node to be used for checkout. Default value: empty string (runs on any node)
* `skipNodeCreation` - Optional: If true the creation of a new node is skipped. Default value: false (creates a new node)### Groovy file format
The loading behaves similarly to the built-in `load` command, see [Pipeline documentation](https://www.jenkins.io/doc/pipeline/steps/workflow-cps/#load-evaluate-a-groovy-source-file-into-the-pipeline-script) for more info about library file syntax. Only one file is being loaded by commands from `fileLoader`. Use static initializers within the Groovy file of the loaded file to load more context from neighbor files.
### Examples
Loading a single Groovy file from Git:
```groovy
stage 'Load a file from GitHub'
def helloworld = fileLoader.fromGit('examples/fileLoader/helloworld',
'https://github.com/jenkinsci/workflow-remote-loader-plugin.git', 'master', null, '')stage 'Run method from the loaded file'
helloworld.printHello()
```Loading multiple files from Git:
```groovy
stage 'Load files from GitHub'
def environment, helloworld
fileLoader.withGit('https://github.com/jenkinsci/workflow-remote-loader-plugin.git', 'master', null, '') {
helloworld = fileLoader.load('examples/fileLoader/helloworld');
environment = fileLoader.load('examples/fileLoader/environment');
}stage 'Run methods from the loaded content'
helloworld.printHello()
environment.dumpEnvVars()
```## License
[MIT License](http://opensource.org/licenses/MIT)## Changelog
[GitHub releases](https://github.com/jenkinsci/workflow-remote-loader-plugin/releases)