-
Notifications
You must be signed in to change notification settings - Fork 561
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
feat: supportAllowWildCard
and AllowNotFound
#7437
base: main
Are you sure you want to change the base?
feat: supportAllowWildCard
and AllowNotFound
#7437
Conversation
Fixes dagger#3338 Signed-off-by: Tom Chauveau <tom@epitech.eu>
When we removed mage, we removed the easy helpers that allowed generating/linting/etc on all SDKs. That meant that making API changes became much more fiddly. This patch restores the "all" group, but this time directly in the dagger module. One day, we might remove this with a script, but we don't have that right now. Signed-off-by: Justin Chadwell <me@jedevc.com>
This can be done by attaching an optional signal argument to the existing `stop` method (which will wait until the process terminates after sending `stop`), or using the new `signal` method (which returns immediately). Signed-off-by: Justin Chadwell <me@jedevc.com>
Without this, the metadata would not be passed for a required enum arg. Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Tom Chauveau <tom@epitech.eu>
ArgDoc("path", `Location of the file to remove (e.g., "/file.txt").`). | ||
ArgDoc("allowWildCard", `Allow wildcards in the path (e.g., "*.txt").`). | ||
ArgDoc("allowNotFound", `Allow the operation to not fail if the directory does not exist.`), |
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.
FYI - we would also want this on container
. Side note (and not sure how to resolve this), it feels weird that we have so much repetition with the 4 methods here - Container/File
.withoutFile
/withoutDirectory
.
Based in this discussion: https://discord.com/channels/707636530424053791/1240714480275689574/1242807626723491921 we're going to hold this PR for the next release and find a better API design. There's still that strange issue where my parameter are not considered, even in the issue, I'm not sure what's the root cause. |
path = filepath.Join(dir.Dir, path) | ||
err = dir.SetState(ctx, st.File(llb.Rm(path, llb.WithAllowWildcard(true), llb.WithAllowNotFound(true)))) |
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.
Huh. I didn't know we defaulted to this.
This feels slightly inconsistent with other stuff - see another discussion on magic processing in #7173. A bit strange that some paths can be globs/wildcards/expansions and some aren't.
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.
Yes definitely, I think that's why we wanted to add the parameter.
@@ -521,6 +521,13 @@ func TestDirectoryWithoutDirectoryWithoutFile(t *testing.T) { | |||
require.NoError(t, err) | |||
require.Equal(t, []string{"some-dir", "some-file"}, entries) | |||
|
|||
// Test without dir with allow not found = false | |||
_, err = dir1. | |||
WithoutDirectory("non-existant", dagger.DirectoryWithoutDirectoryOpts{AllowNotFound: false}). |
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.
@TomChv this is your issue.
In go, the empty struct defaults to false
- therefore, we have the API constraint today that all boolean options must default to false.
What you need is to invert the option, to something like MustExist: true
, so that the default is false
.
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Fixes #3338
I'm doing a push to see if I hit the same behaviour in the CI (maybe it's due to some reloading or cache in the API)