{"id":15683590,"url":"https://github.com/gableroux/docker-gitlab-ci-lint","last_synced_at":"2025-09-07T16:40:42.486Z","repository":{"id":47157847,"uuid":"163349296","full_name":"GabLeRoux/docker-gitlab-ci-lint","owner":"GabLeRoux","description":"✅  Docker image and script to lint .gitlab-ci.yml files using https://gitlab.com/api/v4/ci/lint.","archived":false,"fork":false,"pushed_at":"2021-09-10T20:49:12.000Z","size":20,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T10:42:33.093Z","etag":null,"topics":["docker-image","gitlab-ci","linter"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/gableroux/gitlab-ci-lint","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GabLeRoux.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-28T00:56:37.000Z","updated_at":"2023-04-21T03:55:46.000Z","dependencies_parsed_at":"2022-08-29T16:30:39.053Z","dependency_job_id":null,"html_url":"https://github.com/GabLeRoux/docker-gitlab-ci-lint","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fdocker-gitlab-ci-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fdocker-gitlab-ci-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fdocker-gitlab-ci-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fdocker-gitlab-ci-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GabLeRoux","download_url":"https://codeload.github.com/GabLeRoux/docker-gitlab-ci-lint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252890051,"owners_count":21820298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","gitlab-ci","linter"],"created_at":"2024-10-03T17:07:29.600Z","updated_at":"2025-05-07T13:46:24.077Z","avatar_url":"https://github.com/GabLeRoux.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-gitlab-ci-lint\n\n[![Docker Stars](https://img.shields.io/docker/stars/gableroux/gitlab-ci-lint.svg)](https://hub.docker.com/r/gableroux/gitlab-ci-lint)\n[![Docker Pulls](https://img.shields.io/docker/pulls/gableroux/gitlab-ci-lint.svg)](https://hub.docker.com/r/gableroux/gitlab-ci-lint)\n[![Docker Automated](https://img.shields.io/docker/automated/gableroux/gitlab-ci-lint.svg)](https://hub.docker.com/r/gableroux/gitlab-ci-lint)\n[![Docker Build](https://img.shields.io/docker/build/gableroux/gitlab-ci-lint.svg)](https://hub.docker.com/r/gableroux/gitlab-ci-lint)\n[![Image](https://images.microbadger.com/badges/image/gableroux/gitlab-ci-lint.svg)](https://microbadger.com/images/gableroux/gitlab-ci-lint)\n[![Version](https://images.microbadger.com/badges/version/gableroux/gitlab-ci-lint.svg)](https://microbadger.com/images/gableroux/gitlab-ci-lint)\n[![Layers](https://images.microbadger.com/badges/image/gableroux/gitlab-ci-lint.svg)](https://microbadger.com/images/gableroux/gitlab-ci-lint)\n\nDocker image and script to lint `.gitlab-ci.yml` files using `https://gitlab.com/api/v4/ci/lint`. \n\nInspired by [this gist](https://gist.github.com/Betree/56f9669c3adb2a1633429ff321198fff)\n\n## How to use\n\n### Docker image\n\n```bash\ncat .gitlab-ci.yml | docker run --rm -i gableroux/gitlab-ci-lint:v1.0.0\n```\n\n### Shell script\n\nYou'll need [`yq`](https://github.com/mikefarah/yq) and `gitlab-ci-lint` in your `$PATH` (you can clone this project and link to it too).\n\n```bash\ncat .gitlab-ci.yml | ./gitlab-ci-lint\n# or\n./gitlab-ci-lint .gitlab-ci.yml\n# or\n./gitlab-ci-lint\n```\n\n### in your CI pipeline (`.gitlab-ci.yml`)\n\nNote: until [this gets fixed by gitlab](https://gitlab.com/gitlab-org/gitlab/-/issues/336666), you need to go set an actual valid `GITLAB_TOKEN` with `ci/lint` access in your variables. `CI_JOB_TOKEN` currently doesn't have the right to access this endpoint.\n\n```yaml\ntest-ci-file:\n  image: gableroux/gitlab-ci-lint:v1.0.0\n  script:\n  - gitlab-ci-lint example.gitlab-ci.yml\n```\n\nNote: a gitlab-ci job will automatically set `$CI_JOB_TOKEN` which is now required by [`/ci/lint` gitlab api](https://docs.gitlab.com/ce/api/lint.html).\n\n### gitlab token subject\n\nYou can set `$CI_JOB_TOKEN` or `$GITLAB_TOKEN` environment variable before invoking the script. \n\n```bash\nGITLAB_TOKEN=EXAMPLE_TOKEN ./gitlab-ci-lint\n```\n\nYou can also pass it as a 3rd parameter. Example:  \n\n```bash\n./gitlab-ci-lint .gitlab-ci.yml https://gitlab.com/api/v4 EXAMPLE_TOKEN\n```\n\n:warning: Using a secret token directly in a shell command is unsafe and should be avoided as it will be written to your shell history. A workaround is to create your own script, write the command in that script and invoke the script. Or you could also set this secret from your `.bashrc` file.\n\n### Handy function for your shell\n\n```bash\ngitlab-ci-lint () {\n\tcat ${1:-.gitlab-ci.yml} | docker run --rm -i gableroux/gitlab-ci-lint:v1.0.0\n}\n```\n\nThis way, you go in a project and type `gitlab-ci-lint` or `gitlab-ci-lint custom-gitlab-ci-file.yml`. :tada:\n\n## FAQ\n\n### Why?\n\nI wrote some project generators using [cookiecutter](https://github.com/audreyr/cookiecutter) and managed to generate `.gitlab-ci.yml` files. I wanted to lint them in the ci to know when I break things.\n\n### Is this safe?\n\nYou should not execute things from the internets, read your scripts before executing them.\n\n### Can I contribute\n\nYeah why not? Feel this can be improved? Fork and send a PR. :tada:\n\n### Alternatives\n\n* https://www.npmjs.com/package/gitlab-ci-lint\n* https://gitlab.com/orobardet/gitlab-ci-linter\n\n## License\n\n[MIT](LICENSE.md) © [Gabriel Le Breton](https://gableroux.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgableroux%2Fdocker-gitlab-ci-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgableroux%2Fdocker-gitlab-ci-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgableroux%2Fdocker-gitlab-ci-lint/lists"}