×
Find plugins

Config File Provider2.16.4Minimum Jenkins requirement: 1.642.3ID: config-file-provider

Adds the ability to provide configuration files (i.e., settings.xml for maven, XML, groovy, custom files, etc.) loaded through the Jenkins UI which will be copied to the job's workspace.

How it works

It will allow you to copy various similar configuration files to all your nodes. It also adds the ability to edit those files through the Jenkins UI.

File Types

In general, you can manage whatever file format you like with this plugin (except binary), but the UI provides some advanced editing support for the following file types:

  • Maven settings.xml (user and global)
  • plain XML
  • Groovy
  • JSON
  • Custom (plain text)

Load your configuration file content.

Choose the Configuration in the administration home:

Edit an existing file or add a new file:

Choose the configuration type:

Edit the content:

Configure the Maven plugin to use it:

Provide any config file to a project

Maven Server Credentials (since 2.7)

The file types 'Global Maven settings.xml' and 'Maven settings.xml' have built-in support for the Credentials Plugin. When the plugin serves the settings.xml to the maven execution, the credentials get injected. This functionality is only available in the maven builder (e.g. for freestyle projects) and maven project type.
After installation of the Config File Provider Plugin, a new Credentials Specification is available and can be used to mark credentials domain to contain credentials valid for maven server ids. The "Maven serverId" Specification allows you to define serverId patterns - this will make it easier to select the correct credential when configuring the settings.xml.

The current implementation supports "Username with password"-credentials. If your passwords are encrypted by maven, you can store the encrypted passwords in the same configuration - but you have to make sure the settings-security.xml is available to the job, unfortunately maven does not yet provide a way to pass this file aswell, so this file has to be located at the original location required by maven (<user.home>/.m2)

When configuring the settings.xml (user or global), you can add as many credential mappings as you wish, as soon as you add at least one serverId-credentials mapping to a config file all server configs in the same file will be removed and replaced by the ones you have explicitly added - this way you are sure which credentials finally end up in the file used by the jobs.

This example will add two server configurations to your settings.xml, one called 'artifactory.prod' (using 'release_user' with password) and the other 'artifactory.dev' (using 'snapshot_user' with password).

Now provided settings.xml with credentials can be used in the project and builder configuration. A common practice would be to define a global settings.xml to provide credentials and repository definitions and have local (default) settings.xml define the location of the local repo.

Using the configuration files in Jenkins Pipelines

The configuration files can be used in Jenkins pipeline.

The configuration file can either be stored in a desired file path or can be stored in a temporary file identified by the given "variable".

Sample for a Maven build:

node {

    git url: 'https://github.com/spring-projects/spring-petclinic.git'

    // install Maven and add it to the path
    env.PATH = "${tool 'M3'}/bin:${env.PATH}"

    configFileProvider(
        [configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
        sh 'mvn -s $MAVEN_SETTINGS clean package'
    }

}

The "Pipeline Syntax" page helps to write the proper syntax. (before version 2.13, the build wrapper syntax "wrap([$class: 'ConfigFileBuildWrapper'...]{...}" hat to be used)

Plugins adding support for new file types

  • Page:
    Managed Script Plugin — Managed scripts are shell scripts which are managed centrally by an administrator and can be referenced as a build step within jobs.

Extension Point

This plugin makes use of the org.jenkinsci.lib.configprovider.ConfigProvider ExtensionPoint. If you need to have easy administration of a new file type, just implement this ExtensionPoint and you're ready to go.

The easiest way to do so is to extend 'org.jenkinsci.lib.configprovider.AbstractConfigProviderImpl' - have a look at 'org.jenkinsci.plugins.managedscripts.ScriptConfig.ScriptConfigProvider'

Help and Support

For Help and support please use the Jenkins Users mailing list.
The comment list below is not monitored.

Known issues

T Key Summary
Loading...
Refresh

History

Version 2.16.4 (22. Sept. 2017)
Version 2.16.3 (14. August 2017)
  • JENKINS-45399 View selected scripts doesn't show correct script
Version 2.16.2 (7. August 2017)
  • SECURITY-513 protect access to config files, only allow users with granted permissions to view config files
Version 2.16.1 (26. July 2017)
  • JENKINS-44740 Wrong permission type for Config File Provider credentials
Version 2.16.0 (22. May 2017)
  • JENKINS-42877 Improve Config File Management screen inside a folder
  • JENKINS-43787 GlobalMavenSettingsConfig#getServerCredentialMappings() may return null when MavenSettingsConfig#getServerCredentialMappings() doesn't
  • JENKINS-43372 IllegalArgumentException: providerId can NOT be null when using configFiles
  • JENKINS-42262 Provide a method where extension could implement own logic for the content of custom Config
Version 2.15.7 (17. March 2017)
  • JENKINS-42389 Modifying Folder configuration removes all config files
Version 2.15.6 (13. Feb. 2017)
  • JENKINS-41871 provide a way to create config files via script -> provider.newConfig(id, name, comment, content)
  • fix JENKINS-41767 default implementation for config.getDescriptor()
Version 2.15.5 (19. Jan. 2017)
  • fix JENKINS-41161 Config files not being updated
  • fix JENKINS-40973 clearer error message if Id is not given to configFileProvider pipeline step
  • integrate JENKINS-12114 users having permission to configure folder, are now allowed to edit config files on the same folder
  • Delete per-provider configuration files that are not needed any longer (PR#32)
Version 2.15.4 (13. Jan. 2017)
  • fix JENKINS-40901 Update plugin versions to avoid PCT issues.
  • fix JENKINS-40981 IllegalStateException when installing plugin
  • fix JENKINS-40943 Config files are not updated via Job DSL plugin
  • Partialy restore binary compatibility with 2.13 and older releases (PR#29)
Version 2.15.3 (06. Jan. 2016)
Version 2.15.1 (27. Dec. 2016) DO NOT INSTALL!!
  • fix JENKINS-39991 Credential replacement in settings.xml losts configuration, filePermissions and directoryPermissions elements
Version 2.15 (27. Dec. 2016) DO NOT INSTALL!!

This version has a lot a lot of the internal changes to support CloudBees Folders Plugin - to make this work, the configuration is now saved different then it used to and a rollback of this release is not supported. If you'r unsure, please save your configuration before updating.

Because of this change, also a couple of other plugins had to be updated (some might not have released there latest changes):

- Managed Script Plugin -> version 1.3
Job DSL Plugin -> version 1.56
Pipeline Maven Plugin PR#10
Openstack Cloud Plugin PR#121

Version 2.13 (9. Sep. 2016)
  • add proper pipeline DSL support
  • fix error after trying to view json file JENKINS-36442 
Version 2.11 (24. June 2016)
  • Allow to manage SSH keys in settings.xml - JENKINS-33165, PR#15 (thanks to Cyrille Le Clerc)
  • migrate to credentials plugin 2.1+ - JENKINS-35527
  • support variable substitution in file content with TokenMacro for buildwrapper and build step - JENKINS-32908
  • clarify use of "Replace All" for Maven settings.xml -  JENKINS-30458
Version 2.10.1 (29. March 2015)
Version 2.10.0 (7. Dec 2015)
  • integrate PR #12 Support user defined config file ID to ease usage of config file provider in workflow (thanks to Cyrille Le Clerc)
Version 2.9.3 (20. Aug 2015)
Version 2.9.2 (4. Aug 2015)
Version 2.8.1 (11. May 2015)
  • add option to preserve 'server's in managed maven settings.xml
Version 2.7.5 (8. Aug 2014)
Version 2.7.4 (30.March 2014)
  • fix JENKINS-21494 Credentials are not injected in the settings via the environment variable PR #6
  • Improved target path parsing for Config File PR #5
  • some spelling fixes PR #7
Version 2.7.1 (4.Nov. 2013)
Version 2.7 (3. Nov. 2013)
Version 2.6.2 (17. Sep. 2013)
Version 2.6.1 (1. Aug. 2013)
  • disabling support for credentials in settings.xml - sorry, there are some concept changes to be done to keep it in sync with the credentials plugin
Version 2.6 (23. July 2013)
Version 2.5.1 (2. June 2013)
  • fix JENKINS-17555 Environment variables not set for maven projects types
Version 2.5 (15. March 2013)
  • fix JENKINS-17031 add support for JSON files by adding a new provider/file type
  • fix JENKINS-16694 Config-file-provider does not submit modified file
Version 2.4 (12. Dez 2012)
  • implement JENKINS-15962 Provide BuildStep that publishes selected config file.
  • implement JENKINS-14823  allow environment variables in Target definition
  • fix JENKINS-15976 Provided maven settings.xml in maven builder is lost
Version 2.3 (19. Nov 2012)
  • depends on core 1.491
  • Implement new EP of core to provide maven settings and global settings for maven project type and maven build step
  • remove dependency to maven-plugin
  • fix JENKINS-14914 Errors in hudson-dev:run relating to config-file-provider
  • implement JENKINS-15197 Add support for Maven toolchains configuration file (pull #3)
Version 2.2.1 (27. April 2012)
  • Fixed JENKINS-13533 Maven build fails on CleanTempFilesAction#tempFiles serialization
Version 2.1 (16. April 2012)
  • Fixed JENKINS-12823 Clean up temporary config files at the very end, not before post-build
Version 2.0 (3. April 2012)
  • lift dependency to core 1.458
  • change dependency direction between maven-plugin and config-file-provider-plugin (maven-plugin -> (optional) config-file-provider-plugin)
  • upgrade to version 1.2 config-provider-model
Version 1.2 (8. Nov. 2011)
  • upgrade to version 1.1 config-provider-model
  • upgrade to dependency to core 1.438 (required to better decouple dependencies)
  • enhance API to better support config-file-provider extensionpoint
Version 1.1 (29th August 2011)
  • fix JENKINS-10770 - make sure config files are available for m2-extra-steps
  • add new file types: groovy, xml
  • allow definition of a variable name to access the config file location
Version 1.0 (16th August 2011)
ArchivesGet past versions
Labels
Previous Security Warnings