Created
September 29, 2017 21:29
-
-
Save sidewinder12s/1404fedab17edfe03a0155932e1c1e62 to your computer and use it in GitHub Desktop.
GitLab CI Validate shell scripts
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
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