Skip to content

Instantly share code, notes, and snippets.

@niya3
Created November 12, 2018 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niya3/4a8ff7d55348ea44fe56de745e63970e to your computer and use it in GitHub Desktop.
Save niya3/4a8ff7d55348ea44fe56de745e63970e to your computer and use it in GitHub Desktop.
Quick lint for gitlab-ci.yml file
#!/usr/bin/env python3
import gitlab
import sys
g = gitlab.Gitlab(url='https://gitlab.com', ssl_verify=False)
try:
with open('.gitlab-ci.yml', 'r') as gitlabci:
content = gitlabci.read()
except FileNotFoundError:
exit(0)
resp = g.lint(content=content)
if not resp[0]:
print('GitLab CI: Lint error!')
print(resp[1])
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment