gableroux/gitlab-ci-lint

By gableroux

Updated over 3 years ago

Image

10K+

docker-gitlab-ci-lint

Docker StarsDocker PullsDocker AutomatedDocker BuildImageVersionLayers

Docker image and script to lint .gitlab-ci.yml files using https://gitlab.com/api/v4/ci/lint.

Inspired by this gist

How to use

Docker image
cat .gitlab-ci.yml | docker run --rm -i gableroux/gitlab-ci-lint
Shell script

You'll need to install dependencies first if you go this way.

cat .gitlab-ci.yml | ./gitlab-ci-lint
# or
./gitlab-ci-lint .gitlab-ci.yml
.gitlab-ci.yml
test-ci-file:
  image: gableroux/gitlab-ci-lint
  script:
  - gitlab-ci-lint .gitlab-ci.yml
Handy function for your shell
gitlab-ci-lint () {
	cat ${1:-.gitlab-ci.yml} | docker run --rm -i gableroux/gitlab-ci-lint
}

This way, you go in a project and type gitlab-ci-lint or gitlab-ci-lint custom-gitlab-ci-file.yml. :tada:

FAQ

Why?

I wrote some project generators using cookiecutter and managed to generate .gitlab-ci.yml files so I wanted to lint them in the ci to know when I break things.

Is this safe?

You should not execute things from the internets, read your scripts before executing them.

Can I contribute

Yeah why not? Feel this can be improved? Fork and send a PR. :tada:

License

MIT © Gabriel Le Breton

Docker Pull Command

docker pull gableroux/gitlab-ci-lint