Skip to content
Snippets Groups Projects
Commit 50a123e1 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/download-yajsv' into 'master'

fix: use up-to-date image and download yajsv

Closes #10

See merge request to-be-continuous/kicker!403
parents ae35eebc b24069db
No related branches found
No related tags found
No related merge requests found
variables:
YAJSV_IMAGE: "registry.hub.docker.com/amux/yajsv:latest"
YAJSV_IMAGE: "registry.hub.docker.com/badouralix/curl-jq:latest"
YAJSV_RELEASE: "https://github.com/neilpa/yajsv/releases/download/v1.4.1/yajsv.linux.amd64"
.kicker-scripts: &kicker-scripts |
set -e
......@@ -29,6 +30,16 @@ variables:
fi
}
function install_yajsv() {
export PATH=$PATH:$(pwd)
if ! command -v yajsv > /dev/null
then
log_info "Installing yajsv"
curl -sSL -o ./yajsv "${YAJSV_RELEASE}"
chmod +x ./yajsv
fi
}
# Abstract JSON schema validation job
# $JSON_FILE : the JSON file to test
# $SCHEMA_URL : the schema url
......@@ -38,9 +49,14 @@ variables:
before_script:
- !reference [.kicker-scripts]
- install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
- install_yajsv
script:
- 'wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$SCHEMA_URL" -O schema.json'
- 'curl -sSL -o schema.json -H "PRIVATE-TOKEN: $GITLAB_TOKEN" "$SCHEMA_URL"'
- yajsv -s schema.json "$JSON_FILE"
cache:
key: "$CI_COMMIT_REF_NAME-yajsv"
paths:
- ./yajsv
rules:
# enabled if kicker.json file found
- exists:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment