Skip to content

dehasi/jenkins-pipeline-linter-gradle-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Ravil Galeyev
Oct 17, 2022
76a0119 · Oct 17, 2022

History

20 Commits
Oct 17, 2022
Oct 9, 2022
Oct 15, 2022
Oct 15, 2022
Oct 17, 2022
Oct 17, 2022
Oct 16, 2022
Sep 29, 2022

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