Skip to content

dehasi/jenkins-pipeline-linter-gradle-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins Pipeline Linter Gradle Plugin

badge GitHub

Gradle plugin to validate Jenkins pipelines. It uses Jenkins linter and sends files by HTTP POST. To validate pipeline, Jenkins pipeline-model-definition plugin needs to be installed.

Example

gradle.build
import static me.dehasi.jenkins.linter.LinterExtension.ActionOnFailure.FAIL_BUILD

plugins {
    id 'me.dehasi.jenkins-pipeline-linter' version '${VERSION}'
}

jenkinsPipelineLinter {
     pipelinePath = ['path/to/jenkinsfile1', 'path/to/jenkinsfile2']
     actionOnFailure = FAIL_BUILD // or WARNING
     jenkins {
        url = 'https://jenkins.example'
        ignoreCertificate()
        username = '${USERNAME}'
        password = '${PASSWORD}'
     }
}

Run

$ gradle lint

> Task :lint FAILED
Validating 2 files
Validating '/**/path/to/jenkinsfile1'
Jenkinsfile successfully validated.

Validating '/**/path/to/jenkinsfile2'
Errors encountered validating Jenkinsfile:
WorkflowScript: 2: Not a valid section definition: "agent". Some extra configuration is required. @ line 2, column 3.
     agent
     ^

WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.
   pipeline {
   ^


Validation finished with 1 errors.

FAILURE: Build failed with an exception.

BUILD FAILED in 705ms

About

Gradle plugin to validate Jenkins pipelines.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published