Skip to content

Adds a Jenkins Trigger option to XLR and other options to integrate with Jenkins

License

Notifications You must be signed in to change notification settings

xebialabs-community/xlr-jenkins2-plugin

Repository files navigation

xlr-jenkins2-plugin

This plugin offers an interface from XL Release to Jenkins 2.x.

Build Status Codacy Badge Code Climate License: MIT Github All Releases

Preface

This document describes the functionality provided by the XL Release xlr-jenkins2-trigger-api.

See the XL Release reference manual for background information on XL Release and release automation concepts.

This is a 'See It Work' plugin project, meaning the code base includes functionality that makes it easy to spin up and configure a dockerized version of the XebiaLabs platform with this plugin already installed. Using the provided test data, you can then try out the plugin features. This is useful for familiarizing yourself with the plugin functionality, for demonstrations, for testing and for further plugin development. Currently the Demo Data is configured to demonstrate the tasks Get Parameters and Get Environment Variables only.

See the Demo/Dev section.

Usage

Triggers

You can configure a job trigger by first going to your template and selecting Triggers. You can use 2 trigger types:

  • JobTrigger: Polls for a Jenkins Job to finish
  • FolderTrigger: Polls for any Jenkins job(s) to finish underneath a Jenkins folder

Jenkins Trigger

When selected, you can provide the Jenkins details. Jenkins Trigger Details

Tiles

  • Jenkins Job Summary Tile: This tile can be used to pull a summary of all runs of a jenkins job

Configure Tile

Configure tile

Preview Tile

Configure tile

  • Jenkins Pipeline View Tile: This tile breaks down the build time for recent jobs, down to the level of build stages. Users can quickly identify skipped stages, outlier build times, and build performance degradation.

The Pipeline Stage View Jenkins Plugin must be installed in Jenkins, before using this dashboard tile.

Tasks

Jenkins.GetBuildParameters tasks allows to fetch the parameters from an executed job.

Jenkins GetBuildParameters

Jenkins.GetEnvironmentVariables task fetchs the environment variables from an executed job.

NOTE: You must have the Jenkins plugin ‘Environment Injector’ id=envinject installed prior to executing the Jenkins job

JenkinsPluginInstall

Jenkins GetEnvironmentVariables

Development/Demo

Build and package the plugin with...

./gradlew clean build

To run demo or dev testbed -

The following will set up a xlr/jenkins testbed using docker.

  1. Clone this github project to your local dev environment
  2. You will need to have Docker and Docker Compose installed.
  3. You will need to be able to run bash scripts
  4. The XL-Release docker image uses the community trial license
  5. Build the xlr-jenkins2-plugin.jar - Open a terminal and cd into and run ./gradlew clean build . Be sure to re-run the command whenever code is changed.
  6. From another terminal, cd into the /src/test/resources/docker/ directory.
  7. Then run: docker-compose up
  8. XL Release will run on the localhost port 15516. It may take up to a minute for XL Release to start up
  9. The XL Release username / password is admin / admin
  10. Jenkins will run on the localhost port 9080.
  11. The Jenkins username / password is admin / admin
  12. After XL Release has started, you can set up a template, a shared configuration server in XLR and a test job and build in Jenkins by running the script /src/test/resources/docker/initialize/initialize_data.sh.
  13. You can then run a release within XLR using the template named 'jenkingTest'.
  14. When code is modified, re-run the ./gradlew clean build (in the first terminal), then refresh the testbed by running docker-compose down (in a third terminal) followed by docker-compose up (in the second terminal). After XL Release starts up, re-run /src/test/resources/docker/initialize/initialize_data.sh.

Further Demo/Dev Notes:

  1. The log file for the plugin - plugin.log will be persisted to the local directory /build/reports/tests/log directory.

Contributing

Please review the contributing guidelines for xebialabs-community at http://xebialabs-community.github.io/

License

This community plugin is licensed under the MIT license.

See license in License.md