-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add docker action #478
base: master
Are you sure you want to change the base?
Add docker action #478
Conversation
neat! for one, it seems this means, we need to create/manage an "official" vzlogger docker channel now...? for another,
(the latter two don't seem to be possible on github in any sane way, as there's no way to specify inputs. (at work we trigger PR builds on explicit request only, due to their size, and those requests take parameters) it already happens that i push a commit, the pipeline starts, but then i notice a typo in a commit message or comment, push a fix, and the next pipeline starts before the previous one even finishes. |
There is already a docker account for mbmd and volkszaheler.org https://hub.docker.com/u/volkszaehler. I think having vzlogger also there would be nice. Currently the dockerbuild does not run tests, see Line 37 in 4341981
I will try to setup the build as you suggested. |
@andig: |
@StefanSchoof: |
I just took the make command from the install.sh. I tested a docker build with tests. It works, but the runtime grow to 54 mins (https://github.com/StefanSchoof/vzlogger/runs/2251902640?check_suite_focus=true). Should we run the test on every platform? There is not cross-compilation used. It used a qemu code behind many levels (docker buildx builder, linux bmf, qemu libs). This is also the reason, why this is so slow. |
Moin Zusammen, das ist eine wahnsinnige Ressourcenverschwendung. Vorschlag:
|
@r00t- it's a Docker org. I would suggest to add you to the org (docker user?) and setup committer access for libsml and this repo? |
vzlogger solltest Du schon haben! |
Nur noch armd64 und armv6 ohne Test reduziert die build time auf 15 min: https://github.com/StefanSchoof/vzlogger/runs/2252885724?check_suite_focus=true Welche builds für vzlogger sinnvoll und was zu viel ist, kann ich nicht gut bewerten. Das hängt ja davon, ab wie wahrscheinlich ein Fehler durch die Build gefunden wird, den später zu finden mehr Arbeit macht. Ich möchte nur am Ende ein armv6 image im docker hub haben und ein bisschen Erfahrung mit github actions ;) |
@andig: |
both done |
judging from those build speeds, that running of docker builds inside qemu appears to be a horrible stopgap solution i wouldn't want to use in production. (would only use it to supply arm images for releases or such.) |
Okay, so a GitHub action that on runs on a push on the master branch and then builds without tests and publish to docker hub. Which platforms should be build in the image? |
@StefanSchoof: personally i would only see some use in providing static arm binaries, maybe @andig has more of an opinion. |
i'm also new to github actioms specifically, |
The I will go with armv6 and amd64. Adding a platform if someone has a use case is easy. I had serval pi installation where I installed so many things, I was no longer know which package I installed for what and on a is upgrade to next raspbian version some things always broke. So I started to use docker images. Also I can put all my config in some files and push it to GitHub as backup, like in https://github.com/StefanSchoof/volkszaehler.org-config I think I will get to the adjustments in the next week. |
Cross compile statt native compile in qemu würde das bochmal deutlich beschleunigen. Mergeable wäre das nur bei Buildzeiten <10min |
6def6a5
to
ba1cac9
Compare
So here the github action, that only runs on master |
ba1cac9
to
484de25
Compare
Moin Stefan, wie lange läuft der Build jetzt? |
I guess we can use the time this PR did run: 2m44s |
Yes, it runs, see https://github.com/StefanSchoof/vzlogger/actions/runs/721635854 |
Ich würde vorschlagen das nicht zu mergen. 15min Buildzeit für ein Dockerimage dass sich relativ leicht selbst bauen lässt erscheint mir eine ziemliche Ressourcenverschwendung. |
I did test the docker build and it took 90m on my raspberry pi zero w. Without the build of the libs, the cmake and make took 21 m. So the build on the build server with qemu is faster then on the real hardware. |
my personal opinion, using docker on a underpowered hardware like a raspberry pi zero is a horrible idea. also my opinion, and as stated before, i think we should be somewhat sensible in using resources, even, or especially if they are free, i wonder how we could improve on this... does anybody have any experience cross-compiling vzlogger? another solution would be to run the build natively on more powerful arm hardware. is there some other way we can get a native arm system? |
just cross-compiled vzlogger using buildroot... |
If you a are assuming, that I am the only user that is using docker on a raspberry I agree. I can setup my own docker hub repro and use it. But I think, that there are more users that want to use this image, but I have no data to prove it. Getting a real arm build agent is not a easy task. GitHub has none, amazon will cost (nothing that really big if created only on build time, but there needs to setup a billing) and you get much complexity in creating this, maintain a arm build agent, that runs 24/7 only for this purpose sound for me like a greater waste of resources, cross completion will only reduce the time for the build, installing the dependency will still need qemu and time. I suggest I remove the arm platform from this PR and we see if in the future we see requests in the mailing list or on other places where people want to run the vzlogger in arm docker. |
Only for am64 it takes 1m 44s: https://github.com/StefanSchoof/vzlogger/runs/2286703434?check_suite_focus=true |
i am 90% done with a Dockerfile for cross-compiling, based on buildroot. there's two pieces missing:
|
Great. The docker from has a platform flag (https://docs.docker.com/engine/reference/builder/#from) that allows us to use the x86 first Stage and a arm second stage. If only copy are in the second stage no qemu is needed. So if all needed libs are able to copy from the builder, static linking is not a must for an arm docker images without qemu. |
even more efficient for your case, if no qemu needed at all. i would still like to use qemu (with or without docker) to run the unit-tests after a build, can you look into that?
that is only half of the truth. |
@StefanSchoof:
no OS image needed at all. (with buildroot, one would probably |
Since the build time in qemu rises with tests from 15min to 54min, I think the main time will be needed for the tests. Has this big resource need enough value for the project to be justified? |
the slow part is building the tests. the idea is to cross-compile the tests and then execute in the emulator. sadly i'm kinda stuck with #486 on how to get a static build. (and time/motivation) |
Rationale why I use docker: The overhead is small enough to be usable even on the pizero. |
For architecture selection: Please build: linux/arm/v6, linux/arm64, linux/amd64. Those are the most-used out there. |
This action uses a deprecated checkout action (v2) instead of v4. Also, it uses Docker Hub, that has more an more restrictions. My version is here: #663 Please have a look at it. It also signs the created image. I don't know if this is needed. But my action comes from the GitHub blueprint. |
Add a github docker build action.
This is my first github action, so please give much feedback as possible ;)
This requires to set the
DOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
secrets.This is building a multi arch image for the linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6 platforms.
It extract the version from the
CMAKELists.txt
. The image will get a list of tags: latest, the major version, the major and minor version, the major, minor and sub version and also the commit id. So we havevzlogger:latest
,vzlogger:0
,vzlogger:0.8
,vzlogger:0.8.0
andvzlogger:commit-<shortcommitid>
. I add the commit version, because currently no incrementing version number exists and this allows in a case of a problem to go back to a previous version.I pushed this to test the process to https://hub.docker.com/r/stefanschoof/vzlogger/tags
This action is trigger on every push and pr, but only if a commit to the master branch the images will pushed to docker hub. I think with this approach it is possible to find build breaks on other platforms quicker. Building all platform images will take up to 30 mins.
A sample pr run https://github.com/StefanSchoof/vzlogger/runs/2243563277?check_suite_focus=true
A sample master branch run https://github.com/StefanSchoof/vzlogger/runs/2244080338?check_suite_focus=true
I tried a cache, but since this would cache the libsml and libmbus builds, I deiced against it.