-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run build and tests directly on Ubuntu 20.04, 22.04 without docker #3770
Run build and tests directly on Ubuntu 20.04, 22.04 without docker #3770
Conversation
https://github.com/p4lang/third-party/blob/main/Dockerfile contains most of the dependencies. You will also have to install protobuf, thrift, grpc, nanomsg etc. I am not sure if the bmv2 package provides these. But with newer versions they can easily be installed using debian. |
probably they are installed as building works fine on Ubuntu 22. |
but ptf is missing. So lets switch to ubuntu only for normal tests, default to existing base image. |
Isn't this install just pip3 install --user ptf? |
I think it is also fine to just test the build for Ubuntu 18.04 and not run tests since there are limited guarantees. |
I was able to run them so it would be great to keep them for some time. If p4c project after April 2023 decides to drop this CI support for U18 with reasonable reasons, I am fine with that. |
ir/ir-inline.h
Outdated
@@ -269,7 +269,7 @@ void IR::NameMap<T, MAP, COMP, ALLOC>::visit_children(Visitor& v) { | |||
namemap_insert_helper(i, cstring(obj_name(s)), std::move(s), symbols, new_symbols); | |||
i = symbols.erase(i); | |||
} | |||
} else { | |||
} else if (n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new gcc (false positive) warnings..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that n maybe be null pointer (not really, sanitizers would catch it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the if checks, we should use a BUG_CHECK here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But does not happen in practice as sanitizers would catch for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, only if we have written the appropriate tests/P4-programs. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should open a separate pull request with these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think we need another PR as this PR enables more testing, especially on Ubuntu 22, where we have newer GCC which emits more warnings. Seems OK to me to have such fixes in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests now fail - expected?
Sorry but I would really prefer first version of these changes (my) as your changes seems to break existing tests and I am not going to debug them.
These are listed as dependencies for the bmv2 package. |
.github/workflows/ci-test.yml
Outdated
|
||
- name: Build (Ubuntu 22.04, GCC) | ||
run: | | ||
docker build -t p4c --build-arg UBUNTU_VERSION=22.04 --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=ON . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you even need the docker image at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, good point, probably not.
|
||
# we want to use Python as the default so change the symlinks | ||
ln -sf /usr/bin/python3 /usr/bin/python | ||
ln -sf /usr/bin/pip3 /usr/bin/pip | ||
|
||
pip3 install --upgrade pip | ||
pip3 install wheel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wheel
might not be needed anymore.
ir/ir-inline.h
Outdated
@@ -269,7 +269,7 @@ void IR::NameMap<T, MAP, COMP, ALLOC>::visit_children(Visitor& v) { | |||
namemap_insert_helper(i, cstring(obj_name(s)), std::move(s), symbols, new_symbols); | |||
i = symbols.erase(i); | |||
} | |||
} else { | |||
} else if (n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the warning?
FROM p4lang/behavioral-model:latest | ||
ARG UBUNTU_VERSION=20.04 | ||
ARG BASE_IMAGE=ubuntu:${UBUNTU_VERSION} | ||
FROM ${BASE_IMAGE} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to keep p4lang/behavioral-model:latest
as default base image.
This Dockerfile is used to automatically build and publish the p4c container image in Docker Hub and this container image is being used in other projects (e.g., p4app).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could keep this docker file for the release build. With David's new setup we might not need a docker file at all for the p4c image.
run: | | ||
docker build -t p4c --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=ON --build-arg COMPILE_WITH_CLANG=ON \ | ||
--build-arg BUILD_AUTO_VAR_INIT_PATTERN=ON --build-arg ENABLE_SANITIZERS=ON . | ||
docker build -t p4c --build-arg BASE_IMAGE=ubuntu:18.04 --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=ON . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be updated to use Ubuntu 18.04 directly. Also other images such as the tools test should not use docker anymore then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no Ubuntu 18.04 image for github actions. So nope, not possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we do not modify the base image right now so this will test on the Ubuntu 20.04 docker image as far as I can see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also other images such as the tools test should not use docker anymore then.
Sorry but for now I am not gonna do everything. We can move it incrementally.
The issue is that the new ci-build configuration seems to break the ccache that has been set up for the docker build process. As far as I can tell, the builds are taking longer now. We can check this by completing one build and rerunning to see whether the build is cached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build on Ubuntu 22 - 6m 14s.
Seems pretty OK to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is the other tests, static-build-test-p4c, test-tools, ptf-ebpf, validate etc.
I can convert them but then we would stop testing with Dockerfile so it can slowly bitrot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but this PR is breaking the ccache setup for all other tests.
How? Could you explain it?
Docker builds uses export_ccache.sh which runs
docker cp $(docker create --rm p4c):/p4c/.ccache .
, non-docker runs
sudo cp -rf /p4c/.ccache .
I pushed empty commit to see if regressions are real.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is the other tests, static-build-test-p4c, test-tools, ptf-ebpf, validate etc.
I can convert them but then we would stop testing with Dockerfile so it can slowly bitrot.
We can either convert them or have a workaround. As Radostin mentioned we need to create one docker build either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, test-tools will now be the slowest test because the build alone takes 55 minutes.
ccache is working fine, rebuild time: 7m 25s
https://github.com/p4lang/p4c/actions/runs/3697344554/jobs/6262220551
./tools/export_ccache.sh | ||
sudo cp -rf . /p4c/ | ||
(cd /p4c/ && sudo -E tools/ci-build.sh) | ||
sudo cp -rf /p4c/.ccache . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the cp
commands should not be necessary to get ccache to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ci-build.sh uses /p4c/
We would be more flexible after we drop docker, but for now, things needs to be done this way, probably.
I will think about it but probably I would leave it for followup, as this change is quite huge anyway.
Based on new runs, I believe ccache is working fine, rebuild times are short. |
CI also significatly faster. for example sanitizers 120min -> 71 min. My assumption is that CTEST_PARALLEL_LEVEL was not handled correctly (when you run something with sudo you lose env vars, you need to use -E switch) |
Ok, done |
Looks good. The question is what we do with the docker build process that publishes builds to dockerhub. Have a nightly test run? |
Or we can preserve testing with docker on U20. I dont know.. |
@rst0git any thoughts on this? |
With the following change, when -FROM p4lang/behavioral-model:latest
+ARG BASE_IMAGE=p4lang/behavioral-model:latest
+FROM ${BASE_IMAGE} I think with these changes the CI workflow updating the container image in Dockerhub should continue to work as expected. |
It'd be nice if we ran tests on this release build. This way we can make sure the docker build does not rot. |
@antoninbas @mbudiu-vmw This PR would remove the docker third-party build from most of the tests. Any further concerns? |
no concern from me, but then I am not the one maintaining this |
If something with the container image ever breaks, we can introduce the necessary tests. |
I am not maintaining this either |
Yes, exactly. |
@fruffy is it ok for you? |
I would be happy to be a maintainer. |
No description provided.