Skip to content
Snippets Groups Projects
Commit b24069db authored by Clement Bois's avatar Clement Bois
Browse files

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

parent ae35eebc
No related branches found
No related tags found
No related merge requests found
variables: 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 | .kicker-scripts: &kicker-scripts |
set -e set -e
...@@ -29,6 +30,16 @@ variables: ...@@ -29,6 +30,16 @@ variables:
fi 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 # Abstract JSON schema validation job
# $JSON_FILE : the JSON file to test # $JSON_FILE : the JSON file to test
# $SCHEMA_URL : the schema url # $SCHEMA_URL : the schema url
...@@ -38,9 +49,14 @@ variables: ...@@ -38,9 +49,14 @@ variables:
before_script: before_script:
- !reference [.kicker-scripts] - !reference [.kicker-scripts]
- install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}" - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
- install_yajsv
script: 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" - yajsv -s schema.json "$JSON_FILE"
cache:
key: "$CI_COMMIT_REF_NAME-yajsv"
paths:
- ./yajsv
rules: rules:
# enabled if kicker.json file found # enabled if kicker.json file found
- exists: - exists:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment