Skip to content

Commit

Permalink
Use noble test containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Bownairo committed Oct 3, 2024
1 parent c218ce8 commit 0cabf9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 137 deletions.
21 changes: 0 additions & 21 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ distroless_register_toolchains()

load("@rules_distroless//apt:index.bzl", "deb_index")

# Packageset based on an Ubuntu focal snapshot, see manifest file
# for details
# To update, comment out the `lock` field below and run:
# bazel run @focal//:lock
deb_index(
name = "focal",
lock = "//bazel:focal.lock.json",
manifest = "//bazel:focal.yaml",
)

load("@focal//:packages.bzl", "focal_packages")

focal_packages()

# Packageset based on an Ubuntu noble snapshot, see manifest file
# for details
# To update, comment out the `lock` field below and run:
Expand Down Expand Up @@ -150,13 +136,6 @@ oci_pull(
# used in various places as base
oci_pull(
name = "ubuntu_base",
image = "docker.io/library/ubuntu@sha256:965fbcae990b0467ed5657caceaec165018ef44a4d2d46c7cdea80a9dff0d1ea",
platforms = ["linux/amd64"],
)

# used in various places as base
oci_pull(
name = "ubuntu_noble_base",
image = "docker.io/library/ubuntu@sha256:77d57fd89366f7d16615794a5b53e124d742404e20f035c22032233f1826bd6a",
platforms = ["linux/amd64"],
)
Expand Down
132 changes: 16 additions & 116 deletions rs/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,42 @@ rust_library(
# Packages we install into the image; see base image definition and its
# 'manifest = ...' field for more information
PACKAGES = [
"@focal//ca-certificates/amd64",
"@focal//bash/amd64",
"@focal//coreutils/amd64",
"@focal//gawk/amd64",
"@focal//dosfstools/amd64",
"@focal//libssl1.1/amd64",
"@focal//libunwind8/amd64",
"@focal//mtools/amd64",
"@focal//openssh-client/amd64",
"@focal//rsync/amd64",
"@focal//gzip/amd64",
"@focal//zstd/amd64",
"@noble//bash/amd64",
"@noble//ca-certificates/amd64",
"@noble//coreutils/amd64",
"@noble//dosfstools/amd64",
"@noble//gawk/amd64",
"@noble//gzip/amd64",
"@noble//libssl3t64/amd64",
"@noble//libunwind8/amd64",
"@noble//mtools/amd64",
"@noble//openssh-client/amd64",
"@noble//rsync/amd64",
"@noble//tar/amd64",
"@noble//zstd/amd64",
]

tar(
name = "sh",
mtree = [
# needed as dpkg assumes sh is installed in a typical debian installation.
"./bin/sh type=link link=/bin/bash",
"./usr/bin/sh type=link link=/bin/bash",
],
)

tar(
name = "mkfsvfat",
mtree = [
# symlink instead of updating the PATH
"./bin/mkfs.vfat type=link link=/sbin/mkfs.vfat",
"./usr/bin/mkfs.vfat type=link link=/sbin/mkfs.vfat",
],
)

tar(
name = "awk",
mtree = [
# we install the GNU variant but call 'awk' so we symlink
"./bin/awk type=link link=/usr/bin/gawk",
"./usr/bin/awk type=link link=/usr/bin/gawk",
],
)

Expand Down Expand Up @@ -143,107 +144,6 @@ uvm_config_image(
tags = ["manual"], # this target will be built if required as a dependency of another target
)

# Packages we install into the image; see base image definition and its
# 'manifest = ...' field for more information
PACKAGES_NOBLE = [
"@noble//bash/amd64",
"@noble//ca-certificates/amd64",
"@noble//coreutils/amd64",
"@noble//dosfstools/amd64",
"@noble//gawk/amd64",
"@noble//gzip/amd64",
"@noble//libssl3t64/amd64",
"@noble//libunwind8/amd64",
"@noble//mtools/amd64",
"@noble//openssh-client/amd64",
"@noble//rsync/amd64",
"@noble//tar/amd64",
"@noble//zstd/amd64",
]

tar(
name = "sh_noble",
mtree = [
# needed as dpkg assumes sh is installed in a typical debian installation.
"./usr/bin/sh type=link link=/bin/bash",
],
)

tar(
name = "mkfsvfat_noble",
mtree = [
# symlink instead of updating the PATH
"./usr/bin/mkfs.vfat type=link link=/sbin/mkfs.vfat",
],
)

tar(
name = "awk_noble",
mtree = [
# we install the GNU variant but call 'awk' so we symlink
"./usr/bin/awk type=link link=/usr/bin/gawk",
],
)

# Creates /var/lib/dpkg/status with installed package information.
dpkg_status(
name = "dpkg_status_noble",
controls = [
"%s:control" % package
for package in PACKAGES_NOBLE
],
)

passwd(
name = "passwd_noble",
entries = [
dict(
gecos = ["root"],
gid = 0,
home = "/root",
shell = "/usr/bin/bash",
uid = 0,
username = "root",
),
],
)

oci_image(
name = "ubuntu_noble_test_runtime_image_src",
architecture = "amd64",
os = "linux",
target_compatible_with = [
"@platforms//os:linux",
],
tars = [
":dpkg_status_noble",
":passwd_noble", # needed because we ssh in

# symlinks
":awk_noble",
":mkfsvfat_noble",
":sh_noble",
] + PACKAGES_NOBLE,
)

oci_tar(
name = "ubuntu_noble_test_runtime.tar",
image = ":ubuntu_noble_test_runtime_image_src",
repo_tags = ["ubuntu_noble_test_runtime:image"],
)

uvm_config_image(
name = "colocate_uvm_noble_config_image",
srcs = [
":ubuntu_noble_test_runtime.tar",
"//rs/tests:activate-systest-uvm-config",
],
remap_paths = {
"activate-systest-uvm-config": "activate",
},
tags = ["manual"], # this target will be built if required as a dependency of another target
)

rust_test(
name = "tests_test",
aliases = ALIASES,
Expand Down

0 comments on commit 0cabf9a

Please sign in to comment.