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

buildah bud tests: better handling of remote #16384

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

edsantiago
Copy link
Member

When I first enabled buildah-bud tests under podman-remote (#9887),
I got one aspect all wrong: I added a podman-remote() helper function
to match the podman() one. Turns out it's never actually called,
even when $PODMAN_BINARY=podman-remote, because functions/aliases
don't work that way.

The way it works is, those few cases in which bud.bats runs
podman are not magically remapped to podman-remote, they use
the podman() function. That's where we need to check if
we're using podman-remote, and that's where we need to
remove the registry-and-rootdir options.

With this fix, we can reenable two previously-skipped bud tests.

Signed-off-by: Ed Santiago [email protected]

None

When I first enabled buildah-bud tests under podman-remote (containers#9887),
I got one aspect all wrong: I added a podman-remote() helper function
to match the podman() one. Turns out it's never actually called,
even when $PODMAN_BINARY=podman-remote, because functions/aliases
don't work that way.

The way it works is, those few cases in which bud.bats runs
podman are not magically remapped to podman-remote, they use
the podman() function. That's where we need to check if
we're using podman-remote, and that's where we need to
remove the registry-and-rootdir options.

With this fix, we can reenable two previously-skipped bud tests.

Signed-off-by: Ed Santiago <[email protected]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 2, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago

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 Nov 2, 2022
@mheon
Copy link
Member

mheon commented Nov 2, 2022

LGTM

@rhatdan
Copy link
Member

rhatdan commented Nov 2, 2022

/lgtm
Couldn't we just fix Buildah to use the podman commands that are now in delta?

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 2, 2022
@openshift-merge-robot openshift-merge-robot merged commit c772c00 into containers:main Nov 2, 2022
@edsantiago edsantiago deleted the budtests_remote branch November 2, 2022 14:49
@edsantiago
Copy link
Member Author

I'm not sure I understand your question. If I interpret correctly, you're asking if we can change the buildah tests themselves? This is one of the places that calls podman:

https://github.com/containers/buildah/blob/3cfa17a69564a7a3968a5b4671f6c203c9ec1eda/tests/bud.bats#L5238-L5243

(the other is almost identlcal). How would you propose changing those tests?

@edsantiago
Copy link
Member Author

...and why does github sometimes show a nice inline excerpt of the lines in question, and other times just a plain link?

@rhatdan
Copy link
Member

rhatdan commented Nov 2, 2022

I am saying why not apply

 function podman() {
-    command ${PODMAN_BINARY:-podman} ${PODMAN_REGISTRY_OPTS} ${ROOTDIR_OPTS} "$@"
+    local cmd=${PODMAN_BINARY:-podman}
+    local opts="${PODMAN_REGISTRY_OPTS} ${ROOTDIR_OPTS}"
+    if [[ $cmd =~ remote ]]; then
+        opts=
+    fi
+    command $cmd $opts "$@"
 }

+function podman-remote() {
+    command ${PODMAN_BINARY:-podman-remote} ${ROOTDIR_OPTS} "$@"
+}
+

To builders/test/helpers.bash

@edsantiago
Copy link
Member Author

Oh! Separation. My thinking at the time was, I don't want buildah knowing anything about podman-remote or about the test-buildah-bud-under-podman environment. Revisiting my decision just now... I still think it stands. I know it's ugly to have these diffs in the podman repo, but I find it uglier to have that code in buildah where it will never be needed. I'm willing to hear arguments in favor, though. @nalind @flouthoc WDYT?

@edsantiago
Copy link
Member Author

ping, @nalind @flouthoc, ^^

The question is: should the podman-remote diffs be incorporated into buildah/tests/helpers.bash instead of carried in podman? My inclination is no, because buildah shouldn't be responsible for hackery done on the podman side. Also no because unpredictable future changes in podman may require different diffs. But I'd value your opinions.

@flouthoc
Copy link
Collaborator

flouthoc commented Nov 7, 2022

My personal vote will be no for this, since in ideal world buildah should not be even aware about podman except the public api changes. We already use this philosophy in code I think tests should do the same, shouldn't it ? But this is just my opinion and if we have a strong reason to do otherwise then I'm cool with it. @nalind WDYT ?

@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 Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
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.

5 participants