Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dehasi/jenkins-pipeline-linter-gradle-plugin
Gradle plugin to validate Jenkins pipelines.
https://github.com/dehasi/jenkins-pipeline-linter-gradle-plugin
gradle-plugin jenkins-pipeline linter
Last synced: about 1 month ago
JSON representation
Gradle plugin to validate Jenkins pipelines.
- Host: GitHub
- URL: https://github.com/dehasi/jenkins-pipeline-linter-gradle-plugin
- Owner: dehasi
- License: mit
- Created: 2022-09-28T19:52:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-17T21:34:51.000Z (about 2 years ago)
- Last Synced: 2024-11-15T21:33:19.681Z (about 1 month ago)
- Topics: gradle-plugin, jenkins-pipeline, linter
- Language: Kotlin
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Jenkins Pipeline Linter Gradle Plugin
image:https://maven-badges.herokuapp.com/maven-central/me.dehasi/jenkins-pipeline-linter-gradle-plugin/badge.svg[link="https://maven-badges.herokuapp.com/maven-central/me.dehasi/jenkins-pipeline-linter-gradle-plugin"]
image:https://img.shields.io/github/license/dehasi/jenkins-pipeline-linter-gradle-plugin?color=blue&label=licence[GitHub]Gradle plugin to validate Jenkins pipelines. It uses Jenkins https://www.jenkins.io/doc/book/pipeline/development/#linter[linter] and sends files by HTTP POST. To validate pipeline, Jenkins `pipeline-model-definition` plugin needs to be installed.
== Example
.gradle.build
[source, groovy]
----
import static me.dehasi.jenkins.linter.LinterExtension.ActionOnFailure.FAIL_BUILDplugins {
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
[source, shell script]
----
$ 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
----