Skip to main content

Jklint

A Jenkinsfile linter CLI saving time linting Jenkinsfiles by only typing 1 argument in the command line.

Features ⭐

1.Credentials entered one time only

2.Short commands to type

3.Validate Jenkinsfiles through the Jenkins Client of your server

4.Masked credentials

Setup 🛠

Jklint can be installed through Pypi or a clone of the repository.

From Pypi

The easiest option to setup Jklint is to install the pip package and run it into a virtual environment.

1.Create a virtual environment

python3 -m venv <virtual-environment-name>

2.Activate the virtual environment

Platform

Shell

Command to activate virtual environment

POSIX

bash/zsh

$ source <venv>/bin/activate

fish

$ source <venv>/bin/activate.fish

csh/tcsh

$ source <venv>/bin/activate.csh

PowerShell

$ <venv>/bin/Activate.ps1

Windows

cmd.exe

C:\> <venv>\Scripts\activate.bat

PowerShell

PS C:\> <venv>\Scripts\Activate.ps1

3.Install the package

python3 pip install jklint

Through clone

1.Clone the repository

git clone https://github.com/aissa-laribi/jklint

2.Create a virtual environment

python3 -m venv <virtual-environment-name>

3.Activate the virtual environment

Platform

Shell

Command to activate virtual environment

POSIX

bash/zsh

$ source <venv>/bin/activate

fish

$ source <venv>/bin/activate.fish

csh/tcsh

$ source <venv>/bin/activate.csh

PowerShell

$ <venv>/bin/Activate.ps1

Windows

cmd.exe

C:\> <venv>\Scripts\activate.bat

PowerShell

PS C:\> <venv>\Scripts\Activate.ps1

4.Install dependancies and package locally

pip install -e .

Usage

It's recommended to run jklint from a virtual environment, this way the credentials and the Jenkins client will not be found in the repository. Only the Jenkinsfile should be in the repository.

1.Configure jklint

jklint config

If you work with VS Code and your OS is a POSIX OS, an .env file should open. Otherwise, find the .env file in your current directory(that should your virtual environment directory)

Replace the values with yours and save the file.

2.Validate the file

jklint go

It will download the Jenkins client from your Jenkins url. Then, it will proceed to the validation of the Jenkinsfile

If the credentials and the syntax of the Jenkinsfile are correct it should return:

Jenkins-client found
CompletedProcess(args=['java', '-jar', 'jenkins-cli.jar', '-s', 'jenkins-url', '-webSocket', '-auth', 'user', 'declarative-linter'], returncode=0, stdout='Jenkinsfile successfully validated.\n', stderr='')

And your 'user' and 'jenkins-url' details will stay hidden.

Release files for jklint 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jklint 0.0.2
File Size Uploaded
jklint-0.0.2.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jklint 0.0.2
File Interpreter ABI Platform
jklint-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / jklint-0.0.2.tar.gz

Download URL jklint-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a10950df421405e9ce95f2b825f912c36905965df2c1394992abdcdaf6149db5
BLAKE2b-256 checksum
How to use checksums
17753e7fe459de1bbf37e045acf9b1e60637b325a9371218d649d535d1c0c0ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / jklint-0.0.2-py3-none-any.whl

Download URL jklint-0.0.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2118bb34bce34325af69627c2d3038693d617468d33b41080beaf7dc90411b0d
BLAKE2b-256 checksum
How to use checksums
617032ca502585a5df66f7b9b431e438b7834d71233eb265d73ae4a2ea65077c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page