Skip to content

Commit

Permalink
refactor(provider/init): simplify provider info test (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy108369 authored Feb 19, 2024
1 parent dc8513c commit caff836
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/akash-provider/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type: application
# Versions are expected to follow Semantic Versioning (https://semver.org/)

# Major version bit highlights the mainnet release (e.g. mainnet4 = 4.x.x, mainnet5 = 5.x.x, ...)
version: 8.0.2
version: 8.0.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
11 changes: 6 additions & 5 deletions charts/akash-provider/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ if [[ $? -ne 0 ]]; then
fi

echo "Checking whether provider.yaml needs to be updated on the chain ..."
REMOTE_PROVIDER="$(provider-services query provider get $PROVIDER_ADDRESS -o json | jq | sha1sum | awk '{print $1}')"
LOCAL_PROVIDER="$(provider-services tx provider update provider.yaml --offline --generate-only --from $PROVIDER_ADDRESS | jq -r '.body.messages[]' | jq -r 'del(."@type")' | sha1sum | awk '{print $1}')"
if [[ "$REMOTE_PROVIDER" != "$LOCAL_PROVIDER" ]]; then
echo "Updating provider in the blockchain ..."
provider-services tx provider update provider.yaml
diff --color -Nur <(cat provider.yaml | awk '/attributes:/{print;flag=1;next}/^ - key:/{if(flag)sub(" ","");print;next}flag&&/^ /{sub(" "," ");print;next}{flag=0;print}' | sort) <(provider-services query provider get $PROVIDER_ADDRESS -o text | sed -e 's/"//g' -e 's/host_uri:/host:/g' | sort)
rc=$?
if [[ $rc -ne 0 ]]; then
echo "Updating provider info in the blockchain in 10 seconds ..."
sleep 10s
echo provider-services tx provider update provider.yaml
fi

CERT_SYMLINK="${AKASH_HOME}/${PROVIDER_ADDRESS}.pem"
Expand Down

0 comments on commit caff836

Please sign in to comment.