Skip to main content

Gitlabci checker

release codecov GitHub Workflow Status (with branch) pver MIT

Installation

You can install gitlabci-checker via pip:

user@laptop:~$ pip install gitlabci-checker

You can interact with the CLI via the cicheck comand:

user@laptop:~$ cicheck
Usage: cicheck [OPTIONS] FILENAME

  Check if your gitlab-ci pipeline compiles correctly.

Options:
  -h, --help                 Show this message and exit.
  -v, --version              Show the version and exit.
  -t, --token TEXT           Your Gitlab access token: by default the content
                             of the GITLAB_TOKEN variable is used.  [required]
  -s, --gitlab-server TEXT   The Gitlab server hostname.  [required]
  -k, --insecure             Use insecure connection (http).
  -w, --warnings-are-errors  Force the failure if warnings are found.

How it works?

cicheck just calls the Gitlab CI lint API with the file you pass to it.

By default it will send the request to gitlab.com. If you want to use your own Gitlab instance you must pass the server address:

user@laptop:~$ cicheck .gitlab-ci.yaml --gitlab-server code.company.com
Everything's fine.

You must pass a valid token to the CLI: either as the environment variable GITLAB_TOKEN or via the --token flag.

Usage example

If your pipeline is valid it returns a "Everything's fine." message

user@laptop:~$ cicheck .gitlab-ci.yaml
Everything's fine.

If your configuration is invalid it returns an error message together with the response from Gitlab:

user@laptop:~$ cicheck .gitlab-ci.yaml
Check failed with error(s).
{
  "status": "invalid",
  "errors": [
    "variables config should be a hash of key value pairs"
  ],
  "warnings": []
}

You can also force a failure whenever the linter returns a warning by appending --warnings-are-errors or -w:

user@laptop:~$ cicheck .gitlab-ci.yaml --warnings-are-errors
Check failed with warning(s).
{
  "status": "valid",
  "errors": [],
  "warnings": ["jobs:job may allow multiple pipelines to run for a single action due to
  `rules:when` clause with no `workflow:rules` - read more:
  https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings"]
}

pre-commit hook

gitlabci-checker can be also used as a pre-commit hook. For example:

repos:
  - repo: https://github.com/lorenzophys/gitlabci-checker
    rev: v0.1.1
    hooks:
      - id: gitlabci-checker
        args:
          - --gitlab-server code.company.com
          - --warnings-are-errors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for gitlabci-checker 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitlabci-checker 0.1.3
File Size Uploaded
gitlabci_checker-0.1.3.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitlabci-checker 0.1.3
File Interpreter ABI Platform
gitlabci_checker-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / gitlabci_checker-0.1.3.tar.gz

Download URL gitlabci_checker-0.1.3.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1015fa35fefd626af0f608f74429c14c414b9a1cc2955916149009241e3dc8fb
BLAKE2b-256 checksum
How to use checksums
5fc9bf9ec539a9a3d8a3dac3c4e4410acfe57ab7f2a8a983266718f21be671dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

Release files / gitlabci_checker-0.1.3-py3-none-any.whl

Download URL gitlabci_checker-0.1.3-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64098c9b7a4c136412fae20753eeccf13f56058f1bcc64681cec0bf8e32f508d
BLAKE2b-256 checksum
How to use checksums
5da9c1683517760b68be0a2096de49152d23f08ef72b5e8c3748c11a8afb76fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page