Validate your GitLab CI with GitLab's API endpoint.
Project description
GitLab CI validation pre-commit-hook
This is a pre-commit hook that uses GitLab's /api/v4/ci/lint
lint endpoint to validate the contents of .gitlab-ci.yml
files. This is similar in fashion to how CircleCI pre-commit hooks validate that product's required configs, which is by uploading your config to an endpoint.
By default, this tool sends your configuration to https://gitlab.com, though this can be overridden (see below).
This tool has been extended and adapted from kadrach's implementation (cf. the license).
Usage
Requirements
GitLab Lint API now requires authorization.
- Create Access Token with
api
scope. - Set access token value as
GITLAB_TOKEN
environment variable. - Ensure Python version available is 3.8 or later.
Warning Please note the token should not be shared and if leaked can cause significant harm.
Example
An example .pre-commit-config.yaml
:
---
repos:
- repo: https://github.com/bjd2385/pre-commit-gitlabci-lint
rev: <latest release>
hooks:
- id: gitlabci-lint
# args: ["https://custom.gitlab.host.com"]
Development
Install dependencies by running ./scripts/dependencies.sh
. Or, if you already have yarn
in your path, yarn install:deps
.
Releases
Update src/gitlabci_lint/validate.py/__version__
, setup.py/version
-string, and tag this repo's master branch with the same version string (prefixed by 'v
.)
TODOs:
[ ] Allow passing multiple config files for validation in template repositories. [ ]
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
Hashes for pre-commit-gitlabci-lint-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e29b47f53c28322da8fe10f88078519b5f06ff758c969fd9ba21385931db9a6d |
|
MD5 | 4c13889c21d61c6b0344a31d0aa55829 |
|
BLAKE2b-256 | 353b5c23c6665992952ec20708703de442506e235f6899672581c0e7950723ae |
Hashes for pre_commit_gitlabci_lint-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6876b0a66aaffe5a09573493c8223eb10069ba5ab1017331fb70538de00f6ab8 |
|
MD5 | 9796f168bb478ce737fe6d8310b82476 |
|
BLAKE2b-256 | adbdf6835c363d714ccc2bd7a67a7f0756beec7e0e6f33fdc1bdb5b485aa1150 |