Skip to content
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

kola: add http server #419

Merged
merged 5 commits into from
Mar 16, 2023
Merged

kola: add http server #419

merged 5 commits into from
Mar 16, 2023

Conversation

tormath1
Copy link
Contributor

@tormath1 tormath1 commented Mar 15, 2023

In this PR, we add a simple HTTP server that runs on the started instance to serve /var/www content on port :8080. It can be used for example to serve a dev container archive provided by --devcontainer-file ./local-flatcar_developer_container.bin.bz2

We could also think about using it to test sysext images?

NOTE: Regarding the devcontainer test, we also add a new flag --devcontainer-url to provide a different base URL.

Closes: flatcar/Flatcar#976

this param allows to override the default base URL for fetching the
dev container.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
this function can be used outside in case one cluster starts without
initial size but we want Kolet to be uploaded on the instances.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
it serves a directory /var/www on the port 8080

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@tormath1 tormath1 self-assigned this Mar 15, 2023
@t-lo
Copy link
Member

t-lo commented Mar 15, 2023

Tested locally with qemu_uefi and dev container image from the latest nightly. Both devcontainer tests pass:

$ sudo bin/kola run --board=amd64-usr --parallel=10 --platform=qemu --qemu-bios=flatcar_production_qemu_uefi_efi_code.fd --qemu-image=flatcar_production_image.bin --tapfile=result.tap --qemu-skip-mangle --devcontainer-file=flatcar_developer_container.bin.bz2 devcontainer.systemd-nspawn devcontainer.docker
=== RUN   devcontainer.docker
=== RUN   devcontainer.systemd-nspawn
--- PASS: devcontainer.systemd-nspawn (344.18s)
--- PASS: devcontainer.docker (415.75s)
PASS, output in _kola_temp/qemu-2023-03-15-1233-645068
$ cat result.tap
1..2
ok - devcontainer.systemd-nspawn
ok - devcontainer.docker

@tormath1 tormath1 marked this pull request as ready for review March 15, 2023 12:42
@tormath1 tormath1 requested a review from a team March 15, 2023 12:42
}

scriptParameters := scriptTemplateParameters{
BinhostURLTemplate: "http://bincache.flatcar-linux.net/boards/@ARCH@-usr/@VERSION@/pkgs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to pass the pkgs folder to the instance? This bincache path only works for developer builds made on Jenkins but since this here is meant to be used in GitHub Actions, nothing will be there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Testing with the nightly image means that it will use bincache, the question is what happens when we have a dev version not built on Jenkins)

Copy link
Member

@t-lo t-lo Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I did not even consider this because I used images from a nightly build for my testing above.
A --devcontainer-binhost-url would indeed be needed.
We would also need to export the packages in the Build CI job and fetch that artifact in the kola CI job. Making a metal note for my work on flatcar/Flatcar#794.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the idea would be to run a local python -m http.server before running kola to give it access to the pkgs folder and then use the new image flag for the image?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather not use the new image flag because it would occupy disk space on the VM, and use the temporary python http server for both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use a temporary python server and use the two new flags (--devcontainer{,-binhost}-url) - I'm just curious about network consideration (if the qemu instance can reach the python server)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this runs in VMs with private addresses I guess it will be enough to let it bind to 0.0.0.0 as done by default and then use the VM's internal IP address for the HTTP URL

@t-lo t-lo requested a review from pothos March 16, 2023 09:45
@@ -73,6 +73,9 @@ func init() {
// general options
sv(&outputDir, "output-dir", "", "Temporary output directory for test data and logs")
sv(&kola.TorcxManifestFile, "torcx-manifest", "", "Path to a torcx manifest that should be made available to tests")
sv(&kola.DevcontainerURL, "devcontainer-url", "http://bincache.flatcar-linux.net/images/@ARCH@/@VERSION@", "URL to a dev container archive that should be made available to tests")
sv(&kola.DevcontainerBinhostURL, "devcontainer-binhost-url", "http://bincache.flatcar-linux.net/boards/@ARCH@-usr/@VERSION@/pkgs", "URL to a binary host that the devcontainer test should use")
sv(&kola.DevcontainerFile, "devcontainer-file", "", "Path to a dev container archive that should be made available to tests")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sv(&kola.DevcontainerFile, "devcontainer-file", "", "Path to a dev container archive that should be made available to tests")
sv(&kola.DevcontainerFile, "devcontainer-file", "", "Path to a dev container archive that should be made available to tests as alternative to devcontainer-url, note that a working devcontainer-binhost-url is still needed")

this option allows to pass arbitrary local dev container archive to be
uploaded and served by a HTTP server in order to be consumed by the
devcontainer test.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
this param allows to override the default devcontainer binhost URL for the devcontainer test.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@tormath1 tormath1 merged commit 2d424f1 into flatcar-master Mar 16, 2023
@tormath1 tormath1 deleted the tormath1/devcontainer branch March 16, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing a custom devcontainer URL to kola (and/or ideally allow using a local file)
3 participants