Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMT-3876: MMT should pull down schemas from respective cdn env #1325

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions bin/download_schemas.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
#!/bin/bash
ummJsonSchemaUrl=`jq '.ummJsonSchemaUrl' ./static.config.json`
ummJsonSchemaUrl=${ummJsonSchemaUrl//\"/}
bamboo_STAGE_NAME="sit"
stage=$bamboo_STAGE_NAME
if [ "$stage" == "prod" ]; then
stage=""
fi
if [[ "$stage" == "sit" || "$stage" == "uat" ]]; then
stage="${stage}."
fi
ummC() {
echo "Downloading ummC"
#Reads version number
schema_version=`jq '.ummVersions.ummC' ./static.config.json`
schema_version=${schema_version//\"/}
echo ummC schema version=${schema_version}
#Download
curl -L "https://cdn.earthdata.nasa.gov/umm/collection/v${schema_version}/umm-c-json-schema.json" > umm-c-json-schema-temp.json
downloadURL="https://cdn.${stage}earthdata.nasa.gov/umm/collection/v${schema_version}/umm-c-json-schema.json"
echo "download URL=${downloadURL}"
curl -L "${downloadURL}" > umm-c-json-schema-temp.json
if [ $? -ne 0 ]; then
echo "Failed downloading umm-c-json-schema.json"
exit 1
fi
jq --arg ummJsonSchemaUrl "$ummJsonSchemaUrl" '."$schema" = $ummJsonSchemaUrl' umm-c-json-schema-temp.json > umm-c-json-schema.json
curl -L "https://cdn.earthdata.nasa.gov/umm/collection/v${schema_version}/umm-cmn-json-schema.json" > umm-cmn-json-schema-temp.json
downloadURL="https://cdn.${stage}earthdata.nasa.gov/umm/collection/v${schema_version}/umm-cmn-json-schema.json"
echo "download URL=${downloadURL}"
curl -L "${downloadURL}" > umm-cmn-json-schema-temp.json
if [ $? -ne 0 ]; then
echo "Failed downloading umm-cmn-json-schema.json"
exit 1
Expand All @@ -35,7 +47,9 @@ ummS() {
schema_version=${schema_version//\"/}
echo ummS schema version=${schema_version}
#Download
curl -L "https://cdn.earthdata.nasa.gov/umm/service/v${schema_version}/umm-s-json-schema.json" > umm-s-json-schema-temp.json
downloadURL="https://cdn.${stage}earthdata.nasa.gov/umm/service/v${schema_version}/umm-s-json-schema.json"
echo "download URL=${downloadURL}"
curl -L "${downloadURL}" > umm-s-json-schema-temp.json
if [ $? -ne 0 ]; then
echo "Failed downloading umm-s-json-schema.json"
exit 1
Expand All @@ -53,7 +67,9 @@ ummV() {
schema_version=${schema_version//\"/}
echo ummV schema version=${schema_version}
#Download
curl -L "https://cdn.earthdata.nasa.gov/umm/variable/v${schema_version}/umm-var-json-schema.json" > umm-var-json-schema-temp.json
downloadURL="https://cdn.${stage}earthdata.nasa.gov/umm/variable/v${schema_version}/umm-var-json-schema.json"
echo "download URL=${downloadURL}"
curl -L "${downloadURL}" > umm-var-json-schema-temp.json
if [ $? -ne 0 ]; then
echo "Failed downloading umm-var-json-schema.json"
exit 1
Expand All @@ -71,7 +87,9 @@ ummT() {
schema_version=${schema_version//\"/}
echo ummT schema version=${schema_version}
#Download
curl -L "https://cdn.earthdata.nasa.gov/umm/tool/v${schema_version}/umm-t-json-schema.json" > umm-t-json-schema-temp.json
downloadURL="https://cdn.${stage}earthdata.nasa.gov/umm/tool/v${schema_version}/umm-t-json-schema.json"
echo "download URL=${downloadURL}"
curl -L "${downloadURL}" > umm-t-json-schema-temp.json
if [ $? -ne 0 ]; then
echo "Failed downloading umm-t-json-schema.json"
exit 1
Expand Down