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.
$ gitlabci-lint --help
usage: gitlabci-lint [-h] [-c CONFIG] [-b [BASE_URL]] [--version] [-q]
Validate your GitLab CI with GitLab's API endpoint.
options:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
CI Config files to check. (default: .gitlab-ci.yml)
-b [BASE_URL], -B [BASE_URL], --base_url [BASE_URL]
Base GitLab URL. (default: https://gitlab.com/)
--version show program's version number and exit
-q, -Q, --quiet Silently fail and pass, without output, unless improperly configured. (default: False)
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: [-b, '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
.)
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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed45465cafaaa45d3215bd0a0c80a8197945c299db983643dbcc2fda783f3f0 |
|
MD5 | b532c0b7822c32aa9a51b6e4d227ada6 |
|
BLAKE2b-256 | e830ef9f7c01e916f10d06aa9397f035f337f39498c70be9934a6cf6d4b48472 |
Hashes for pre_commit_gitlabci_lint-1.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 579f5bbf4dfdde590c0b0159d42df37e30ddac4a88f2b22f36eac002d61811f0 |
|
MD5 | beba7230d687e3d708376bb77585d791 |
|
BLAKE2b-256 | e7394071a0663ee8e9278a11bd1206cc81f830f3889271a771c247de45cf1476 |