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

Report ignorefile location when no content added #3576

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Oct 7, 2021

Users have accidently had a .containerignore or .dockerignore
file in their context directly which blocked all content.
Currently we report that no globs matched, but do not
identify where the globs came from.

This change is an attempt to add this data to the error.
Example: #3318

Signed-off-by: Daniel J Walsh [email protected]

What type of PR is this?

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

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?


@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 label Oct 7, 2021
@rhatdan
Copy link
Member Author

rhatdan commented Oct 7, 2021

@aramcap PTAL

@aramcap
Copy link

aramcap commented Oct 7, 2021

@aramcap PTAL

These message looks very good. Thanks @rhatdan!

@@ -110,6 +110,7 @@ symlink(subdir)"
@test "bud with .dockerignore #2" {
run_buildah 125 build -t testbud3 --signature-policy ${TESTSDIR}/policy.json ${TESTSDIR}/bud/dockerignore3
expect_output --substring 'error building.*"COPY test1.txt /upload/test1.txt".*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.

Test is failing as it can't find the file test1.txt

add.go Outdated
if _, err := os.Stat(ignoreFile); err != nil {
ignoreFile = ""
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This guess could well be wrong if buildah add's --ignorefile flag is used.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no way to know at this level whether that happened. I would figure most likely, their would not have been an ignorefile.

Copy link
Member

Choose a reason for hiding this comment

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

Pass the filename that's the source of the Excludes list in as a field in the AddAndCopyOptions, and if one is provided, include it in the error message?

@rhatdan rhatdan changed the title 2Report ignorefile location when no content added Report ignorefile location when no content added Oct 9, 2021
@rhatdan rhatdan force-pushed the errors branch 3 times, most recently from 308054a to 916a01a Compare October 9, 2021 11:51
}
return ""
}
func ContainerIgnoreFile(path string, contextDir string) ([]string, string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

The arguments here are in the reverse of the order in which I think its callers expect.

@TomSweeneyRedHat
Copy link
Member

All kinds of test unhappiness @rhatdan

@rhatdan
Copy link
Member Author

rhatdan commented Oct 14, 2021

imagebuildah/executor.go Outdated Show resolved Hide resolved
Users have accidently had a .containerignore or .dockerignore
file in their context directly which blocked all content.
Currently we report that no globs matched, but do not
identify where the globs came from.

This change is an attempt to add this data to the error.
Example: containers#3318

Signed-off-by: Daniel J Walsh <[email protected]>
@TomSweeneyRedHat
Copy link
Member

LGTM
would like a final head nod from @nalind to make sure his concerns were addressed.

@nalind
Copy link
Member

nalind commented Oct 15, 2021

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants