Skip to content

Instantly share code, notes, and snippets.

@sidewinder12s
Created September 29, 2017 21:29
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 sidewinder12s/1404fedab17edfe03a0155932e1c1e62 to your computer and use it in GitHub Desktop.
Save sidewinder12s/1404fedab17edfe03a0155932e1c1e62 to your computer and use it in GitHub Desktop.
GitLab CI Validate shell scripts
function gitlab-ci-validate(){
DATA=$(jq.node -r js-yaml -x 'jsYaml.safeLoad | thru(x => (JSON.stringify({content: JSON.stringify(x)})))' < .gitlab-ci.yml)
curl -s --header "Content-Type: application/json" https://gitlab.com/api/v4/ci/lint --data $DATA | jq.node
}
function gitlab-ci-validate-watch(){
watchexec --watch $(pwd)/.gitlab-ci.yml 'zsh -c "source ~/.zshrc && gitlab-ci-validate"'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment