Skip to content

samikshasomnathe/jenkinsxml2jobdsl

 
 

Repository files navigation

Jenkins XML to Job DSL converter

Converts a Jenkins job's config.xml to Job DSL

Table of Contents

What is it?

This is a tool for converting a Jenkins job's config.xml to a Job DSL script

Prerequisites

The only thing you should need to get up and running with this is a valid JDK installation

Building

You can build the jar as follows:

git clone https://github.com/fergalgribben/jenkinsxml2jobdsl
cd jenkinsxml2jobdsl
./gradlew build

Running

Run the jar with the following command:

java -jar build/libs/jenkinsxml2jobdsl.jar -u <jenkins username> -a <jenkins api token> -j <jenkins server> -p <jenkins port> job1 job2 ... jobN

The converter will write the converted Job DSL scripts to the jobs/ directory

Configuration

The following command line flags are supported:

flag description
-u The username to use when connecting to the Jenkins instance
-a The API token to use when connecting to the Jenkins instance, accessible via <jenkins url>/user/<username>/configure
-j The URL of the Jenkins instance to connect to, e.g. myjenkins.myhost.com
-p The port on which the Jenkins instance is listening, defaults to 8080

The converter accepts a list of space-delimited job names as they are displayed under the "Project name" field of the job configuration page in Jenkins

Publishing

On the Jenkins instance you want to deploy the Job DSL scripts against, you need to have the Job DSL plugin installed, and a seed job created

With a seed job created, configure the job, and navigate to the build actions section of the configuration. Add the "Process Job DSLs" build step, and either paste in a generated Job DSL script, or use the file browser to point to a file on disk

Save the configuration, and then run the seed job. The Job DSL plugin will create a new Jenkins job, which will appear on the Jenkins home page.

About

Converts a job's config.xml to JobDSL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.4%
  • Groovy 0.6%