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-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | db519584be6080ffee2c57ba6873974532ccf2707cb03fb23af07f502ec2b521 |
|
MD5 | a2b47cfe67f366ac88d3bb25abd1f0d1 |
|
BLAKE2b-256 | 2b2498042446157f395046612409aad8570b86b0324854a4352f9b402054d2ce |
Hashes for pre_commit_gitlabci_lint-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 944061c43431a49cc251f7d86077447d96a14cecb58d9bc1eb63972075c810c6 |
|
MD5 | ca71c15f828f1909c4471bc763968463 |
|
BLAKE2b-256 | 2b9be4e8a572452557f600052fddf125b1d827dc9aaf60dc345d7731041bd0fa |