From fec1ddc4cac307bed6c37b95482f851ae39814b3 Mon Sep 17 00:00:00 2001 From: Marcin Nowak-Liebiediew Date: Tue, 29 Aug 2023 16:50:13 +0200 Subject: [PATCH 1/3] fix(extension): update tarball filename format (#3307) --- scripts/workflows/e2e-matrix.py | 2 +- src/dfx-core/src/extension/manager/install.rs | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/workflows/e2e-matrix.py b/scripts/workflows/e2e-matrix.py index c8d683bc8c..80a42cc5bb 100755 --- a/scripts/workflows/e2e-matrix.py +++ b/scripts/workflows/e2e-matrix.py @@ -16,7 +16,7 @@ def test_scripts(prefix): matrix = { "test": test, "backend": ["replica"], - "os": ["macos-12", "ubuntu-20.04"], + "os": ["macos-12", "ubuntu-22.04"], "exclude": [ {"backend": "ic-ref", "test": "dfx/bitcoin"}, {"backend": "ic-ref", "test": "dfx/canister_http"}, diff --git a/src/dfx-core/src/extension/manager/install.rs b/src/dfx-core/src/extension/manager/install.rs index 6c8a857cca..11d48c1716 100644 --- a/src/dfx-core/src/extension/manager/install.rs +++ b/src/dfx-core/src/extension/manager/install.rs @@ -31,7 +31,7 @@ impl ExtensionManager { let extension_version = self.get_extension_compatible_version(extension_name)?; let github_release_tag = get_git_release_tag(extension_name, &extension_version); - let extension_archive = get_extension_archive_name(extension_name, &extension_version)?; + let extension_archive = get_extension_archive_name(extension_name)?; let url = get_extension_download_url(&github_release_tag, &extension_archive)?; let temp_dir = self.download_and_unpack_extension_to_tempdir(url)?; @@ -132,12 +132,9 @@ fn get_git_release_tag(extension_name: &str, extension_verion: &Version) -> Stri format!("{extension_name}-v{extension_verion}",) } -fn get_extension_archive_name( - extension_name: &str, - extension_version: &Version, -) -> Result { +fn get_extension_archive_name(extension_name: &str) -> Result { Ok(format!( - "{extension_name}-v{extension_version}-{arch}-{platform}", + "{extension_name}-{arch}-{platform}", platform = match std::env::consts::OS { "linux" => "unknown-linux-gnu", "macos" => "apple-darwin", From 1df8773aa79f1b5cc2d6fadb8ba0d0e5fd250091 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Tue, 29 Aug 2023 14:17:36 -0700 Subject: [PATCH 2/3] fix: dfx deploy urls printed for asset canisters (#3338) * fix: dfx deploy urls printed for asset canisters * adds e2e tests --- CHANGELOG.md | 2 ++ e2e/tests-dfx/deploy.bash | 25 +++++++++++++++++++++++++ src/dfx/src/commands/deploy.rs | 5 ++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb837c06a2..c1e9125021 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # UNRELEASED +### fix: dfx deploy urls printed for asset canisters + ### chore: --emulator parameter is deprecated and will be discontinued soon Added warning that the `--emulator` is deprecated and will be discontinued soon. diff --git a/e2e/tests-dfx/deploy.bash b/e2e/tests-dfx/deploy.bash index 4e1bb9f198..b8ac6692f1 100644 --- a/e2e/tests-dfx/deploy.bash +++ b/e2e/tests-dfx/deploy.bash @@ -119,3 +119,28 @@ teardown() { ONCHAIN_HASH="$(dfx canister info hello_backend | tail -n 1 | cut -d " " -f 3)" assert_eq "$BUILD_HASH" "$ONCHAIN_HASH" } + +@test "prints the frontend url after deploy" { + dfx_new_frontend hello + dfx_start + assert_command dfx deploy + assert_contains "hello_frontend: http://127.0.0.1" +} + +@test "prints the frontend url if 'frontend' section is not present in dfx.json" { + dfx_new_frontend hello + jq 'del(.canisters.hello_frontend.frontend)' dfx.json | sponge dfx.json + dfx_start + assert_command dfx deploy + assert_contains "hello_frontend: http://127.0.0.1" +} + +@test "prints the frontend url if the frontend section has been removed after initial deployment" { + dfx_new_frontend hello + dfx_start + assert_command dfx deploy + assert_contains "hello_frontend: http://127.0.0.1" + jq 'del(.canisters.hello_frontend.frontend)' dfx.json | sponge dfx.json + assert_command dfx deploy + assert_contains "hello_frontend: http://127.0.0.1" +} diff --git a/src/dfx/src/commands/deploy.rs b/src/dfx/src/commands/deploy.rs index eb1a308222..7a429dcd85 100644 --- a/src/dfx/src/commands/deploy.rs +++ b/src/dfx/src/commands/deploy.rs @@ -209,7 +209,10 @@ fn display_urls(env: &dyn Environment) -> DfxResult { if let Some(canister_id) = canister_id { let canister_info = CanisterInfo::load(&config, canister_name, Some(canister_id))?; - if canister_config.frontend.is_some() { + // If the canister is an assets canister or has a frontend section, we can display a frontend url. + let is_assets = canister_info.is_assets() || canister_config.frontend.is_some(); + + if is_assets { let url = construct_frontend_url(network, &canister_id)?; frontend_urls.insert(canister_name, url); } From f227ac05ea3b2c7f6d10025ee255e222b34b6e3e Mon Sep 17 00:00:00 2001 From: Marcin Nowak-Liebiediew Date: Wed, 30 Aug 2023 02:20:36 +0200 Subject: [PATCH 3/3] fix: revert e2e runner from ubuntu-22.04 back to -20.04 (#3339) --- scripts/workflows/e2e-matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/workflows/e2e-matrix.py b/scripts/workflows/e2e-matrix.py index 80a42cc5bb..c8d683bc8c 100755 --- a/scripts/workflows/e2e-matrix.py +++ b/scripts/workflows/e2e-matrix.py @@ -16,7 +16,7 @@ def test_scripts(prefix): matrix = { "test": test, "backend": ["replica"], - "os": ["macos-12", "ubuntu-22.04"], + "os": ["macos-12", "ubuntu-20.04"], "exclude": [ {"backend": "ic-ref", "test": "dfx/bitcoin"}, {"backend": "ic-ref", "test": "dfx/canister_http"},