Skip to content

Commit 9919e1f

Browse files
committed
Merge branch 'basvandijk/fetch-images-from-cas-urls' into 'master'
rs/tests: directly fetch disk images from the content-addressed bazel cache This fetches disk images from the bazel cache available over HTTP using content-addressed URLs instead of downloading them from our CDN using commit-hash-keyed URLs. See merge request dfinity-lab/public/ic!12085
2 parents fda020e + 65948e6 commit 9919e1f

File tree

8 files changed

+71
-67
lines changed

8 files changed

+71
-67
lines changed

ic-os/boundary-guestos/envs/dev-sev/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ boundary_node_icos_build(
66
image_deps = image_deps,
77
mode = "dev",
88
sev = True,
9+
visibility = ["//visibility:public"],
910
)

ic-os/boundary-guestos/envs/dev/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ boundary_node_icos_build(
99
name = "dev",
1010
image_deps = image_deps,
1111
sev = False,
12+
visibility = ["//visibility:public"],
1213
)

ic-os/defs.bzl

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,18 @@ def icos_build(name, upload_prefix, image_deps, mode = None, malicious = False,
363363
zstd_compress(
364364
name = "update-img-test.tar.zst",
365365
srcs = [":update-img-test.tar"],
366-
# The image is pretty big, therefore it is usually much faster to just rebuild it instead of fetching from the cache.
367-
# TODO(IDX-2221): remove this when CI jobs and bazel infrastructure will run in the same clusters.
368-
tags = ["no-remote-cache"],
369366
)
370367

371368
sha256sum(
372369
name = "update-img-test.tar.zst.sha256",
373370
srcs = [":update-img-test.tar.zst"],
371+
visibility = visibility,
372+
)
373+
374+
sha256sum2url(
375+
name = "update-img-test.tar.zst.cas-url",
376+
src = ":update-img-test.tar.zst.sha256",
377+
visibility = visibility,
374378
)
375379

376380
gzip_compress(
@@ -671,14 +675,18 @@ def boundary_node_icos_build(name, image_deps, mode = None, sev = False, visibil
671675
zstd_compress(
672676
name = "disk-img.tar.zst",
673677
srcs = ["disk-img.tar"],
674-
# The image is pretty big, therefore it is usually much faster to just rebuild it instead of fetching from the cache.
675-
# TODO(IDX-2221): remove this when CI jobs and bazel infrastructure will run in the same clusters.
676-
tags = ["no-remote-cache"],
677678
)
678679

679680
sha256sum(
680681
name = "disk-img.tar.zst.sha256",
681682
srcs = [":disk-img.tar.zst"],
683+
visibility = visibility,
684+
)
685+
686+
sha256sum2url(
687+
name = "disk-img.tar.zst.cas-url",
688+
src = ":disk-img.tar.zst.sha256",
689+
visibility = visibility,
682690
)
683691

684692
gzip_compress(
@@ -710,7 +718,7 @@ def boundary_node_icos_build(name, image_deps, mode = None, sev = False, visibil
710718
":upload_disk-img",
711719
":disk-img.tar.zst.sha256",
712720
],
713-
visibility = ["//visibility:public"],
721+
visibility = visibility,
714722
tags = ["manual"],
715723
)
716724

@@ -908,14 +916,18 @@ def boundary_api_guestos_build(name, image_deps, mode = None, visibility = None)
908916
zstd_compress(
909917
name = "disk-img.tar.zst",
910918
srcs = ["disk-img.tar"],
911-
# The image is pretty big, therefore it is usually much faster to just rebuild it instead of fetching from the cache.
912-
# TODO(IDX-2221): remove this when CI jobs and bazel infrastructure will run in the same clusters.
913-
tags = ["no-remote-cache"],
914919
)
915920

916921
sha256sum(
917922
name = "disk-img.tar.zst.sha256",
918923
srcs = [":disk-img.tar.zst"],
924+
visibility = visibility,
925+
)
926+
927+
sha256sum2url(
928+
name = "disk-img.tar.zst.cas-url",
929+
src = ":disk-img.tar.zst.sha256",
930+
visibility = visibility,
919931
)
920932

921933
gzip_compress(

ic-os/guestos/envs/dev-malicious/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ icos_build(
1111
malicious = True,
1212
mode = "dev",
1313
upload_prefix = "guest-os",
14+
visibility = ["//visibility:public"],
1415
)

rs/tests/common.bzl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ MACRO_DEPENDENCIES = [
154154
]
155155

156156
GUESTOS_RUNTIME_DEPS = [
157-
"//ic-os/guestos/envs/dev:hash_and_upload_disk-img",
158-
"//ic-os/guestos/envs/dev:hash_and_upload_update-img",
157+
"//ic-os/guestos/envs/dev:disk-img.tar.zst.cas-url",
158+
"//ic-os/guestos/envs/dev:disk-img.tar.zst.sha256",
159+
"//ic-os/guestos/envs/dev:update-img.tar.zst.cas-url",
160+
"//ic-os/guestos/envs/dev:update-img.tar.zst.sha256",
159161
"//ic-os:scripts/build-bootstrap-config-image.sh",
160162
]
161163

@@ -319,19 +321,23 @@ GRAFANA_RUNTIME_DEPS = UNIVERSAL_VM_RUNTIME_DEPS + [
319321
]
320322

321323
BOUNDARY_NODE_GUESTOS_RUNTIME_DEPS = [
322-
"//ic-os/boundary-guestos/envs/dev:hash_and_upload_disk-img",
324+
"//ic-os/boundary-guestos/envs/dev:disk-img.tar.zst.cas-url",
325+
"//ic-os/boundary-guestos/envs/dev:disk-img.tar.zst.sha256",
323326
"//ic-os/boundary-guestos:scripts/build-bootstrap-config-image.sh",
324327
]
325328

326329
BOUNDARY_NODE_GUESTOS_SEV_RUNTIME_DEPS = [
327-
"//ic-os/boundary-guestos/envs/dev-sev:hash_and_upload_disk-img",
330+
"//ic-os/boundary-guestos/envs/dev-sev:disk-img.tar.zst.cas-url",
331+
"//ic-os/boundary-guestos/envs/dev-sev:disk-img.tar.zst.sha256",
328332
]
329333

330334
COUNTER_CANISTER_RUNTIME_DEPS = ["//rs/tests:src/counter.wat"]
331335

332336
GUESTOS_MALICIOUS_RUNTIME_DEPS = [
333-
"//ic-os/guestos/envs/dev-malicious:hash_and_upload_disk-img",
334-
"//ic-os/guestos/envs/dev-malicious:hash_and_upload_update-img",
337+
"//ic-os/guestos/envs/dev-malicious:disk-img.tar.zst.cas-url",
338+
"//ic-os/guestos/envs/dev-malicious:disk-img.tar.zst.sha256",
339+
"//ic-os/guestos/envs/dev-malicious:update-img.tar.zst.cas-url",
340+
"//ic-os/guestos/envs/dev-malicious:update-img.tar.zst.sha256",
335341
"//ic-os:scripts/build-bootstrap-config-image.sh",
336342
]
337343

rs/tests/consensus/orchestrator/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ STATIC_FILE_SERVER_IMAGE_RUNTIME_DEP = [
1616
"//rs/tests:static-file-server_image",
1717
]
1818

19+
GUESTOS_UPDATE_TEST_RUNTIME_DEPS = [
20+
"//ic-os/guestos/envs/dev:update-img-test.tar.zst.cas-url",
21+
"//ic-os/guestos/envs/dev:update-img-test.tar.zst.sha256",
22+
]
23+
1924
system_test(
2025
name = "downgrade_app_subnet_with_ecdsa_test",
2126
proc_macro_deps = MACRO_DEPENDENCIES,
@@ -216,6 +221,7 @@ system_test(
216221
target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS
217222
runtime_deps =
218223
GUESTOS_RUNTIME_DEPS +
224+
GUESTOS_UPDATE_TEST_RUNTIME_DEPS +
219225
UNIVERSAL_VM_RUNTIME_DEPS +
220226
NNS_CANISTER_RUNTIME_DEPS +
221227
MAINNET_REVISION_RUNTIME_DEPS,
@@ -228,6 +234,7 @@ system_test(
228234
target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS
229235
runtime_deps =
230236
GUESTOS_RUNTIME_DEPS +
237+
GUESTOS_UPDATE_TEST_RUNTIME_DEPS +
231238
UNIVERSAL_VM_RUNTIME_DEPS +
232239
NNS_CANISTER_RUNTIME_DEPS +
233240
MAINNET_REVISION_RUNTIME_DEPS,

rs/tests/src/driver/test_env_api.rs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,7 @@ impl<T: HasDependencies + HasTestEnv> HasIcDependencies for T {
836836
}
837837

838838
fn get_ic_os_img_url(&self) -> Result<Url> {
839-
let dep_rel_path =
840-
"ic-os/guestos/envs/dev/upload_disk-img_disk-img.tar.zst.proxy-cache-url";
839+
let dep_rel_path = "ic-os/guestos/envs/dev/disk-img.tar.zst.cas-url";
841840
let url = self.read_dependency_to_string(dep_rel_path)?;
842841
Ok(Url::parse(&url)?)
843842
}
@@ -850,8 +849,7 @@ impl<T: HasDependencies + HasTestEnv> HasIcDependencies for T {
850849
}
851850

852851
fn get_malicious_ic_os_img_url(&self) -> Result<Url> {
853-
let dep_rel_path =
854-
"ic-os/guestos/envs/dev-malicious/upload_disk-img_disk-img.tar.zst.proxy-cache-url";
852+
let dep_rel_path = "ic-os/guestos/envs/dev-malicious/disk-img.tar.zst.cas-url";
855853
let url = self.read_dependency_to_string(dep_rel_path)?;
856854
Ok(Url::parse(&url)?)
857855
}
@@ -864,8 +862,7 @@ impl<T: HasDependencies + HasTestEnv> HasIcDependencies for T {
864862
}
865863

866864
fn get_ic_os_update_img_url(&self) -> Result<Url> {
867-
let dep_rel_path =
868-
"ic-os/guestos/envs/dev/upload_update-img_update-img.tar.zst.proxy-cache-url";
865+
let dep_rel_path = "ic-os/guestos/envs/dev/update-img.tar.zst.cas-url";
869866
let url = self.read_dependency_to_string(dep_rel_path)?;
870867
Ok(Url::parse(&url)?)
871868
}
@@ -878,28 +875,20 @@ impl<T: HasDependencies + HasTestEnv> HasIcDependencies for T {
878875
}
879876

880877
fn get_ic_os_update_img_test_url(&self) -> Result<Url> {
881-
let dep_rel_path =
882-
"ic-os/guestos/envs/dev/upload_update-img_update-img-test.tar.zst.proxy-cache-url";
878+
let dep_rel_path = "ic-os/guestos/envs/dev/update-img-test.tar.zst.cas-url";
883879
let url = self.read_dependency_to_string(dep_rel_path)?;
884880
Ok(Url::parse(&url)?)
885881
}
886882

887883
fn get_ic_os_update_img_test_sha256(&self) -> Result<String> {
888-
let dep_rel_path =
889-
"ic-os/guestos/envs/dev/upload_update-img/update-img-test.tar.zst.SHA256SUM";
890-
let sha256 = self
891-
.read_dependency_to_string(dep_rel_path)?
892-
.split(' ')
893-
.next()
894-
.unwrap()
895-
.to_string();
896-
bail_if_sha256_invalid(&sha256, "update-img-test.tar.zst")?;
884+
let dep_rel_path = "ic-os/guestos/envs/dev/update-img-test.tar.zst.sha256";
885+
let sha256 = self.read_dependency_to_string(dep_rel_path)?;
886+
bail_if_sha256_invalid(&sha256, "ic_os_update_img_sha256")?;
897887
Ok(sha256)
898888
}
899889

900890
fn get_malicious_ic_os_update_img_url(&self) -> Result<Url> {
901-
let dep_rel_path =
902-
"ic-os/guestos/envs/dev-malicious/upload_update-img_update-img.tar.zst.proxy-cache-url";
891+
let dep_rel_path = "ic-os/guestos/envs/dev-malicious/update-img.tar.zst.cas-url";
903892
let url = self.read_dependency_to_string(dep_rel_path)?;
904893
Ok(Url::parse(&url)?)
905894
}
@@ -912,8 +901,7 @@ impl<T: HasDependencies + HasTestEnv> HasIcDependencies for T {
912901
}
913902

914903
fn get_boundary_node_snp_img_url(&self) -> Result<Url> {
915-
let dep_rel_path =
916-
"ic-os/boundary-guestos/envs/dev-sev/upload_disk-img_disk-img.tar.zst.proxy-cache-url";
904+
let dep_rel_path = "ic-os/boundary-guestos/envs/dev-sev/disk-img.tar.zst.cas-url";
917905
let result = self.read_dependency_to_string(dep_rel_path)?;
918906
Ok(Url::parse(&result)?)
919907
}
@@ -926,8 +914,7 @@ impl<T: HasDependencies + HasTestEnv> HasIcDependencies for T {
926914
}
927915

928916
fn get_boundary_node_img_url(&self) -> Result<Url> {
929-
let dep_rel_path =
930-
"ic-os/boundary-guestos/envs/dev/upload_disk-img_disk-img.tar.zst.proxy-cache-url";
917+
let dep_rel_path = "ic-os/boundary-guestos/envs/dev/disk-img.tar.zst.cas-url";
931918
let url = self.read_dependency_to_string(dep_rel_path)?;
932919
Ok(Url::parse(&url)?)
933920
}

rs/tests/src/orchestrator/upgrade_downgrade.rs

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use ic_registry_subnet_type::SubnetType;
3535
use ic_types::{Height, SubnetId};
3636
use k256::ecdsa::VerifyingKey;
3737
use slog::{info, Logger};
38-
use std::{env, time::Duration};
38+
use std::time::Duration;
3939

4040
pub const MIN_HASH_LENGTH: usize = 8; // in bytes
4141

@@ -82,12 +82,8 @@ pub fn upgrade_downgrade_app_subnet(env: TestEnv) {
8282
fn upgrade_downgrade(env: TestEnv, subnet_type: SubnetType) {
8383
let logger = env.logger();
8484

85-
// TODO: abandon the TARGET_VERSION approach once run-system-tests.py is deprecated [VER-1818]
86-
let is_bazel = env::var("TARGET_VERSION").is_err();
87-
88-
// TODO: [VER-1818]
89-
let mainnet_version = env::var("TARGET_VERSION")
90-
.or_else(|_| env.read_dependency_to_string("testnet/mainnet_nns_revision.txt"))
85+
let mainnet_version = env
86+
.read_dependency_to_string("testnet/mainnet_nns_revision.txt")
9187
.unwrap();
9288

9389
// we expect to get a hash value here, so checking that is a hash number of at least 64 bits size
@@ -144,27 +140,16 @@ fn upgrade_downgrade(env: TestEnv, subnet_type: SubnetType) {
144140
&logger,
145141
));
146142

147-
if is_bazel {
148-
let sha256 = env.get_ic_os_update_img_test_sha256().unwrap();
149-
let upgrade_url = env.get_ic_os_update_img_test_url().unwrap();
150-
block_on(bless_replica_version(
151-
&nns_node,
152-
&original_branch_version,
153-
UpdateImageType::ImageTest,
154-
&logger,
155-
&sha256,
156-
vec![upgrade_url.to_string()],
157-
));
158-
} else {
159-
// TODO: [VER-1818]
160-
block_on(bless_public_replica_version(
161-
&nns_node,
162-
&original_branch_version,
163-
UpdateImageType::ImageTest,
164-
UpdateImageType::ImageTest,
165-
&logger,
166-
));
167-
}
143+
let sha256 = env.get_ic_os_update_img_test_sha256().unwrap();
144+
let upgrade_url = env.get_ic_os_update_img_test_url().unwrap();
145+
block_on(bless_replica_version(
146+
&nns_node,
147+
&original_branch_version,
148+
UpdateImageType::ImageTest,
149+
&logger,
150+
&sha256,
151+
vec![upgrade_url.to_string()],
152+
));
168153
info!(&logger, "Blessed all versions");
169154

170155
downgrade_upgrade_roundtrip(
@@ -217,6 +202,10 @@ fn downgrade_upgrade_roundtrip(
217202
}
218203
(subnet.subnet_id, subnet_node, faulty_node, redundant_nodes)
219204
};
205+
info!(
206+
logger,
207+
"downgrade_upgrade_roundtrip: subnet_node = {:?}", subnet_node.node_id
208+
);
220209
subnet_node.await_status_is_healthy().unwrap();
221210
faulty_node.await_status_is_healthy().unwrap();
222211

0 commit comments

Comments
 (0)