• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jenkinsci/config-file-provider-plugin: Jenkins plugin to administrate the maven ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jenkinsci/config-file-provider-plugin

开源软件地址(OpenSource Url):

https://github.com/jenkinsci/config-file-provider-plugin

开源编程语言(OpenSource Language):

Java 97.9%

开源软件介绍(OpenSource Introduction):

Config File Provider plugin for Jenkins

config file provider config file provider plugin 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 "Managed files" in the administration home:

image

Edit an existing file or add a new file:

image

Choose the configuration type:

image

Edit the content:

image

Configure the Maven plugin to use it:

image

Provide any config file to a project

image

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

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 as well, 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).
image

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.

image

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.

image

Plugins adding support for new file types

  • 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

builds are currently executed on:




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
javaexpresschannel/jenkins-maven发布时间:2022-08-17
下一篇:
ning/maven-dependency-versions-check-plugin: Maven plugin to find dependency ver ...发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap