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

healthcheck: add support for --start-interval #280

Merged
merged 7 commits into from
Apr 10, 2024

Conversation

flouthoc
Copy link
Contributor

@flouthoc flouthoc commented Apr 2, 2024

Add support for --start-interval which is present in newer version of docker
Ref: https://docs.docker.com/reference/dockerfile/#healthcheck

Needed by: containers/podman#21701

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 2, 2024
Copy link
Contributor

openshift-ci bot commented Apr 2, 2024

Hi @flouthoc. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 2, 2024

@nalind @rhatdan @TomSweeneyRedHat PTAL

@flouthoc flouthoc force-pushed the health-start-interval branch 2 times, most recently from 477f658 to 3a90fde Compare April 2, 2024 22:29
@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 3, 2024

If this gets merged I'll open a followup PR in buildah and vendor new imagebuilder there.

dispatchers.go Show resolved Hide resolved
@nalind
Copy link
Member

nalind commented Apr 5, 2024

If this gets merged I'll open a followup PR in buildah and vendor new imagebuilder there.

Then this should probably include a commit to bump the release version.

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 5, 2024

If this gets merged I'll open a followup PR in buildah and vendor new imagebuilder there.

Then this should probably include a commit to bump the release version.

@nalind Did you mean a version bump for imagebuilder itself ?

@nalind
Copy link
Member

nalind commented Apr 5, 2024

If this gets merged I'll open a followup PR in buildah and vendor new imagebuilder there.

Then this should probably include a commit to bump the release version.

@nalind Did you mean a version bump for imagebuilder itself ?

Yes, unless there's some reason not to.

@TomSweeneyRedHat
Copy link
Contributor

Other than @nalind 's comments, LGTM

@flouthoc flouthoc requested a review from nalind April 5, 2024 22:13
@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 6, 2024

@nalind @TomSweeneyRedHat done.

@@ -7,4 +7,6 @@ HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
HEALTHCHECK CMD
HEALTHCHECK CMD a b
HEALTHCHECK --timeout=3s CMD ["foo"]
HEALTHCHECK --start-interval=5s --interval=5s --timeout=3s --retries=3 \
Copy link
Member

Choose a reason for hiding this comment

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

This one could use a "--start-period" flag, since it's exercising the parser, and I don't see anything else in this directory checking that the flag is recognized.

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.

@nalind
Copy link
Member

nalind commented Apr 8, 2024

LGTM with one nit, which isn't a blocker.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 8, 2024

@nalind Is it that CI is using older docker for conformance tests ? I error on travis now for the flag --start-interval

@nalind
Copy link
Member

nalind commented Apr 8, 2024

@nalind Is it that CI is using older docker for conformance tests ? I error on travis now for the flag --start-interval

It's certainly plausible. My access is limited, so I can't actually read the error logs.

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 8, 2024

@nalind In error logs at least it is saying that docker cannot parse start-interval and I don't get that in my local so i guess it must be it. Do you have any clue how can i bump docker version in CI ?

=== RUN   TestConformanceInternal/healthcheck

    conformance_test.go:922: 41: unable to build Docker image "": API error (400): dockerfile parse error on line 5: unknown flag: start-interval
    ```

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 8, 2024

Should i try this ? https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version in a different commit.

@nalind
Copy link
Member

nalind commented Apr 9, 2024

@nalind In error logs at least it is saying that docker cannot parse start-interval and I don't get that in my local so i guess it must be it.

That's consistent with the version information at https://docs.travis-ci.com/user/reference/jammy/.

Should i try this ? https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version in a different commit.

Any reason not to?

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 9, 2024

@nalind A different test is failing i.e TestConformanceInternal/copy_chmod , I think this is failing because changes in newer version of docker.

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 9, 2024

@nalind This fixes error for me and is compatible with newer buildkit, but I am not sure why this additional & was added, do you have any hints ? I can't think of a reason why it was added all the test pass without it as well.

diff --git a/dockerclient/client.go b/dockerclient/client.go
index 1e8c83f..1236d66 100644
--- a/dockerclient/client.go
+++ b/dockerclient/client.go
@@ -1058,7 +1058,7 @@ func (e *ClientExecutor) CopyContainer(container *docker.Container, excludes []s
                        }
                        chmod = func(h *tar.Header, r io.Reader) (data []byte, update bool, skip bool, err error) {
                                mode := h.Mode &^ 0o777
-                               mode |= parsed & 0o777
+                               mode |= parsed
                                h.Mode = mode
                                return nil, false, false, nil

@nalind
Copy link
Member

nalind commented Apr 9, 2024

@nalind This fixes error for me and is compatible with newer buildkit, but I am not sure why this additional & was added, do you have any hints ? I can't think of a reason why it was added all the test pass without it as well.

diff --git a/dockerclient/client.go b/dockerclient/client.go
index 1e8c83f..1236d66 100644
--- a/dockerclient/client.go
+++ b/dockerclient/client.go
@@ -1058,7 +1058,7 @@ func (e *ClientExecutor) CopyContainer(container *docker.Container, excludes []s
                        }
                        chmod = func(h *tar.Header, r io.Reader) (data []byte, update bool, skip bool, err error) {
                                mode := h.Mode &^ 0o777
-                               mode |= parsed & 0o777
+                               mode |= parsed
                                h.Mode = mode
                                return nil, false, false, nil

The intent there was to avoid cases where bits that attempt to change the file type were added (the bits for block and character devices fit within g 16-bit numbers). 0o7777 might work better there, since that'll also allow setuid/setgid/sticky, though I think that'd be kind of a weird thing to use in a COPY --chown.

Add support for `--start-interval` which is present in newer version of docker
Ref: https://docs.docker.com/reference/dockerfile/#healthcheck

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
add healthcheck to conformance tests

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Update version information to mark this as v1.2.8

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 9, 2024

The intent there was to avoid cases where bits that attempt to change the file type were added (the bits for block and character devices fit within g 16-bit numbers). 0o7777 might work better there, since that'll also allow setuid/setgid/sticky, though I think that'd be kind of a weird thing to use in a COPY --chown.

Thanks this worked, I think CI should pass now.

@nalind
Copy link
Member

nalind commented Apr 9, 2024

Oof, I meant chmod, but anyway, LGTM.

Update version information to mark this as v1.2.9-dev.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 9, 2024

Okay I think all the test passed last time except one which failed and I think it was a size diff fluke in conformance test, I think it should pass in this re-push.

@flouthoc
Copy link
Contributor Author

flouthoc commented Apr 9, 2024

@nalind @rhatdan @TomSweeneyRedHat PTAL , finally CI is green.

@TomSweeneyRedHat
Copy link
Contributor

LGTM and happy green test buttons

@flouthoc
Copy link
Contributor Author

@nalind @rhatdan PTAL

@rhatdan
Copy link
Contributor

rhatdan commented Apr 10, 2024

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2024
Copy link
Contributor

openshift-ci bot commented Apr 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, rhatdan

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 Apr 10, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit fd8fc3c into openshift:master Apr 10, 2024
3 checks passed
Copy link
Contributor

openshift-ci bot commented Apr 10, 2024

@flouthoc: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@flouthoc
Copy link
Contributor Author

@nalind @TomSweeneyRedHat Could we cut a new imagebuilder version whenever possible, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants