Skip to content

Instantly share code, notes, and snippets.

Created Aug 19, 2017
What would you like to do?
Verify Gitlab CI config (.gitlab-ci.yml) using command line

Test your CI config upon API

You need to install js-yaml-cli first :

npm install -g js-yaml-cli

Example :

> ./
{"status":"invalid","errors":["variables config should be a hash of key value pairs"]}%  
#!/usr/bin/env bash
CONTENT=$(cat .gitlab-ci.yml | yaml2json | tr -d '\n' | python -c 'import json,sys; print(json.dumps(')
curl --header "Content-Type: application/json" --data "{\"content\": $CONTENT}"
Copy link

Nice, thanks for this. I had some troubles with yaml2json and since I don't like gists, I made a repo inspired by this gist and dockerized it so it's easy to use in a ci:


Copy link

Or you could use (no additional dependencies) - I'll give it some polish at some point, but it does the trick at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment