Skip to content

Commit

Permalink
fix(build): Use semver version in docker version tag (#2065)
Browse files Browse the repository at this point in the history
Please provide a paragraph or two giving a summary of the change,
including relevant motivation and context.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
  • Loading branch information
PhilWindle authored Sep 6, 2023
1 parent 725b550 commit b3db0d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions build-system/scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ if [[ -n "$COMMIT_TAG" ]]; then
VERSION=$(npx semver $COMMIT_TAG_VERSION)
if [ -z "$VERSION" ]; then
COMMIT_TAG_VERSION=""
else
COMMIT_TAG_VERSION=$VERSION
fi
else
COMMIT_TAG_VERSION=""
Expand Down
5 changes: 2 additions & 3 deletions yarn-project/aztec-cli/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function createCompatibleClient(rpcUrl: string, logger: DebugLogger
const expectedVersionRange = packageJsonContents.version; // During sandbox, we'll expect exact matches

try {
await checkServerVersion(client, expectedVersionRange, logger);
await checkServerVersion(client, expectedVersionRange);
} catch (err) {
if (err instanceof VersionMismatchError) {
logger.debug(err.message);
Expand All @@ -53,14 +53,13 @@ class VersionMismatchError extends Error {}
* @param rpc - RPC server connection.
* @param expectedVersionRange - Expected version by CLI.
*/
export async function checkServerVersion(rpc: AztecRPC, expectedVersionRange: string, logger?: DebugLogger) {
export async function checkServerVersion(rpc: AztecRPC, expectedVersionRange: string) {
const serverName = 'Aztec Sandbox';
const { client } = await rpc.getNodeInfo();
if (!client) {
throw new VersionMismatchError(`Couldn't determine ${serverName} version. You may run into issues.`);
}
const version = client.split('@')[1];
logger?.warn(`Comparing server version ${version} against CLI expected ${expectedVersionRange}`);
if (!version || !valid(version)) {
throw new VersionMismatchError(`Missing or invalid version identifier for ${serverName} (${version ?? 'empty'}).`);
} else if (!satisfies(version, expectedVersionRange)) {
Expand Down

0 comments on commit b3db0d0

Please sign in to comment.