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

cmd/image-builder: add deployment channel as field to the logs #1299

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

schuellerf
Copy link
Contributor

add deployment channel as field to the logs similar to
osbuild/osbuild-composer#4285
and based on
osbuild/osbuild-composer#4301

@schuellerf
Copy link
Contributor Author

keeping as draft until I understand why the (unrelated) tests fail on my PC

@schuellerf schuellerf force-pushed the add-deployment-channel-to-logs branch from 9ae47b1 to a485cb6 Compare August 14, 2024 13:09
@schuellerf schuellerf marked this pull request as ready for review August 14, 2024 13:53
lzap
lzap previously approved these changes Aug 14, 2024
Copy link
Collaborator

@lzap lzap left a comment

Choose a reason for hiding this comment

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

Haven’t tested, LGTM.

templates/image-builder.yml Show resolved Hide resolved
@schuellerf schuellerf enabled auto-merge (rebase) August 14, 2024 14:23
@schuellerf schuellerf force-pushed the add-deployment-channel-to-logs branch from a485cb6 to 9c9ae7d Compare August 14, 2024 14:25
@schuellerf schuellerf force-pushed the add-deployment-channel-to-logs branch 3 times, most recently from 557a605 to 1460687 Compare August 14, 2024 17:17
@schuellerf schuellerf requested a review from lzap August 14, 2024 17:19
@schuellerf
Copy link
Contributor Author

/retest

1 similar comment
@schuellerf
Copy link
Contributor Author

/retest

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

LGTM

this is critical for tests where e.g. the bind to the port fails.
When ignored (as it was) the test will connect to the application
running on that port, resulting in strange behavior
@schuellerf schuellerf force-pushed the add-deployment-channel-to-logs branch from 1460687 to 542097a Compare August 16, 2024 14:11
@schuellerf schuellerf merged commit db354eb into osbuild:main Aug 16, 2024
12 checks passed
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

I was a bit late with my review it seems - oh well, sorry for that! Maybe my comments are still useful

@@ -191,7 +191,10 @@ func startServer(t *testing.T, tscc *testServerClientsConf, conf *ServerConfig)
require.NoError(t, err)
// execute in parallel b/c .Run() will block execution
go func() {
_ = echoServer.Start("localhost:8086")
err = echoServer.Start("localhost:8086")
if err.Error() != "http: Server closed" {
Copy link
Contributor

Choose a reason for hiding this comment

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

(niptick) I personally would prefer if this commit could be it's own PR (alternatively the PR title could get updated maybe?). When going over the project history it's often nice to see the what PR a commit belonged to and here the PR title/intention and this particular fix feel a bit disconnected.

About the change itself:

It's probably best to compare error types instead of strings here, i.e. if err != http.ErrServerClosed

How does this work exactly? Will we always get ErrServerClosed here or is it random (either nil or ErrServerClosed?).

Bonus points for: the comment above talks about .Run() but the code uses .Start() so we could clean this up too. And while add it we could use your nice GetFreePort() helper from osbuild/osbuild-composer@55c5602 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ServerClose always happens on regular shutdown...
I already did implement with GetFreePort() (locally) but stopped after changing ~1000 strings to take a dynamic host&port 😑
Will do this "major rework" at some other point in time

Copy link
Contributor

@mvo5 mvo5 Aug 16, 2024

Choose a reason for hiding this comment

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

I did a quick sed experiement and opened #1303 which may help, I did not really check much, it was mostly sed doing it's thing but it might be useful. No getFreePort there but that should be easy to hook up once the other pieces are there.

It also include the tiny http.ErrServerClosed tweak in #1304

- name: Run unit tests
run: go test -v -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=./... ./...
run: make unit-tests
Copy link
Contributor

Choose a reason for hiding this comment

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

The makefile has a comment re-implementing .github/workflows/tests.yml as close as possible which probably needs updating now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks - good catch 🙈

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.

4 participants