Skip to content

Commit b41dc4e

Browse files
mnaserCopilot
andcommitted
feat: run neutron unit tests during build via tox
Add a neutron-build stage that COPYs the neutron source, runs the full unit test suite via tox, then produces a wheel. The build stage installs from the tested wheel instead of raw source, structurally forcing tests to pass before the image can be built. This follows the Debian packaging pattern where tests run as part of the build process, catching broken patches and dependency issues before the image is shipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9c03553 commit b41dc4e

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

Dockerfile

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,51 @@ WORKDIR /src
66
COPY --from=ovsinit-src / /src
77
RUN cargo install --path .
88

9+
# TODO: move all this to the venv builder image
10+
FROM ghcr.io/vexxhost/openstack-venv-builder:main@sha256:423e0a09ce69554f25fd508ceff39945fd16f01a5f2c7cfeeb9cf15a1c18ad33 AS builder
11+
WORKDIR /src
12+
ENV TOX_CONSTRAINTS_FILE=/upper-constraints.txt
13+
ONBUILD RUN uvx tox -epy3
14+
ONBUILD RUN uv build
15+
16+
FROM builder AS neutron-build
17+
COPY --from=neutron / /src
18+
19+
FROM builder AS neutron-dynamic-routing-build
20+
COPY --from=neutron-dynamic-routing / /src
21+
22+
FROM builder AS neutron-vpnaas-build
23+
COPY --from=neutron-vpnaas / /src
24+
25+
FROM builder AS networking-baremetal-build
26+
COPY --from=networking-baremetal / /src
27+
28+
FROM builder AS networking-generic-switch-build
29+
COPY --from=networking-generic-switch / /src
30+
31+
FROM builder AS neutron-policy-server-build
32+
COPY --from=neutron-policy-server / /src
33+
34+
FROM builder AS neutron-ovn-network-logging-parser-build
35+
COPY --from=neutron-ovn-network-logging-parser / /src
36+
37+
FROM builder AS tap-as-a-service-build
38+
COPY --from=tap-as-a-service / /src
39+
940
FROM ghcr.io/vexxhost/openstack-venv-builder:main@sha256:423e0a09ce69554f25fd508ceff39945fd16f01a5f2c7cfeeb9cf15a1c18ad33 AS build
1041
RUN \
11-
--mount=type=bind,from=neutron,source=/,target=/src/neutron,readwrite \
12-
--mount=type=bind,from=neutron-dynamic-routing,source=/,target=/src/neutron-dynamic-routing,readwrite \
13-
--mount=type=bind,from=neutron-vpnaas,source=/,target=/src/neutron-vpnaas,readwrite \
14-
--mount=type=bind,from=networking-baremetal,source=/,target=/src/networking-baremetal,readwrite \
15-
--mount=type=bind,from=networking-generic-switch,source=/,target=/src/networking-generic-switch,readwrite \
16-
--mount=type=bind,from=neutron-policy-server,source=/,target=/src/neutron-policy-server,readwrite \
17-
--mount=type=bind,from=neutron-ovn-network-logging-parser,source=/,target=/src/neutron-ovn-network-logging-parser,readwrite \
18-
--mount=type=bind,from=tap-as-a-service,source=/,target=/src/tap-as-a-service,readwrite <<EOF bash -xe
42+
--mount=type=bind,from=neutron-build,source=/src/dist,target=/build/neutron \
43+
--mount=type=bind,from=neutron-dynamic-routing-build,source=/src/dist,target=/build/neutron-dynamic-routing \
44+
--mount=type=bind,from=neutron-vpnaas-build,source=/src/dist,target=/build/neutron-vpnaas \
45+
--mount=type=bind,from=networking-baremetal-build,source=/src/dist,target=/build/networking-baremetal \
46+
--mount=type=bind,from=networking-generic-switch-build,source=/src/dist,target=/build/networking-generic-switch \
47+
--mount=type=bind,from=neutron-policy-server-build,source=/src/dist,target=/build/neutron-policy-server \
48+
--mount=type=bind,from=neutron-ovn-network-logging-parser-build,source=/src/dist,target=/build/neutron-ovn-network-logging-parser \
49+
--mount=type=bind,from=tap-as-a-service-build,source=/src/dist,target=/build/tap-as-a-service <<EOF bash -xe
1950
uv pip install \
20-
--constraint /upper-constraints.txt \
21-
/src/neutron \
22-
/src/neutron-dynamic-routing \
23-
/src/neutron-vpnaas \
24-
/src/networking-baremetal \
25-
/src/networking-generic-switch \
26-
/src/neutron-policy-server \
27-
/src/neutron-ovn-network-logging-parser \
28-
/src/tap-as-a-service \
29-
pymemcache
51+
--constraint /upper-constraints.txt \
52+
/build/*/*.whl \
53+
pymemcache
3054
EOF
3155

3256
FROM ghcr.io/vexxhost/python-base:main@sha256:df0f7c05b006fbfa355077571a42745b36e610e674c8ca77f5ac8de2e0fd0fba

0 commit comments

Comments
 (0)