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.

The Jenkins Lint plugin attempts to solve this problem by allowing jobs to be evaluated with some predefined best practices. The goal is for your team to be able to define those best practices to be related to their project.

Manually reviewing those jobs wouldn't be too hard, but doing the same thing all over again for every new job or for a hundred other projects is where it gets difficult and tedious. This provides a much more powerful way of analyzing them.

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 Removed
Image Removed

Features

List of available Job checks:

  • Artifact Publisher check
  • CleanUp Workspace check
  • Git Shallow clone 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
  • Null SCM check
  • Polling SCM Trigger check
  • Multibranch Job Type check
  • Hard-coded Script check
  • Gradle Wrapper check
  • Built Timeout check
  • Git Ref repo check
  • Groovy system exit check
  • TimerTrigger Hash check

List of available Slave checks:

  • Slave description check
  • Slave label check
  • Slave version check
  • Windows slave launch check

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.
  • Define some kind of programmatically scripts.
  • Rest API 
  • Git Submodule ref repo check
  • BFA check
  • Remove plugin dependency
  • Cyclomatic complexity check

Control comments:

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

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

Code Block
titleConsole Output
Jul {excerpt} 
{toc:maxLevel=1|exclude=Plugin Information|printable=false}SummaryJenkins 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.
The Jenkins Lint plugin attempts to solve this problem by allowing jobs to be evaluated with some predefined best practices. The goal is for your team to be able to define those best practices to be related to their project.
Manually reviewing those jobs wouldn't be too hard, but doing the same thing all over again for every new job or for a hundred other projects is where it gets difficult and tedious. This provides a much more powerful way of analyzing them.
UsageYou 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.




FeaturesList of available Job checks:
Artifact Publisher checkCleanUp Workspace checkGit Shallow clone checkJavadoc Publisher checkJob Assigned Label checkMaster Assigned Label checkJob Description checkJob Log Rotator checkJob Name checkMaven Job Type checkNull SCM checkPolling SCM Trigger checkMultibranch Job Type checkHard-coded Script checkGradle Wrapper checkBuilt Timeout checkGit Ref repo checkGroovy system exit checkTimerTrigger Hash checkList of available Slave checks:
Slave description checkSlave label checkSlave version checkWindows slave launch checkPlanned upcoming featuresLoad checks dynamically via Reflection.Show graphs.Configure Checks (enabled, disabled, change severity)Load checks dynamically via Jenkins.Jobs action to show those jenkins lints.Define some kind of programmatically scripts.Git Submodule ref repo checkBFA checkCyclomatic complexity checkControl comments:
You can ignore a particular check  by adding a trailing lint:ignore:<check name> comment to the job description.
APIThis plugin provides an API for retrieving lint defects.
You can retrieve persisted lint defects by requesting the following URL : <jenkins/hudson_url>/jenkinslint/api/json?depth=2&pretty=true
Here is some data sample returned by this call :
{"checkSet": {"GitRefChecker": {"description":"When setting Jenkins Jobs with Git SCM you might speed up the cloning timeifyou use git ref repos when cloning.","name":"GitRefChecker","severity":"Low"},     ...   },"jobSet": {"example": {"lintHealthReport": {"description":"Lint stability: 63%","iconUrl":"health-60to79.png","score": 63       },"lintSet": {"GitRefChecker": {"found":false,"ignored":false,"name":"GitRefChecker"},        ...       }     },     ...   },"slaveCheckSet": {"WindowsSlaveLaunchChecker": {"description":"This launch method relies on DCOM and is often associated with <a href=https://wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM>subtle problems</a>. Consider using Launch slave agents using Java Web Start instead,<br/>which also permitsinstallation as a Windows service but is generally considered more reliable.","name":"WindowsSlaveLaunchChecker","severity":"Medium"},...},"slaveSet": {"example": {"lintHealthReport": {"description":"Lint stability: 50%","iconUrl":"health-40to59.png","score": 50       },"lintSet": {"WindowsSlaveLaunchChecker": {"found":false,"ignored":false,"name":"WindowsSlaveLaunchChecker"},        ...       }     },     ...   } }
Workaround{warning}There is already a known issue in the initial version 0.1.0 , Workspace Cleanup Plugin is a required dependency otherwise JenkinsLint will fail when analyzing those Jobs
{warning}Console OutputJul 13, 2015 10:21:06 PM hudson.ExpressionFactory2$JexlExpression evaluate WARNING: Caught exception evaluating: it.data in /jenkinslint/. Reason: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.lang.reflect.Method.invoke(Method.java:483)  .... Giant Stacktrack ....          at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)         at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: hudson/plugins/ws_cleanup/WsCleanup$DescriptorImpl         at org.jenkins.ci.plugins.jenkinslint.check.CleanupWorkspaceChecker.executeCheck(CleanupWorkspaceChecker.java:22 )         at org.jenkins.ci.plugins.jenkinslint.JenkinsLintAction.getData(JenkinsLintAction.java:60)         ... 112 more

There are two workarounds:

...

  1. Installing  Workspace Cleanup Plugin 
  2. Upgrading the JenkinsLint version

Requirements

Jenkins

...


Installing  Workspace Cleanup Plugin Upgrading the JenkinsLint versionRequirementsJenkinsJenkins version 1.554.1 or newer is required.

...


Open Issues

...

{jiraissues:anonymous=true\|url=http://issues.jenkins-ci.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=

...

Version history

Version 0.8.0 (Upcoming release)

  • (info)  RestAPI.
  • (info)  BFA check.

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 Jenkins lint check for Jenkins Slaves (issue #30161)

Version 0.3.0 (Jul 29, 2015)

Version 0.2.0 (Jul 21, 2015)

...

project%20%3D%20JENKINS%20AND%20status%20in%20(Open%2C%20"In%20Progress"%2C%20Reopened)%20AND%20component%20%3D%20jenkinslint-plugin%20ORDER%20BY%20updated%20DESC%2C%20priority%20DESC%2C%20created%20ASC|width=850px\|height=300px\|renderMode=dynamic} 
Version historyVersion 0.9.0 (Upcoming release)Version 0.8.0 (March 7, 2017)  RestAPI.  (issue #41449)  TimerTrigger 'Hash' check supporting @  (issue #42337)  Removed dependent plugins.  (issue #42383)Version 0.7.0 (Feb 26, 2017)  Maven and Matrix projects weren't supported when linting some defects  (issue #42310)  TimerTrigger 'Hash' check  (issue #42267)  i18 supportVersion 0.6.0 (Feb 12, 2017)     Git local ref cache repos check  (issue #41528)     Groovy system exist check  (issue #38617)     Updated pom file  (infra #588)Version 0.5.0 (Oct 1, 2015)    Build Timeout check  (issue #30725)Version 0.4.0 (Aug 27, 2015)   Support Jenkins lint check for Jenkins Slaves (issue #30161)Version 0.3.0 (Jul 29, 2015)  Gradle Wrapper check  (issue #29486)Version 0.2.0 (Jul 21, 2015)   Health Icons plus percentage (issue #29466)   Refactor: remove optional dependencies (issue #29545) (issue #29544) (issue #29546)Version 0.1.2 (Jul 15, 2015)

...

  Some builders cannot be cast to hudson.tasks.CommandInterpreter (issue #29427)

...

  HardcodedScript Check supports MatrixProjects (issue #29444)

...

  Create unit test suite

...

 for UIVersion 0.1.1 (Jul 14, 2015)

...

   Project dependency with ws-cleanup plugin (issue #29418)

...

 

...

  New Check: Hardcoded

...

 Script checkVersion 0.1.0 (Jul 12, 2015)

...

   Initial release