Skip to content

Jenkins plugin, pipeline step, that allows you to perform given pipeline step(s) on a maven job and all its linked jobs.

Notifications You must be signed in to change notification settings

jenkinsci/pipeline-dependency-walker-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dependency Walker Plugin

Licensed under [MIT Licence].

About

Allows you to perform given pipeline step(s) on a job and all its linked jobs.

Linked jobs are the upstreams of the job, derived from maven dependencies. Dependency graph can be visualized using Dependency Graph View Plugin.

Usage scenarios

Clean build

The plugin can be used to preform a clean build in the isolated environment for the group of dependent projects.

Example of pipeline configuration:

node {
    stage('build') {
        echo "cleanup workspace"
        deleteDir()

        mvnRepo=pwd() + "/m2" // set local maven repo
        echo "use maven repo $mvnRepo"

        walk job: 'parent-project', jobAction: '''
            dir(JOB_NAME) {
                git url: JOB_SCM_URL, branch: JOB_SCM_BRANCH, credentialsId: JOB_SCM_CREDINTIALS_ID
                withMaven(maven: 'mvn', mavenLocalRepo: mvnRepo) {
                    sh "mvn clean install"
                }
            }
        '''
    }
}

Multiple release

Another use case is a multiple release. When the release action (see Release Plugin or M2 Release Plugin) is defined in a way that it drops SNAPSHOT keyword from dependencies, than using this plugin one can trigger a consistent release of multiple modules. In this scenario release should first update dependencies, for example invoking following maven target: versions:use-releases scm:checkin -Dmessage="drop snapshot versions"

In some way the plugin is an alternative to Maven Cascade Release Plugin.

Example of pipeline configuration:

node {
    stage('build') {
        walk job: 'parent-project', failOnUnstable: true, jobAction: 'release JOB_NAME'
    }
}

How to develop

First run a development instance of jenkins by executing a command mvn hpi:run

Go to jenkins development instance and configure as following:

  1. In system configuration click on Maven installations... button and configure:
  • Set Name to mvn
  • deselectInstall automatically
  • set MAVEN_HOME to your local maven installation (e.g. /usr/share/maven)
  1. In plugin manager install following plugins with restart:

About

Jenkins plugin, pipeline step, that allows you to perform given pipeline step(s) on a maven job and all its linked jobs.

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published