A CLI designed to save time linting and validating Jenkinsfiles.
Project description
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 |
|
fish |
|
|
csh/tcsh |
|
|
PowerShell |
|
|
Windows |
cmd.exe |
|
PowerShell |
|
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 |
|
fish |
|
|
csh/tcsh |
|
|
PowerShell |
|
|
Windows |
cmd.exe |
|
PowerShell |
|
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jklint-0.0.2.tar.gz
.
File metadata
- Download URL: jklint-0.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a10950df421405e9ce95f2b825f912c36905965df2c1394992abdcdaf6149db5 |
|
MD5 | 1af542d252085e610d38bc34343fd180 |
|
BLAKE2b-256 | 17753e7fe459de1bbf37e045acf9b1e60637b325a9371218d649d535d1c0c0ac |
File details
Details for the file jklint-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: jklint-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2118bb34bce34325af69627c2d3038693d617468d33b41080beaf7dc90411b0d |
|
MD5 | 4470c757243844884955bf21cb6ad987 |
|
BLAKE2b-256 | 617032ca502585a5df66f7b9b431e438b7834d71233eb265d73ae4a2ea65077c |