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
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.10.x or later.
Warning Please note the token should not be shared and if leaked can cause significant harm.
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.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 068890d4a459d2c64fffbb2586d33cee76cc03438264b1ef370d321e3b9d8322 |
|
MD5 | 0c19fd6b22b5f5a0bc85cec9ab8ea3b1 |
|
BLAKE2b-256 | 0665739a8f7d0fdb682327af43434c5ed71bff6637455a41714ffcb79776f5e1 |
Hashes for pre_commit_gitlabci_lint-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18d9e4573878a845ab409d40cdeda75562037480054f5aea238404eac76b758d |
|
MD5 | 07c3928a53e7c839c539b42f7502848a |
|
BLAKE2b-256 | 2973f81cb3f79ba39c3f266ef0b0030ca9830456c3a9430e63c623f78a960287 |