This is a CLI application to quickly lint .gitlab-ci.yml files using the gitlab api
Project description
gitlab_lint
This is a CLI application to quickly lint .gitlab-ci.yml
files using the GitLab api.
This can easily be added as a pre-commit step to locally catch any issues with your configuration prior to pushing your changes.
Installation
$ python3 -m pip install -U gitlab_lint
Configuration
Parameters
Run gll --help
for full descriptions.
All parameters can be set by environment variable, simply prefix the double-dash or long version with GLL_
.
These can be added to your ~/.profile or ~/.bash_profile for convenience.
If options/arguments aren't set it, the application will search for GitLab CI variables instead.
Example Usage
If your .gitlab-ci.yml is in the current directory it is as easy as:
$ gll
GitLab CI configuration is valid
Failures will appear like so:
$ gll
# GitLab CI configuration is invalid
# (<unknown>): could not find expected ':' while scanning a simple key at line 26 column 1
If you need to you can specify the path:
$ gll --file path/to/.gitlab-ci.yml
# GitLab CI configuration is valid
If you choose not to set the envvars for domain and token you can pass them in as flags:
$ gll --file path/to/.gitlab-ci.yml --domain gitlab.mycompany.com --project 1234 --token <gitlab personal token>
# GitLab CI configuration is valid
Https verification is enabled by default, if you wish to disable it pass the --insecure | -i
flag:
$ gll --insecure
# GitLab CI configuration is valid
Development
Bug Reports & Feature Requests
Please use the submit a issue to report any bugs or file feature requests.
Developing
If you are interested in being a contributor and want to get involved in developing this CLI application feel free to reach out!
In general, PRs are welcome. We follow the typical trunk based development Git workflow.
- Fork the repo
- Clone the project to your own machine
- Run the devcontainer
- Make and test your changes
- Commit changes to your branch using
cz bump
- Push your work back up to your branch including tags
git push --all
- Submit a Merge/Pull Request so that we can review your changes
NOTE: Be sure to merge the latest changes from upstream before making a pull request!
Virtual environments
This project supports Poetry for Python virtual environments.
Poetry may be installed via pip
, and environments can be accessed with poetry shell
or poetry run
.
At the current time there's a bit of a clash with Flakes and Poetry2Nix.
editablePackageSources
property is at odds with the pureness of flakes.
One can work around this by direnv reload
on every change to package source code, or by directly running python gll.py
.
GitHub issue
Tests
Run tests in root directory with pytest
pre-commit
To use this with pre-commit.com, you can use something like
- repo: https://github.com/mick352/gitlab-lint
rev: pre-commit-hook
hooks:
- id: gitlab-ci-check
pass_filenames: false
args: [-d, my.private.gitlab.com, -p, project_id, -t, private_token]
(or remove the args
line for gitlab.com).
TODO
Look into automagic release jobs
poetry version $(git describe --tags --abbrev=0)
poetry build
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 gitlab_lint_srt-0.8.1.tar.gz
.
File metadata
- Download URL: gitlab_lint_srt-0.8.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.8 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73e751f15c6ae84550660d8c64055306d8b61265cc183f8d7acb95e1e1f17981 |
|
MD5 | 37ad58d0c685f197b4254a14cba43030 |
|
BLAKE2b-256 | d6fd50083300e2ede1ec552d5ad3a5773839bc6b69c579b93b40fce75c9564b3 |
File details
Details for the file gitlab_lint_srt-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: gitlab_lint_srt-0.8.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.8 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38b0a950499823317502064cdd19d677781a1382e15f85a245948a4685776d70 |
|
MD5 | 52adbd8a49ca4751d3200f1dd5c2b265 |
|
BLAKE2b-256 | bade1b48de4a62f39a140ba98fac2d20efee789734e15c81c9408e7295795435 |