Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Wiki Markup
{jenkins-plugin-info:pluginId=jenkinslint}
Excerpt

Detects whether your Jenkins configuration follows those best practices 

This plugin has mainly two goals:

  • To make it easier to detect issues in your Jenkins configuration that will cause Jenkins to blow up when you attempt to run those jobs.
  • To encourage discussion within the Jenkins community on the more subjective stuff. Having a set of checks to base discussion on helps drive out what we as a community think is good style.
   

Table of Contents
maxLevel1
excludePlugin Information
printablefalse

Summary

Jenkins is an awesome Automation System, and there are a bunch of people using it in different ways, for example: developers, testers, automation, build engineers, release engineers, scrum master, product owner and so on. Unfortunately, as the number of jobs grows, maintaining them becomes tedious, and the paradigm of no using a predefined set of best practices falls apart.

...

Usage

You can find it under <jenkins_url>/jenkinslint or reach it via links in the sidepanel of the main page. You don't need to do anything else, just click on the Jenkins Lint link and those Lint checkers will be shown.


Image RemovedImage Added Image Removed


Image Added

 

Image Added

Image Added

Features

List of available Job checks:

  • Artifact Publisher check
  • BFA check
  • Built Timeout check
  • CleanUp Workspace check
  • Git Ref repo check
  • Git Ref Submodule repo check
  • Git Shallow clone check
  • Gradle Wrapper check
  • Groovy system exit check
  • Hard-coded Script check
  • Javadoc Publisher check
  • Job Assigned Label check
  • Master Assigned Label check
  • Job Description check
  • Job Log Rotator check
  • Job Name check
  • Maven Job Type check
  • Multibranch Job Type check
  • Null SCM check
  • Polling SCM Trigger check
  • Multibranch Job Type check
  • Hard-coded Script check
  • Gradle Wrapper check
  • Built Timeout check
  • TimerTrigger Hash check

List of available Slave checks:

...

Planned upcoming features

  • Load checks dynamically via Reflection.
  • Show graphs.
  • Configure Checks (enabled, disabled, change severity)
  • Load checks dynamically via Jenkins.Jobs action
  • to show those jenkins lints.Load checks dynamically via Reflection. 
  • Define some kind of programmatically scripts.

...

  • Check: Cyclomatic complexity check
  • Support Declarative pipeline and shared Libraries

Controlling checks:

You can ignore a particular check  by check  in a specific job, by adding a trailing lint:ignore:<check name> comment to the job description.

You can ignore a check globally, by deselecting it in the system configuration: "Manage Jenkins" / "Configure System" in the "Advanced" section below "Jenkins Lint".

Disabling the healthy floating box in the Job Summary Page

You can disable the healthy floating box in the Job Summary Page, by unchecking "Enable JobAction" in the system configuration 

Features controlled by system properties

Based on the Features controlled by system properties, you can disable the healthy floating box in the Job Summary Page

Property

Default

Version

Notes

org.jenkins.ci.plugins.jenkinslint.JobLintAction.disabled

false

0.9.0

Deprecated since 0.10.0. Removed since 0.12.0.


By default you will see the below view:

Image Added

 

If you disabled then:

Image Added

Global settings

You can easily disable/enable Checkers and customise them from the Global Settings <jenkins_url>/configure section "Jenkins Lint"  

 

Image Added

Enable/Disable with Groovy script

You can also configure your lint checkers using the Script console, from version 0.10.0 onwards!

Code Block
import org.jenkins.ci.plugins.jenkinslint.JenkinsLintGlobalConfiguration
import jenkins.model.GlobalConfiguration

// Disable Globally
JenkinsLintGlobalConfiguration.all().get(JenkinsLintGlobalConfiguration.class).setGlobalEnabled(false)

// Disable JobAction
JenkinsLintGlobalConfiguration.all().get(JenkinsLintGlobalConfiguration.class).setJobActionEnabled(false)

// Disable Lint
JenkinsLintGlobalConfiguration.all().get(JenkinsLintGlobalConfiguration.class).setCleanupWorkspaceCheckerEnabled(false)
 
// More properties in the JenkinsLintGlobalConfiguration class: https://github.com/jenkinsci/jenkinslint-plugin/blob/a97f3e17b14d7410164bb4bea50ba5968a3a97b8/src/main/java/org/jenkins/ci/plugins/jenkinslint/JenkinsLintGlobalConfiguration.java#L18-L45

API

You can retrieve jenkins lint defects by requesting the following URLs :

  • <jenkins/hudson_url>/jenkinslint/api/json?depth=2&pretty=true
  • <jenkins/hudson_url>/jenkinslint/api/xml?depth=2


And also you can retrieve lint defects per job/agents:

  • <jenkins/hudson_url>/job/<your_job>/jenkinslint/api/json?depth=2&pretty=true
  • <jenkins/hudson_url>/job/<your_job>/jenkinslint/api/xml?depth=2
  • <jenkins/hudson_url>/computer/<agent>/jenkinslint//api/json?depth=2&pretty=true
  • <jenkins/hudson_url>/computer/<agent>/jenkinslint//api/xml?depth=2

Workaround

 

Warning

There is already a known issue in the initial version 0.1.0Workspace Cleanup Plugin is a required dependency otherwise JenkinsLint will fail when analyzing those Jobs

...

Requirements

Jenkins

Jenkins version:

  • 1.

...

  • 607 or newer if Jenkins pipelines are installed
  • 1.580 or newer is required if jenkins pipelines are not installed
Info

It might work with previous versions.

NOTE: Jenkins version is required when testing those checkers using the mvn test command. This plugin uses java reflection to get rid of those plugins/jenkins version dependencies although it's required in the test phase when developing it to verify/test those checkers.

Open Issues

Jira Issues
renderModedynamic
width850px
anonymoustrue
urlhttp://issues.jenkins-ci.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+JENKINS+AND+status+in+%28Open%2C+%22In+Progress%22%2C+Reopened%29+AND+component+%3D+jenkinslint-plugin+ORDER+BY+updated+DESC%2C+priority+DESC%2C+created+ASC
height300px

Version history

Planning 

(plus) Check: Cyclomatic complexity check (issue #42269)

Version 0.

...

14.0 (

...

  • (info)    Graphs.

...

August 29, 2017)

  • (plus)  Enable/Disable whether to analyse disabled jobs from Global Settings (issue #46395)

Version 0.13.0 (August 24, 2017)

  • (plus) Show graphs. (issue #46350)
  • (warning) Fixed NPE when using MultijobProjects (issue #46424
  • (warning) Fixed ClassCastException when using a misconfigured restrict where to run field (issue #46383)

Version 0.12.0 (August 15, 2017) 

  • (plus) Check: Detect ignored groovy sandbox in Projects. (issue #46177 )
  • (plus) Check: Detect ignored groovy sandbox in Pipelines. (issue #46162)
  • (plus) Customise HardcodedScript lint to enable/disable comments as lines. (issue #46146)
  • (plus) Fully support of Pipeline linting. (issue #46162)
  • (plus) Search box. (issue #42359)
  • (info) Bumped minimal Jenkins Core version to 1.607 (issue #46162)
  • (info) Remove: Deprecated System Property (Features controlled by system properties) . (issue #46164)
  • (info) Fixed Column Ordering based on Check Status and Job/Slave Name (issue #46033)
  • (warning) Fixed Linting with multi-configuration projects. (issue #46176)

Version 0.11.0 (August 10, 2017)

  • (plus) Check: Groovy system exit check in Input Parameters  (issue #45961)
  • (plus) Check: Groovy system exit check in Publishers  (issue #45960)
  • (plus) Check: Run Timeout Check in Build Steps (issue #45938)
  • (info) Fixed Hardcoded Script check with empty lines (issue #46035)
  • (info) Fixed Column Ordering based on Check Status and Job Name (issue #46033)

Version 0.10.1  (August 1, 2017)

  • (warning)  Fixed false positive with Timer Trigger Checker (issue #45879)

Version 0.10.0  (August 1, 2017)

  • (plus)  Check: Git Ref Submodule Check  (issue #41528)
  • (plus)  Enable/Disable Checks globally/individually from Global Settings (issue #45882)
  • (plus)  Hardcoded Script Threshold value is now part of the Global Settings (issue #45882)

Version 0.9.0 (July 27, 2017)

  • (plus) JobAction View (Controlled by System Property) (PR #17)
  • (plus) AgentAction View (PR #17)
  • (plus) RestAPI for the JobAction and AgentAction
  • (info) Jenkinsfile integration with ci.jenkins.io (PR #18)
  • (info) Fixed Jelly and XSS prevention
  • (info) Bumped minimal Jenkins Core version to 1.580

Version 0.8.0 (Mar 7, 2017)

Version 0.7.0 (Feb 26, 2017)

  • (warning)  Maven and Matrix projects weren't supported when linting some defects  (issue #42310)
  • (info)  i18 support

Version 0.6.0 (Feb 12, 2017)

Version 0.5.0 (Oct 1, 2015)

Version 0.4.0 (Aug 27, 2015)

  • (info)   Support  Support Jenkins lint check for Jenkins Slaves (issue #30161)

Version 0.3.0 (Jul 29, 2015)

  • (info)   Gradle (plus) Check: Gradle Wrapper check  (issue #29486)

Version 0.2.0 (Jul 21, 2015)

Version 0.1.2 (Jul 15, 2015)

  • (error)  Some   Some builders cannot be cast to hudson.tasks.CommandInterpreter (issue #29427)
  • (info)  HardcodedScript   HardcodedScript Check supports MatrixProjects (issue #29444)
  • (info)  Create   Create unit test suite for UI

Version 0.1.1 (Jul 14, 2015)

  • (error)   Project  Project dependency with ws-cleanup plugin (issue #29418)
  • (info)   New Check(plus) Check: Hardcoded Script check

Version 0.1.0 (Jul 12, 2015)

  • (info)   Initial    Initial release