pre-commit-gitlabci-lint


Namepre-commit-gitlabci-lint JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/bjd2385/pre-commit-gitlabci-lint
SummaryValidate your GitLab CI with GitLab's API endpoint.
upload_time2023-05-12 16:31:43
maintainer
docs_urlNone
authorEmma Doyle
requires_python>=3.8, <4
license
keywords pre-commit gitlab ci continuous integration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GitLab CI lint pre-commit hook

This is a [pre-commit](https://pre-commit.com/) hook that uses GitLab's `/api/v4/ci/lint` linting endpoint to validate the contents of `.gitlab-ci.yml` files. This is similar to CircleCI pre-commit hooks that validate that product's configuration files.

```text
$ gitlabci-lint --help
usage: gitlabci-lint [-h] [-c CONFIGS] [-C GITLABCI_LINT_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 CONFIGS, --configs CONFIGS
                        CI Config files to check. (default: .gitlab-ci.yml)
  -C GITLABCI_LINT_CONFIG, --gitlabci-lint-config GITLABCI_LINT_CONFIG
                        Pass parameters via config file. Looks first at '.gitlabci-lint.toml', then '$HOME/.config/gitlabci-lint/config.toml', unless otherwise specified.
  -b [BASE_URL], -B [BASE_URL], --base-url [BASE_URL]
                        Base GitLab URL. (default: https://gitlab.com/)
  -p PROJECT_ID, -P PROJECT_ID, --project-id PROJECT_ID
                        Project ID to use with the lint API.
  --version             show program's version number and exit
  -q, -Q, --quiet       Silently fail and pass, without output, unless improperly configured. (default: False)
```

## Install

```shell
pip install pre-commit-gitlabci-lint
```

## Usage

### Setup

1. [Create an access token](https://gitlab.com/-/profile/personal_access_tokens) with `api` scope.
2. Set access token value in an environment variable named `GITLAB_TOKEN` or `GITLABCI_LINT_TOKEN`.
3. Add the projectId for your gitlab project as a command line argument, or set it in the config file.
4. Ensure the virtualenv Python version is 3.8 or later.

### Example

An example `.pre-commit-config.yaml`:

```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', '-p', '12345678']
```

### Use configuration files

No configuration file is required for use. However, if you'd rather specify settings in your repo, you may create a config file located at `/root/of/repo/.gitlabci-lint.toml`, or `$HOME/.config/.gitlabci-lint/config.toml`, such as the following.

```toml
[gitlabci-lint]
quiet = false
base-url = "https://gitlab.com"
project-id = "12345678"
configs = [ ".gitlab-ci.yml" ]
token = "$GITLAB_TOKEN"
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bjd2385/pre-commit-gitlabci-lint",
    "name": "pre-commit-gitlabci-lint",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "",
    "keywords": "pre-commit,GitLab,CI,continuous integration",
    "author": "Emma Doyle",
    "author_email": "bjd2385.linux@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/19/bc/c9178d566e16c8eedd318b1f43b541999167fbb0e3d51bfe76659d99ae7e/pre-commit-gitlabci-lint-1.3.0.tar.gz",
    "platform": null,
    "description": "# GitLab CI lint pre-commit hook\n\nThis is a [pre-commit](https://pre-commit.com/) hook that uses GitLab's `/api/v4/ci/lint` linting endpoint to validate the contents of `.gitlab-ci.yml` files. This is similar to CircleCI pre-commit hooks that validate that product's configuration files.\n\n```text\n$ gitlabci-lint --help\nusage: gitlabci-lint [-h] [-c CONFIGS] [-C GITLABCI_LINT_CONFIG] [-b [BASE_URL]] [--version] [-q]\n\nValidate your GitLab CI with GitLab's API endpoint.\n\noptions:\n  -h, --help            show this help message and exit\n  -c CONFIGS, --configs CONFIGS\n                        CI Config files to check. (default: .gitlab-ci.yml)\n  -C GITLABCI_LINT_CONFIG, --gitlabci-lint-config GITLABCI_LINT_CONFIG\n                        Pass parameters via config file. Looks first at '.gitlabci-lint.toml', then '$HOME/.config/gitlabci-lint/config.toml', unless otherwise specified.\n  -b [BASE_URL], -B [BASE_URL], --base-url [BASE_URL]\n                        Base GitLab URL. (default: https://gitlab.com/)\n  -p PROJECT_ID, -P PROJECT_ID, --project-id PROJECT_ID\n                        Project ID to use with the lint API.\n  --version             show program's version number and exit\n  -q, -Q, --quiet       Silently fail and pass, without output, unless improperly configured. (default: False)\n```\n\n## Install\n\n```shell\npip install pre-commit-gitlabci-lint\n```\n\n## Usage\n\n### Setup\n\n1. [Create an access token](https://gitlab.com/-/profile/personal_access_tokens) with `api` scope.\n2. Set access token value in an environment variable named `GITLAB_TOKEN` or `GITLABCI_LINT_TOKEN`.\n3. Add the projectId for your gitlab project as a command line argument, or set it in the config file.\n4. Ensure the virtualenv Python version is 3.8 or later.\n\n### Example\n\nAn example `.pre-commit-config.yaml`:\n\n```yaml\n---\nrepos:\n  - repo: https://github.com/bjd2385/pre-commit-gitlabci-lint\n    rev: <latest release>\n    hooks:\n      - id: gitlabci-lint\n      # args: [-b, 'https://custom.gitlab.host.com', '-p', '12345678']\n```\n\n### Use configuration files\n\nNo configuration file is required for use. However, if you'd rather specify settings in your repo, you may create a config file located at `/root/of/repo/.gitlabci-lint.toml`, or `$HOME/.config/.gitlabci-lint/config.toml`, such as the following.\n\n```toml\n[gitlabci-lint]\nquiet = false\nbase-url = \"https://gitlab.com\"\nproject-id = \"12345678\"\nconfigs = [ \".gitlab-ci.yml\" ]\ntoken = \"$GITLAB_TOKEN\"\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Validate your GitLab CI with GitLab's API endpoint.",
    "version": "1.3.0",
    "project_urls": {
        "Bug Reports": "https://github.com/bjd2385/pre-commit-gitlabci-lint/issues",
        "Homepage": "https://github.com/bjd2385/pre-commit-gitlabci-lint",
        "Source": "https://github.com/bjd2385/pre-commit-gitlabci-lint"
    },
    "split_keywords": [
        "pre-commit",
        "gitlab",
        "ci",
        "continuous integration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69a503c2792762a683152ae05bd5ce2df731a29f76cb579841d09c8f2f6dbb81",
                "md5": "634c09ed96535114aa3dae48340d58b1",
                "sha256": "76e939c3f0f7ebaae3195dc8c79bef977b23a9a255634df7d672e6c5d225d17c"
            },
            "downloads": -1,
            "filename": "pre_commit_gitlabci_lint-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "634c09ed96535114aa3dae48340d58b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 6621,
            "upload_time": "2023-05-12T16:31:42",
            "upload_time_iso_8601": "2023-05-12T16:31:42.781084Z",
            "url": "https://files.pythonhosted.org/packages/69/a5/03c2792762a683152ae05bd5ce2df731a29f76cb579841d09c8f2f6dbb81/pre_commit_gitlabci_lint-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19bcc9178d566e16c8eedd318b1f43b541999167fbb0e3d51bfe76659d99ae7e",
                "md5": "da117624bb4ed42be6da334c9e5d4509",
                "sha256": "9a9dda583d39e6f3ddd40d6687dea348f12f0305ad0bded59ca2bbe14ce3d97d"
            },
            "downloads": -1,
            "filename": "pre-commit-gitlabci-lint-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "da117624bb4ed42be6da334c9e5d4509",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, <4",
            "size": 6131,
            "upload_time": "2023-05-12T16:31:43",
            "upload_time_iso_8601": "2023-05-12T16:31:43.950794Z",
            "url": "https://files.pythonhosted.org/packages/19/bc/c9178d566e16c8eedd318b1f43b541999167fbb0e3d51bfe76659d99ae7e/pre-commit-gitlabci-lint-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 16:31:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bjd2385",
    "github_project": "pre-commit-gitlabci-lint",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [],
    "lcname": "pre-commit-gitlabci-lint"
}
        
Elapsed time: 0.16661s