Skip to content

Commit

Permalink
and more jq fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Feb 19, 2021
1 parent 1f98d41 commit bca197e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ aws s3 ls &> /dev/null \
echo "[x] AWS credentials"

# TODO: do this in CUE
artifacts="$(cue export --out json ./artifacts.cue || echo '{}')"
artifacts="$(cue export --out json ./artifacts.cue || echo '{"artifacts": {}}')"

artifacts="$(
echo "$artifacts" \
| jq \
--arg n "$NOMAD_NAMESPACE" \
--arg u "s3::https://s3-eu-central-1.amazonaws.com/iohk-vit-artifacts/$NOMAD_NAMESPACE/block0.bin" \
--arg h "sha256:$(sha256sum block0.bin | awk '{ print $1 }')" \
'.[$n].block0 = { "url": $u, "checksum": $h }'
'.artifacts[$n].block0 = { "url": $u, "checksum": $h }'
)"

artifacts="$(
Expand All @@ -100,7 +100,7 @@ artifacts="$(
--arg n "$NOMAD_NAMESPACE" \
--arg u "s3::https://s3-eu-central-1.amazonaws.com/iohk-vit-artifacts/$NOMAD_NAMESPACE/database.sqlite3" \
--arg h "sha256:$(sha256sum database.sqlite3 | awk '{ print $1 }')" \
'.[$n].database = { "url": $u, "checksum": $h }'
'.artifacts[$n].database = { "url": $u, "checksum": $h }'
)"

echo "$artifacts" | cue import -p bitte json: - > artifacts.cue
Expand Down

0 comments on commit bca197e

Please sign in to comment.