Skip to content

Support podman --remote when Containerfile is not in context directory#18577

Merged
openshift-merge-robot merged 1 commit intocontainers:mainfrom
rhatdan:build
May 30, 2023
Merged

Support podman --remote when Containerfile is not in context directory#18577
openshift-merge-robot merged 1 commit intocontainers:mainfrom
rhatdan:build

Conversation

@rhatdan
Copy link
Copy Markdown
Member

@rhatdan rhatdan commented May 15, 2023

Fixes: #18239

[NO NEW TESTS NEEDED]

@test "podman build -f test" in test/system/070-build.bats

Will test this. This was passing when run on a local system since the remote end was using the clients path to read the Containerfile The issue is it would not work in a podman machine since the Containerfile would/should be a different path.

Does this PR introduce a user-facing change?

podman --remote build with Containerfile separate from context directory will now work.

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 15, 2023
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label May 15, 2023
m = []string{query.Dockerfile}
}
for _, containerfile := range m {
containerFiles = append(containerFiles, filepath.Join(contextDirectory, containerfile))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably want to path.Clean() the containerfile value before joining, to strip out any weird prefixes like "../../" and friends.


name := filepath.ToSlash(strings.TrimPrefix(path, s+separator))
if i > 0 {
name = path
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This path isn't going to have the benefit of the ToSlash() change, and I think we always want to have passed the path through that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

... and if path is a directory, this replacement will happen multiple times while we walk through it, which sounds wrong.

@rhatdan rhatdan force-pushed the build branch 6 times, most recently from fb905d3 to cfbf02e Compare May 17, 2023 11:25
@rhatdan
Copy link
Copy Markdown
Member Author

rhatdan commented May 17, 2023

@nalind @Luap99 @giuseppe @vrothberg @mheon @containers/podman-maintainers PTAL

@rhatdan
Copy link
Copy Markdown
Member Author

rhatdan commented May 18, 2023

@containers/podman-maintainers PTAL
@vrothberg @Luap99 @nalind @flouthoc @mheon PTAL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a perfect example of why I ABSOLUTELY LOATHE one char variable names that aren't referenced within 3 or 4 lines. It took me almost 5 minutes to spot where 'd' was defined. For the love of all things holy, please add a few characters to this and any other 1 character variables that aren't referenced within a few lines of its definition.

Fixes: containers#18239

[NO NEW TESTS NEEDED]

@test "podman build -f test" in test/system/070-build.bats

Will test this.  This was passing when run on a local system since
the remote end was using the clients path to read the Containerfile
The issue is it would not work in a podman machine since the
Containerfile would/should be a different path.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@rhatdan
Copy link
Copy Markdown
Member Author

rhatdan commented May 30, 2023

Copy link
Copy Markdown
Member

@lsm5 lsm5 left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 30, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 30, 2023
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented May 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

Details 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

@rhatdan
Copy link
Copy Markdown
Member Author

rhatdan commented May 30, 2023

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 30, 2023
@openshift-merge-robot openshift-merge-robot merged commit 710315d into containers:main May 30, 2023
openshift-merge-robot added a commit that referenced this pull request Aug 16, 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 Aug 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 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. 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. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: stat Dockerfile: no such file or directory on windows with Podman 4.4.4

6 participants