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

Kube Play - set ReportWriter when building an image #20889

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

ygalblum
Copy link
Contributor

@ygalblum ygalblum commented Dec 3, 2023

Add test for a specific crash

Does this PR introduce a user-facing change?

No

None

Resolves: #20432

Copy link
Contributor

openshift-ci bot commented Dec 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ygalblum

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 3, 2023
@ygalblum ygalblum force-pushed the quadlet-build-crash branch from 7e93afe to e7695b8 Compare December 3, 2023 14:25
@ygalblum
Copy link
Contributor Author

ygalblum commented Dec 4, 2023

The CI is failing because the play build tests expect a clean output while following this change, the output includes lines about the pulling of the image.
I think there are two ways to address this. Either adjust the test, or revert this change and instead check the ReportWriter before trying to write into the it in containers-common (to avoid the crash).
@vrothberg WDYT?

@vrothberg
Copy link
Member

I am in favor of changing the tests. The build output is important to have IMO.

@rhatdan PTAL

@rhatdan
Copy link
Member

rhatdan commented Dec 4, 2023

Yes lets fix the test. Opts output is to stderr so can we segment based on this. Haven't looked but in BATS I know this is difficult. if not impossible.

@ygalblum
Copy link
Contributor Author

ygalblum commented Dec 4, 2023

Thanks. I was thinking about setting --quiet in the failing tests which should allow the tests to pass. However, I know realized that that if the user sets --quiet, the --writer passed on will be nil causing the crash this change tries to avoid.
So, I'll open a PR in containers-common to add a check on the writer. Once merged and picked up by Podman, we can address it here.

@umohnani8
Copy link
Member

LGTM

@ygalblum ygalblum force-pushed the quadlet-build-crash branch from 2b2cc8c to 2ae61ca Compare December 4, 2023 14:00
@ygalblum ygalblum force-pushed the quadlet-build-crash branch from 2ae61ca to 0534a80 Compare December 4, 2023 14:20
is "$output" "running" "container should be started by systemd and hence be running"

service_cleanup $QUADLET_SERVICE_NAME inactive
run_podman rmi $(pause_image)
Copy link
Member

Choose a reason for hiding this comment

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

Nasty red. Suggestion:

@@ -1480,2 +1480,3 @@ EOF
 
+    local untagged_image=quay.io/libpod/busybox
     local image_name=test_image
@@ -1489,3 +1490,3 @@ EOF
     cat >$container_file_path << EOF
-FROM busybox
+FROM $untagged_image
 EOF
@@ -1533,3 +1534,3 @@ EOF
     service_cleanup $QUADLET_SERVICE_NAME inactive
-    run_podman rmi $(pause_image)
+    run_podman rmi $untagged_image $image_name $(pause_image)
 }

(secondary, low-priority suggestion: rename variable image_name to built_image)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (both), thanks

Copy link
Member

Choose a reason for hiding this comment

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

Well, partly: $untagged_image is undefined, so there's still red. You can either take the other half of my suggestion above, or s/$untagged_image/busybox/. My reason for suggesting $untagged_image and setting it to a repo+image (untagged) is to prevent docker.io rate limiting on hosts like Fedora CI where they might not have our registries.conf overrides. I would like to prevent Fedora Gating flakes.

Obviously I tested quay.io/libpod/busybox on my end, using your PR as well as main (where the test fails with the expected crash) but if you go that route please confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've taken in all your comments including using quay.io/libpod/busybox. I also make sure that the image is not available on the local machine before running the test. I ran the test locally and it did not prompt about any stray images. So, hopefully, it's OK now.

BTW initially, I wanted to use a local registry instead of downloading a new image. However, building an image based on a private registry using kube play is not fully supported (See #20890 for details)

Anyhow, thanks a lot for your help (here and in general)

@ygalblum ygalblum force-pushed the quadlet-build-crash branch from 0534a80 to 66af520 Compare December 4, 2023 15:57
Add test for a specific crash
Update play build test to expect message in stderr

Signed-off-by: Ygal Blum <[email protected]>
@ygalblum ygalblum force-pushed the quadlet-build-crash branch from 66af520 to a943be7 Compare December 5, 2023 07:45
@rhatdan
Copy link
Member

rhatdan commented Dec 5, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 5, 2023
@openshift-merge-bot openshift-merge-bot bot merged commit 6efebb3 into containers:main Dec 5, 2023
93 checks passed
@ygalblum ygalblum deleted the quadlet-build-crash branch December 6, 2023 07:18
@lsm5
Copy link
Member

lsm5 commented Dec 11, 2023

@Luap99 @mheon @ashley-cui are we ok backporting this to v4.8 for v4.8.2?

@Luap99
Copy link
Member

Luap99 commented Dec 11, 2023

Looks like a bug fix so no objection from my side.

@lsm5
Copy link
Member

lsm5 commented Dec 11, 2023

/cherry-pick v4.8

@openshift-cherrypick-robot
Copy link
Collaborator

@lsm5: #20889 failed to apply on top of branch "v4.8":

Applying: Kube Play - set ReportWriter when building an image
Using index info to reconstruct a base tree...
M	test/system/252-quadlet.bats
Falling back to patching base and 3-way merge...
Auto-merging test/system/252-quadlet.bats
CONFLICT (content): Merge conflict in test/system/252-quadlet.bats
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Kube Play - set ReportWriter when building an image
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick v4.8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@lsm5 lsm5 mentioned this pull request Dec 11, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Mar 12, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quadlet: Kube image build failed when starting service with missing image
8 participants