Checks if your gitlab-ci pipeline compiles correctly.
Project description
Gitlabci checker
Installation
You can install gitlabci-checker
via pip
:
user@laptop:~$ pip install gitlabci-checker
You can interact with the CLI via the cicheck
comand:
user@laptop:~$ cicheck
Usage: cicheck [OPTIONS] FILENAME
Check if your gitlab-ci pipeline compiles correctly.
Options:
-h, --help Show this message and exit.
-v, --version Show the version and exit.
-t, --token TEXT Your Gitlab access token: by default the content
of the GITLAB_TOKEN variable is used. [required]
-s, --gitlab-server TEXT The Gitlab server hostname. [required]
-k, --insecure Use insecure connection (http).
-w, --warnings-are-errors Force the failure if warnings are found.
How it works?
cicheck
just calls the Gitlab CI lint API with the file you pass to it.
By default it will send the request to gitlab.com
. If you want to use your own Gitlab instance you must pass the server address:
user@laptop:~$ cicheck .gitlab-ci.yaml --gitlab-server code.company.com
Everything's fine.
You must pass a valid token to the CLI: either as the environment variable GITLAB_TOKEN
or via the --token
flag.
Usage example
If your pipeline is valid it returns a "Everything's fine." message
user@laptop:~$ cicheck .gitlab-ci.yaml
Everything's fine.
If your configuration is invalid it returns an error message together with the response from Gitlab:
user@laptop:~$ cicheck .gitlab-ci.yaml
Check failed with error(s).
{
"status": "invalid",
"errors": [
"variables config should be a hash of key value pairs"
],
"warnings": []
}
You can also force a failure whenever the linter returns a warning by appending --warnings-are-errors
or -w
:
user@laptop:~$ cicheck .gitlab-ci.yaml --warnings-are-errors
Check failed with warning(s).
{
"status": "valid",
"errors": [],
"warnings": ["jobs:job may allow multiple pipelines to run for a single action due to
`rules:when` clause with no `workflow:rules` - read more:
https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings"]
}
pre-commit
hook
gitlabci-checker
can be also used as a pre-commit hook. For example:
repos:
- repo: https://github.com/lorenzophys/gitlabci-checker
rev: v0.1.1
hooks:
- id: gitlabci-checker
args:
- --gitlab-server code.company.com
- --warnings-are-errors
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 gitlabci_checker-0.1.3.tar.gz
.
File metadata
- Download URL: gitlabci_checker-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1015fa35fefd626af0f608f74429c14c414b9a1cc2955916149009241e3dc8fb |
|
MD5 | 4a0aada9d1325c6ce05f8aac902b3ab4 |
|
BLAKE2b-256 | 5fc9bf9ec539a9a3d8a3dac3c4e4410acfe57ab7f2a8a983266718f21be671dc |
File details
Details for the file gitlabci_checker-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: gitlabci_checker-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64098c9b7a4c136412fae20753eeccf13f56058f1bcc64681cec0bf8e32f508d |
|
MD5 | eaf457ae61b32d606c5a236f1b972ded |
|
BLAKE2b-256 | 5da9c1683517760b68be0a2096de49152d23f08ef72b5e8c3748c11a8afb76fc |