Skip to content

Commit

Permalink
Fix dependency checking tool
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Apr 17, 2024
1 parent 31a9b09 commit 479e8f9
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions scripts/check-dependencies.bash
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,36 @@ fi
# Now, lets make sure that the core and captive core version used in the tests use the same version and that they depend
# on the same XDR revision

# TODO: The sed extractions below won't work when the commit is not included in the Core image tag/debian packages version
CORE_CONTAINER_REVISION=$($SED -n 's/.*\/\(stellar-core\|unsafe-stellar-core\(-next\)\{0,1\}\)\:.*\.\([a-zA-Z0-9]*\)\..*/\3/p' < cmd/soroban-rpc/internal/test/docker-compose.yml)
CAPTIVE_CORE_PKG_REVISION=$($SED -n 's/.*DEBIAN_PKG_VERSION:..*\.\([a-zA-Z0-9]*\)\..*/\1/p' < .github/workflows/soroban-rpc.yml)

if [ "$CORE_CONTAINER_REVISION" != "$CAPTIVE_CORE_PKG_REVISION" ]; then
echo "Soroban RPC integration tests are using different versions of the Core container and Captive Core Debian package."
echo
echo "Core container image commit $CORE_CONTAINER_REVISION"
echo "Captive core debian package commit $CAPTIVE_CORE_PKG_REVISION"
exit 1
fi

# Revision of https://github.com/stellar/rs-stellar-xdr by Core.
# We obtain it from src/rust/src/host-dep-tree-curr.txt but Alternatively/in addition we could:
# * Check the rs-stellar-xdr revision of host-dep-tree-prev.txt
# * Check the stellar-xdr revision
CORE_HOST_DEP_TREE_CURR=$($CURL https://raw.githubusercontent.com/stellar/stellar-core/${CORE_CONTAINER_REVISION}/src/rust/src/host-dep-tree-curr.txt)


RS_STELLAR_XDR_REVISION_FROM_CORE=$(echo "$CORE_HOST_DEP_TREE_CURR" | stellar_xdr_version_from_rust_dep_tree)
if [ "$RS_STELLAR_XDR_REVISION" != "$RS_STELLAR_XDR_REVISION_FROM_CORE" ]; then
echo "The Core revision used in integration tests (${CORE_CONTAINER_REVISION}) uses a different revision of https://github.com/stellar/rs-stellar-xdr"
echo
echo "Current repository's revision $RS_STELLAR_XDR_REVISION"
echo "Core's revision $RS_STELLAR_XDR_REVISION_FROM_CORE"
exit 1
fi
PROTOCOL_VERSIONS=$(grep 'protocol-version: ' .github/workflows/soroban-rpc.yml | grep -o -E '[0-9]+')

for P in $PROTOCOL_VERSIONS; do
CORE_CONTAINER_REVISION=$($SED -n 's/.*PROTOCOL_'$P'_CORE_DOCKER_IMG:.*\/\(stellar-core\|unsafe-stellar-core\(-next\)\{0,1\}\)\:.*\.\([a-zA-Z0-9]*\)\..*/\3/p' < .github/workflows/soroban-rpc.yml)
CAPTIVE_CORE_PKG_REVISION=$($SED -n 's/.*PROTOCOL_'$P'_CORE_DEBIAN_PKG_VERSION:.*\.\([a-zA-Z0-9]*\)\..*/\1/p' < .github/workflows/soroban-rpc.yml)

if [ "$CORE_CONTAINER_REVISION" != "$CAPTIVE_CORE_PKG_REVISION" ]; then
echo "Soroban RPC protocol $P integration tests are using different versions of the Core container and Captive Core Debian package."
echo
echo "Core container image commit $CORE_CONTAINER_REVISION"
echo "Captive core debian package commit $CAPTIVE_CORE_PKG_REVISION"
exit 1
fi

# Revision of https://github.com/stellar/rs-stellar-xdr by Core.
# We obtain it from src/rust/src/host-dep-tree-curr.txt but Alternatively/in addition we could:
# * Check the rs-stellar-xdr revision of host-dep-tree-prev.txt
# * Check the stellar-xdr revision
CORE_HOST_DEP_TREE_CURR=$($CURL https://raw.githubusercontent.com/stellar/stellar-core/${CORE_CONTAINER_REVISION}/src/rust/src/host-dep-tree-curr.txt)


RS_STELLAR_XDR_REVISION_FROM_CORE=$(echo "$CORE_HOST_DEP_TREE_CURR" | stellar_xdr_version_from_rust_dep_tree)
if [ "$RS_STELLAR_XDR_REVISION" != "$RS_STELLAR_XDR_REVISION_FROM_CORE" ]; then
echo "The Core revision used in protocol $P integration tests (${CORE_CONTAINER_REVISION}) uses a different revision of https://github.com/stellar/rs-stellar-xdr"
echo
echo "Current repository's revision $RS_STELLAR_XDR_REVISION"
echo "Core's revision $RS_STELLAR_XDR_REVISION_FROM_CORE"
exit 1
fi
done



0 comments on commit 479e8f9

Please sign in to comment.