Created
November 12, 2018 17:33
-
-
Save niya3/4a8ff7d55348ea44fe56de745e63970e to your computer and use it in GitHub Desktop.
Quick lint for gitlab-ci.yml file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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