-
Notifications
You must be signed in to change notification settings - Fork 814
add: report error while creating dir for URL source. #6087
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
Conversation
add.go
Outdated
@@ -517,7 +517,7 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption | |||
if sourceIsGit(src) { | |||
go func() { | |||
var cloneDir, subdir string | |||
cloneDir, subdir, getErr = define.TempDirForURL(tmpdir.GetTempDir(), "", src) | |||
cloneDir, subdir, dirErr = define.TempDirForURL(tmpdir.GetTempDir(), "", src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just return
if getErr
is not nil
, as there's no point in continuing, and cloneDir
and subdir
are not expected to be useful values.
0866948
to
752b5be
Compare
@@ -260,13 +260,6 @@ func parseGitBuildContext(url string) (string, string, string) { | |||
return gitBranchPart[0], gitSubdir, gitBranch | |||
} | |||
|
|||
func isGitTag(remote, ref string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to for this because fetch
below automatically fails if reference
does not exists.
@@ -284,12 +277,6 @@ func cloneToDirectory(url, dir string) ([]byte, string, error) { | |||
return combinedOutput, gitSubdir, fmt.Errorf("failed while performing `git remote add`: %w", err) | |||
} | |||
|
|||
if gitRef != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for this fetch
automatically resolves correct tag
, branch
or commit
. If not found it fails.
tests/bud.bats
Outdated
|
||
cat > $contextdir/Dockerfile << _EOF | ||
FROM alpine | ||
RUN apk add git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image shouldn't need git
installed for ADD
to work, so this step is unnecessary. It can be FROM scratch
if it doesn't need to run anything after the content has been added.
752b5be
to
d6d384f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, but the commit log doesn't exactly reflect what was changed.
d6d384f
to
88c4e2d
Compare
tags
and branches
@containers/buildah-maintainers PTAL |
defer wg.Done() | ||
defer pipeWriter.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The defer placement feels wrong, doing this after the function call but before errors checking is odd.
IMO they should be at the top of the function.
tests/bud.bats
Outdated
|
||
cat > $contextdir/Dockerfile << _EOF | ||
FROM scratch | ||
ADD https://github.com/openshift/microshift.git#foobar /src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have no direct control over this repo, if they ever add such a branch all our CI would break.
Can we use buildah instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than @nalind's comments, LGTM
6dd6a43
to
8944852
Compare
tests/bud.bats
Outdated
ADD https://github.com/containers/crun.git#nosuchbranch /src | ||
_EOF | ||
run_buildah 128 build -f $contextdir/Dockerfile -t git-image $contextdir | ||
expect_output --substring "couldn't find remote ref foobar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you switched to nosuchbranch but the test matches still foobar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad
Correctly report back error when attempting to create `Tmpdir` for a given url source. Also remove superfluous `isGitTag` from define/types.go since `git fetch` correctly resolves by provided reference. Closes: containers/podman#25679 Signed-off-by: flouthoc <[email protected]>
8944852
to
0c37781
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
But I don't have merge powers here I belive
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, Luap99, nalind 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 |
e4d3dc0
into
containers:main
Correctly report back error when attempting to create
Tmpdir
for agiven url source.
Also remove superfluous
isGitTag
from define/types.go sincegit fetch
correctly resolves by provided reference.Fixfor: containers/podman#25679
What type of PR is this?
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?