Package: gitlab-lint
gitlab_lintThis is a CLI application to quickly lint .gitlab-ci.yml files using the gitlab api. This can easily be added as a pre-commit step to locally catch any issues with your configuration prior to pushing your changes.Installationpython3 -m pip install -U gitlab_lintConfigurationYou can set the following environmental variables:GITLAB_LINT_DOMAIN- Which allows you to override the default gitlab.com domain, and point at a local instanceGITLAB_LINT_TOKEN- If your .gitlab-ci.yml contains any includes, you may need to set a private token to pull data from those other reposGITLAB_LINT_PROJECT- If your .gitlab-ci.yml contains any includes which source from your local repo, you may set your project ID. If your repo is private, you must set your token as well.GITLAB_LINT_PATH- If you're linting anything other than the default.gitlab-ci.ymlfile.GITLAB_LINT_VERIFY- If you prefer TLS checkingI would recommend adding these to your ~/.profile or ~/.bash_profileParametersFlagDescriptionTypeDefaultRequired--domainGitlab Domain. You can set envvarGITLAB_LINT_DOMAINstringgitlab.comno--projectGitlab Project ID. You can set envvarGITLAB_LINT_PROJECTstringNoneno--tokenGitlab Personal Token. You can set envvarGITLAB_LINT_TOKENstringNoneno--pathPath to .gitlab-ci.yml, defaults to local directory. You can set envvarGITLAB_LINT_PATHstring.gitlab-ci.ymlno--verifyEnables HTTPS verification, which is disabled by default to support privately hosted instances. You can set envvarGITLAB_LINT_VERIFYFlagFalsenoExample UsageIf your .gitlab-ci.yml is in the current directory it is as easy as:$ gll
GitLab CI configuration is validFailures will appear like so:$ gll
GitLab CI configuration is invalid
(<unknown>): could not find expected ':' while scanning a simple key at line 26 column 1If you need to you can specify the path:$ gll --path path/to/.gitlab-ci.yml
GitLab CI configuration is validIf you choose not to set the envvars for domain and token you can pass them in as flags:$ gll --path path/to/.gitlab-ci.yml --domain gitlab.mycompany.com --project 1234 --token <gitlab personal token>
GitLab CI configuration is validHttps verification is disabled by default to support privately hosted instances, if you would like to enable pass the--verify | -vflag$ gll --verify
GitLab CI configuration is validDevelopmentBug Reports & Feature RequestsPlease use the submit a issue to report any bugs or file feature requests.DevelopingIf you are interested in being a contributor and want to get involved in developing this CLI application feel free to reach outIn general, PRs are welcome. We follow the typical trunk based development Git workflow.Branchthe repoClonethe project to your own machineCommitchanges to your branchPushyour work back up to your branchSubmit aMerge/Pull Requestso that we can review your changesNOTE:Be sure to merge the latest changes from "upstream" before making a pull request!Virtual environmentsThis project supports Poetry for Python virtual environments. Poetry may be installed viapip, and environments can be accessed withpoetry shellorpoetry run.TestsRun tests in root directory withpytestpre-commitTo use this with pre-commit.com, you can use something like-repo:https://github.com/mick352/gitlab-lintrev:pre-commit-hookhooks:-id:gitlab-ci-checkpass_filenames:falseargs:[-d,my.private.repo,-r,project_id,-t,private_token](or remove theargsline for gitlab.com).