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

use containers/storage/pkg/fileutils/(Exists,Lexists) #22334

Merged
merged 12 commits into from
Apr 19, 2024

Conversation

giuseppe
Copy link
Member

use a faster alternative to os.Stat and os.Lstat to check whether a path is present

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added release-note-none approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 10, 2024
@giuseppe giuseppe added No New Tests Allow PR to proceed without adding regression tests and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 10, 2024
@github-actions github-actions bot added machine kind/api-change Change to remote API; merits scrutiny labels Apr 10, 2024
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@mheon
Copy link
Member

mheon commented Apr 10, 2024

Lot of complaining from CI about os.IsNotExist. Changes LGTM otherwise.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2024
@giuseppe giuseppe force-pushed the use-faccessat branch 5 times, most recently from dc8a4df to 5aad981 Compare April 11, 2024 08:22
@giuseppe giuseppe added the jira label Apr 11, 2024
@giuseppe giuseppe force-pushed the use-faccessat branch 3 times, most recently from 8851e9e to 5a22fc6 Compare April 11, 2024 11:08
@@ -172,7 +172,7 @@ var _ = Describe("Podman pull", func() {
session := podmanTest.Podman([]string{"pull", "-q", "--authfile", "/tmp/nonexistent", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(Equal("Error: credential file is not accessible: stat /tmp/nonexistent: no such file or directory"))
Expect(session.ErrorToString()).To(MatchRegexp("Error: credential file is not accessible: (faccessat|stat) /tmp/nonexistent: no such file or directory"))
Copy link
Member

Choose a reason for hiding this comment

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

Why can this both? This makes testing the error message much more complicated.

Copy link
Member Author

Choose a reason for hiding this comment

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

wanted to reduce tests failures in case we end up bisecting c/storage, but probably not worth the cost of dealing with regex.

Copy link
Member Author

Choose a reason for hiding this comment

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

on Windows we still use stat. Is it something to worry about?

Copy link
Member

Choose a reason for hiding this comment

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

We do not run these outside of linux so not really IMO. I really do not like to add additional complexity to the tests.
For example see #22346 where it would add quite a bit of work to add regex logic.

Copy link
Member

Choose a reason for hiding this comment

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

I still think this is a problem, I don't like having to write regex for all the error messages even when we know we always expect faccessat as we only run the tests on linux but I like to know what @edsantiago thinks about this.

Copy link
Member

Choose a reason for hiding this comment

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

Under what circumstances will tests see stat? I too am strongly against the use of regex. It will disasterify a lot of my upcoming test cleanup.

Copy link
Member

Choose a reason for hiding this comment

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

Never, my understanding stat is only used on native windows platforms. Everwhere else it uses faccess (Linux, Darwin) Probably freebsd as well.

@giuseppe giuseppe force-pushed the use-faccessat branch 2 times, most recently from 14ae0f3 to cdb5d44 Compare April 12, 2024 08:15
@giuseppe
Copy link
Member Author

we need containers/buildah#5469 first

@rhatdan
Copy link
Member

rhatdan commented Apr 12, 2024

Is this something we should meantion to RHIVOS as a potentially speedup of podman container start?

@Luap99
Copy link
Member

Luap99 commented Apr 12, 2024

Is this something we should meantion to RHIVOS as a potentially speedup of podman container start?

I doubt that this has a measurable impact over the whole container start duration.

Copy link

Cockpit tests failed for commit f86b67a6f1299c4bbf8d42422d1ef1753993fac0. @martinpitt, @jelly, @mvollmer please check.

@giuseppe giuseppe added the bloat_approved Approve a PR in which binary file size grows by over 50k label Apr 12, 2024
@giuseppe
Copy link
Member Author

setting bloat_approved as the additional size depends on the vendoring

martinpitt added a commit to martinpitt/cockpit-podman that referenced this pull request Apr 15, 2024
podman 5.1 [1], by way of [2], adds a "StartInterval" element to the
`.Config.Healthcheck` API field. This is an API breakage, but accept
either form until 5.1 is available on all OSes.

[1] containers/podman#22334
[2] containers/image@b6afa8c
@martinpitt
Copy link
Contributor

OK, I sent cockpit-project/cockpit-podman#1666 to accept either output format. This is an API break, let's hope it doesn't affect actual users..

martinpitt added a commit to cockpit-project/cockpit-podman that referenced this pull request Apr 15, 2024
podman 5.1 [1], by way of [2], adds a "StartInterval" element to the
`.Config.Healthcheck` API field. This is an API breakage, but accept
either form until 5.1 is available on all OSes.

[1] containers/podman#22334
[2] containers/image@b6afa8c
@martinpitt
Copy link
Contributor

That cockpit-podman PR landed, so please retry the cockpit-devdeps tests or force-push. (Or decide that it's an API break and not actually land it, of course :grin)

@Luap99
Copy link
Member

Luap99 commented Apr 15, 2024

OK, I sent cockpit-project/cockpit-podman#1666 to accept either output format. This is an API break, let's hope it doesn't affect actual users..

This is not an API break! This is adding a new field to a structure, if client code cannot handle that then it's parsing is broken. We add new fields all the time. If you want specific fields only then you should query only the fields you needs to check, i.e. --format "{{.Config.Healthcheck.Test}}\n{{.Config.Healthcheck.Test.Interval}} ..."

@martinpitt
Copy link
Contributor

Ack -- the PR landed now, so a /packit retest-failed (or next force-push) should go green.

@giuseppe
Copy link
Member Author

restarted the tests

giuseppe added 12 commits April 19, 2024 09:52
The change in healthcheck_run_test.go, depends on the
containers/image change:

commit b6afa8ca7b324aca8fd5a7b5b206fc05c0c04874
Author: Mikhail Sokolov <msokolov@evolution.com>
Date:   Fri Mar 15 13:37:44 2024 +0200

    Add support for Docker HealthConfig.StartInterval (v25.0.0+)

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Apr 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, Luap99

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

@mheon
Copy link
Member

mheon commented Apr 19, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 19, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit db93e2c into containers:main Apr 19, 2024
90 of 92 checks passed
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jul 19, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Jul 19, 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. bloat_approved Approve a PR in which binary file size grows by over 50k jira kind/api-change Change to remote API; merits scrutiny 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. machine No New Tests Allow PR to proceed without adding regression tests release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants