Skip to content

CLI: don't hide id from core types #6710

Closed as not planned
Closed as not planned

Description

@shykes

Problem

When calling a function that returns a core type, like Container or Directory, I can then call any function from that core type... except id.

This makes it unnecessarily difficult to stitch together calls in a shell script, for example:

dagger call deploy --build="$(dagger call build --src . id)"

One workaround is to call sync, but that's confusing if I'm trying to get the object's ID to pass it to another function call. id is exactly what I'm looking for.

Activity

  1. sipsma commented on Mar 21, 2024

    @sipsma
    Contributor

    This has been discussed elsewhere, but for posterity here, one blocker on supporting dagger call deploy --build="$(dagger call build --src . id)" is that we'd need the CLI to know how to see that the value in that case is an ID as opposed to a path on the host and use that ID instead. I think this is possible in a mostly unambiguous way, but would be a separate issue from allowing id to be used from dagger call in the first place.


    The reasons we started out with not allowing id to be accessed from dagger call were:

    • It may imply that IDs are safe to be re-used, but they aren't currently. Specifically any IDs that reference local dirs or secrets won't be guaranteed reproducible.
      • This would just result in an error in the worst case, so it's not like it would be unsafe, just a confusing footgun
      • It's also highly possible to introspect IDs and determine if they are reproducible, in which case we could have the CLI at minimum print a warning or something
    • We weren't sure if we really wanted to encourage this type of "stitching" from the CLI level relative to users just writing a function that does this.

    None of those are complete blockers of course, more philosophical type concerns, so I'm personally not utterly opposed to allowing it to be called from the CLI if there's a use case where it's the only viable option and the footguns around reproducibility aren't a concern.

  2. added
    area/cli
    on Aug 1, 2024
  3. shykes commented on Dec 6, 2024

    @shykes
    ContributorAuthor

    This is made irrelevant by the shell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/clikind/proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions