Skip to content

dagger do action options flags#2033

Merged
jlongtine merged 1 commit intodagger:mainfrom
jlongtine:action-input-flags
Apr 15, 2022
Merged

dagger do action options flags#2033
jlongtine merged 1 commit intodagger:mainfrom
jlongtine:action-input-flags

Conversation

@jlongtine
Copy link
Copy Markdown
Contributor

Had to recreate #1902 because of private -> public transition

Signed-off-by: Joel Longtine [email protected]

@jlongtine jlongtine requested a review from a team as a code owner April 4, 2022 20:01
@TomChv TomChv added go labels Apr 5, 2022
Copy link
Copy Markdown
Member

@TomChv TomChv left a comment

Choose a reason for hiding this comment

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

Is it ready to be reviewed? Last one was a draft and I still see unfinished things in the code

@jlongtine
Copy link
Copy Markdown
Contributor Author

Is it ready to be reviewed? Last one was a draft and I still see unfinished things in the code

@TomChv Not yet. Still need a run through of the DX with @shykes. Then I'll clean up all of the code and submit for review. I'll change it to draft. Forgot to do that when I created a new PR.

@jlongtine jlongtine marked this pull request as draft April 5, 2022 22:59
@jlongtine jlongtine force-pushed the action-input-flags branch 2 times, most recently from e008cc1 to 99fe6d7 Compare April 7, 2022 20:47
@jlongtine jlongtine linked an issue Apr 11, 2022 that may be closed by this pull request
@helderco
Copy link
Copy Markdown
Contributor

Hey @jlongtine, I need this for #1351. What do you need to move forward?

1 similar comment
@helderco

This comment was marked as duplicate.

@shykes
Copy link
Copy Markdown
Contributor

shykes commented Apr 13, 2022

Hey @jlongtine, I need this for #1351. What do you need to move forward?

We went through DX together, it all looks good, no issue on my end (unless something changed in the last couple days).

@jlongtine
Copy link
Copy Markdown
Contributor Author

@helderco @shykes I had set this aside to focus on #1711, then got caught up in the gears on that one. I was planning on trying to get unblocked there, then moving back onto this. Happy to re-arrange priorities, if need be.

@jlongtine
Copy link
Copy Markdown
Contributor Author

@helderco After a chat with @aluzzardi, I'm going to focus on this and get it across the line.

@shykes
Copy link
Copy Markdown
Contributor

shykes commented Apr 13, 2022

We're rooting for you @jlongtine :)

@aluzzardi aluzzardi removed the go label Apr 13, 2022
@jlongtine jlongtine force-pushed the action-input-flags branch 8 times, most recently from 7c80b01 to a984fc6 Compare April 13, 2022 20:26
@jlongtine jlongtine marked this pull request as ready for review April 13, 2022 20:38
@jlongtine jlongtine requested a review from helderco as a code owner April 13, 2022 20:38
@jlongtine
Copy link
Copy Markdown
Contributor Author

jlongtine commented Apr 13, 2022

Because I'm actually checking to see if the request path is an action (i.e. has a cue/flow Task in it), this causes a behavioral change (hence the change in bats tests). I'm not currently sure how to maintain the current main behavior and give nice help messages when someone asks for an action that we don't have in our data structures. This is related to #1789.

@helderco
Copy link
Copy Markdown
Contributor

helderco commented Apr 13, 2022

I see. I think that's ok to change. Instead of allowing to dagger do a scalar, only allow running actions (i.e., anything that includes a core action no matter the depth). Makes sense to me.

@helderco
Copy link
Copy Markdown
Contributor

helderco commented Apr 13, 2022

In the case of the push.cue test:

		pullOutputFile: core.#ReadFile & {
			input: pull.output
			path:  "/output.txt"
+		} & {
+			// Check output file in the pulled image
+			contents: randomString.contents
		}
-
-		// Check output file in the pulled image
-		pullContent: string & pullOutputFile.contents & randomString.contents

@jlongtine
Copy link
Copy Markdown
Contributor Author

@helderco That test is still valid, actually. CUE will fill those values and check that they are the same.

@helderco
Copy link
Copy Markdown
Contributor

helderco commented Apr 13, 2022

I know, but you seem to have had to change bats to target pullOutputFile instead of pullContent. Wasn't that because you can't target pullContent with this PR?

@jlongtine
Copy link
Copy Markdown
Contributor Author

I know, but you seem to have had to change bats to target pullOutputFile instead of pullContent. Wasn't that because you can't target pullContent with this PR?

Yes, that's correct.

@shykes
Copy link
Copy Markdown
Contributor

shykes commented Apr 14, 2022

Just flagging a potential issue: I've actually ended up writing pure cue actions in at least once case, when I only process inputs without the need for core actions. This is how I hit #1789. Is it possible to ensure that regular structs are taken into account by dagger do, and listed in the help message?

I think in the future this problem might go away with #1598, if it defines an explicit dagger.#Action that action developers must extend. Then we would no longer have to guess: only instances of that definition would count as an action.

@helderco
Copy link
Copy Markdown
Contributor

Is it possible to ensure that regular structs are taken into account by dagger do, and listed in the help message?

It would be great, problem is, cue/flow doesn't run those.

@shykes
Copy link
Copy Markdown
Contributor

shykes commented Apr 14, 2022

Is it possible to ensure that regular structs are taken into account by dagger do, and listed in the help message?

It would be great, problem is, cue/flow doesn't run those.

I don't think it needs to, as long as it runs the client actions wired to it (both inputs and outputs).

@helderco
Copy link
Copy Markdown
Contributor

helderco commented Apr 14, 2022

Yes, true. There's still the case of targetting a scalar or something that doesn't reference core actions eventually, but maybe that's out of scope for this PR.

Anyway, what should happen with pullContent above? I'd say no inputs/outputs in that case. You can wrap a struct over it to enable them.

@jlongtine jlongtine force-pushed the action-input-flags branch from a984fc6 to 2aad8b3 Compare April 15, 2022 15:11
Copy link
Copy Markdown
Contributor

@aluzzardi aluzzardi left a comment

Choose a reason for hiding this comment

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

Looks good! Left a minor comment

@jlongtine jlongtine force-pushed the action-input-flags branch from 2aad8b3 to 71f6250 Compare April 15, 2022 19:54
Signed-off-by: Joel Longtine <[email protected]>
@jlongtine jlongtine force-pushed the action-input-flags branch from 71f6250 to dae0ee1 Compare April 15, 2022 19:54
@jlongtine jlongtine merged commit bc6e6c0 into dagger:main Apr 15, 2022
@helderco helderco mentioned this pull request Apr 21, 2022
Copy link
Copy Markdown
Contributor

@helderco helderco left a comment

Choose a reason for hiding this comment

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

Just now realized I may have not submitted these comments. They were pending, from before merging.

Comment on lines 217 to 218
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wrong condition.

plan/action.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion:

const ScalarKind cue.Kind = cue.StringKind | cue.NumberKind | cue.BoolKind
...
validKind := ik.IsAnyOf(ScalarKind)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dagger do: expose input fields as command-line flags

5 participants