Skip to content

Commit 13fbcdf

Browse files
authored
Use py_itf_test rule with select support (#177)
- Update score_itf to 44c75de and score_bazel_platforms to b72a5c3 in known_good.json and MODULE.bazel overrides - Add explicit bazel_dep on platforms 1.0.0 (required by new config_settings) - Merge the two py_itf_test targets (linux_x86_64, qnx_x86_64) in feature_integration_tests/itf/BUILD into a single 'itf' target that uses config_setting + select() to switch args/data/plugins per platform; keep backward-compatible aliases for the old target names - Upgrade rules_oci from 1.8.0 to 2.2.7; adapt docker images to use oci_load (replacing the removed oci_tarball) and add the platform-specific repo variants
1 parent f49b7f3 commit 13fbcdf

File tree

13 files changed

+311
-613
lines changed

13 files changed

+311
-613
lines changed

.github/workflows/build_and_test_linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
bazel build --lockfile_mode=error --config=linux-x86_64 //images/linux_x86_64:image
4848
- name: Integration tests
4949
run: |
50-
bazel test --lockfile_mode=error --config=linux-x86_64 //feature_integration_tests/itf:linux_x86_64
50+
bazel test --lockfile_mode=error --config=linux-x86_64 //feature_integration_tests/itf

.github/workflows/build_and_test_qnx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
bazel build --lockfile_mode=error --config qnx-x86_64 //images/qnx_x86_64:image
7474
- name: Run integration tests
7575
run: |
76-
bazel test --lockfile_mode=error --config=itf-qnx-x86_64 //feature_integration_tests/itf:qnx_x86_64
76+
bazel test --lockfile_mode=error --config=itf-qnx-x86_64 //feature_integration_tests/itf
7777
- name: Cleanup QNX license
7878
if: always()
7979
run: sudo rm -rf /opt/score_qnx

MODULE.bazel.lock

Lines changed: 182 additions & 546 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel_common/score_basic_bazel.MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13+
14+
bazel_dep(name = "platforms", version = "1.0.0")
1315
bazel_dep(name = "rules_shell", version = "0.6.0")
1416
bazel_dep(name = "rules_cc", version = "0.2.16")
1517
bazel_dep(name = "rules_pkg", version = "1.2.0")

bazel_common/score_images.MODULE.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bazel_dep(name = "rules_oci", version = "1.8.0")
1+
bazel_dep(name = "rules_oci", version = "2.2.7")
22

33
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
44
oci.pull(
@@ -15,4 +15,5 @@ oci.pull(
1515
platforms = ["linux/amd64"],
1616
tag = "stream10",
1717
)
18-
use_repo(oci, "centos_stream10", "ubuntu_22_04")
18+
use_repo(oci, "centos_stream10", "centos_stream10_linux_amd64")
19+
use_repo(oci, "ubuntu_22_04", "ubuntu_22_04_linux_amd64")

bazel_common/score_modules_tooling.MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ git_override(
2424
bazel_dep(name = "score_itf")
2525
git_override(
2626
module_name = "score_itf",
27-
commit = "e1243f3818fd78b72f79741082016fd3d7c85329",
27+
commit = "44c75debab696a9c967455110a2c32f201159cdd",
2828
remote = "https://github.com/eclipse-score/itf.git",
2929
)
3030

@@ -45,7 +45,7 @@ git_override(
4545
bazel_dep(name = "score_bazel_platforms")
4646
git_override(
4747
module_name = "score_bazel_platforms",
48-
commit = "2286de89c35d5660ad183906a6f010b33fcac8db",
48+
commit = "b72a5c3510ca423efc71fef9a93d82f974b089a4",
4949
remote = "https://github.com/eclipse-score/bazel_platforms.git",
5050
)
5151

feature_integration_tests/itf/BUILD

Lines changed: 68 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,24 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
load("@score_itf//:defs.bzl", "py_itf_test")
14-
load("@score_itf//score/itf/plugins:plugins.bzl", "dlt", "docker", "qemu")
14+
15+
config_setting(
16+
name = "config_linux_x86_64",
17+
constraint_values = [
18+
"@platforms//os:linux",
19+
"@platforms//cpu:x86_64",
20+
"@score_bazel_platforms//runtime_es:posix",
21+
],
22+
)
23+
24+
config_setting(
25+
name = "config_qnx_x86_64",
26+
constraint_values = [
27+
"@platforms//os:qnx",
28+
"@platforms//cpu:x86_64",
29+
"@score_bazel_platforms//runtime_es:posix",
30+
],
31+
)
1532

1633
filegroup(
1734
name = "all_tests",
@@ -23,48 +40,67 @@ filegroup(
2340
)
2441

2542
py_itf_test(
26-
name = "linux_x86_64",
43+
name = "itf",
2744
srcs = [
2845
":all_tests",
2946
],
30-
args = [
31-
"--dlt-config=$(location //feature_integration_tests/configs:dlt_config_x86_64.json)",
32-
"--docker-image-bootstrap=$(location //images/linux_x86_64:image_tarball)",
33-
"--docker-image=score_showcases:latest",
34-
],
35-
data = [
36-
"//feature_integration_tests/configs:dlt_config_x86_64.json",
37-
"//images/linux_x86_64:image_tarball",
38-
],
39-
plugins = [
40-
dlt,
41-
docker,
47+
args = select(
48+
{
49+
":config_linux_x86_64": [
50+
"--dlt-config=$(location //feature_integration_tests/configs:dlt_config_x86_64.json)",
51+
"--docker-image-bootstrap=$(location //images/linux_x86_64:image_load)",
52+
"--docker-image=score_showcases:latest",
53+
],
54+
":config_qnx_x86_64": [
55+
"--dlt-config=$(location //feature_integration_tests/configs:dlt_config_qnx_x86_64.json)",
56+
"--qemu-config=$(location //feature_integration_tests/configs:qemu_bridge_config.json)",
57+
"--qemu-image=$(location //images/qnx_x86_64:image)",
58+
],
59+
},
60+
no_match_error = "Unsupported platform",
61+
),
62+
data = select({
63+
":config_linux_x86_64": [
64+
"//feature_integration_tests/configs:dlt_config_x86_64.json",
65+
"//images/linux_x86_64:image_load",
66+
],
67+
":config_qnx_x86_64": [
68+
"//feature_integration_tests/configs:dlt_config_qnx_x86_64.json",
69+
"//feature_integration_tests/configs:qemu_bridge_config.json",
70+
"//images/qnx_x86_64:image",
71+
],
72+
}),
73+
plugins = select(
74+
{
75+
":config_linux_x86_64": [
76+
"@score_itf//score/itf/plugins:dlt_plugin",
77+
"@score_itf//score/itf/plugins:docker_plugin",
78+
],
79+
":config_qnx_x86_64": [
80+
"@score_itf//score/itf/plugins:dlt_plugin",
81+
"@score_itf//score/itf/plugins:qemu_plugin",
82+
],
83+
},
84+
no_match_error = "Unsupported platform",
85+
),
86+
tags = [
87+
"manual",
4288
],
89+
)
90+
91+
# Backward compatible aliases for CI jobs - these should be removed once the CI jobs are updated to use the new target names
92+
test_suite(
93+
name = "linux_x86_64",
4394
tags = [
4495
"manual",
4596
],
97+
tests = [":itf"],
4698
)
4799

48-
py_itf_test(
100+
test_suite(
49101
name = "qnx_x86_64",
50-
srcs = [
51-
":all_tests",
52-
],
53-
args = [
54-
"--dlt-config=$(location //feature_integration_tests/configs:dlt_config_qnx_x86_64.json)",
55-
"--qemu-config=$(location //feature_integration_tests/configs:qemu_bridge_config.json)",
56-
"--qemu-image=$(location //images/qnx_x86_64:image)",
57-
],
58-
data = [
59-
"//feature_integration_tests/configs:dlt_config_qnx_x86_64.json",
60-
"//feature_integration_tests/configs:qemu_bridge_config.json",
61-
"//images/qnx_x86_64:image",
62-
],
63-
plugins = [
64-
dlt,
65-
qemu,
66-
],
67102
tags = [
68103
"manual",
69104
],
105+
tests = [":itf"],
70106
)

images/autosd_x86_64/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
1+
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
22

33
# *******************************************************************************
44
# Copyright (c) 2024 Contributors to the Eclipse Foundation
@@ -27,12 +27,12 @@ rpm_package(
2727

2828
sh_binary(
2929
name = "run",
30-
srcs = ["//runners/docker_x86_64/scripts:run_docker.sh"],
30+
srcs = ["//runners/docker_x86_64/scripts:run_docker"],
3131
args = [
32-
"$(location :image_tarball)",
32+
"$(location :image_load)",
3333
],
3434
data = [
35-
":image_tarball",
35+
":image_load",
3636
],
3737
env = {
3838
"OCI_IMAGE": "score_showcases_autosd:latest",
@@ -41,14 +41,14 @@ sh_binary(
4141

4242
oci_image(
4343
name = "image",
44-
base = "@centos_stream10",
44+
base = "@centos_stream10_linux_amd64",
4545
tars = [
4646
"//showcases:showcases_pkg_tar",
4747
],
4848
)
4949

50-
oci_tarball(
51-
name = "image_tarball",
50+
oci_load(
51+
name = "image_load",
5252
image = ":image",
5353
repo_tags = ["score_showcases_autosd:latest"],
5454
visibility = [

images/linux_x86_64/BUILD

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
13+
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
1414
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1515
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
1616

1717
sh_binary(
1818
name = "run",
19-
srcs = ["//runners/docker_x86_64/scripts:run_docker.sh"],
19+
srcs = [
20+
"//runners/docker_x86_64/scripts:run_docker",
21+
],
2022
args = [
21-
"$(location :image_tarball)",
23+
"$(location :image_load)",
2224
],
2325
data = [
24-
":image_tarball",
26+
":image_load",
2527
],
2628
env = {
2729
"OCI_IMAGE": "score_showcases:latest",
@@ -47,16 +49,16 @@ pkg_tar(
4749

4850
oci_image(
4951
name = "image",
50-
base = "@ubuntu_22_04",
52+
base = "@ubuntu_22_04_linux_amd64",
5153
tars = [
5254
"//showcases:showcases_pkg_tar",
5355
":datarouter_bin_tar",
5456
":datarouter_etc_tar",
5557
],
5658
)
5759

58-
oci_tarball(
59-
name = "image_tarball",
60+
oci_load(
61+
name = "image_load",
6062
image = ":image",
6163
repo_tags = ["score_showcases:latest"],
6264
visibility = [

known_good.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
},
119119
"score_itf": {
120120
"repo": "https://github.com/eclipse-score/itf.git",
121-
"hash": "e1243f3818fd78b72f79741082016fd3d7c85329"
121+
"hash": "44c75debab696a9c967455110a2c32f201159cdd"
122122
},
123123
"score_tooling": {
124124
"repo": "https://github.com/eclipse-score/tooling.git",
@@ -130,7 +130,7 @@
130130
},
131131
"score_bazel_platforms": {
132132
"repo": "https://github.com/eclipse-score/bazel_platforms.git",
133-
"hash": "2286de89c35d5660ad183906a6f010b33fcac8db"
133+
"hash": "b72a5c3510ca423efc71fef9a93d82f974b089a4"
134134
},
135135
"score_test_scenarios": {
136136
"repo": "https://github.com/eclipse-score/testing_tools.git",

0 commit comments

Comments
 (0)