Skip to content

CLI: decide whether to support id or to continue hiding #6360

Closed

Description

@sipsma

Right now #6293 went with hiding id fields on types from the CLI because IDs are not generally safe to re-use across sessions.

However, #6297 will drastically improve the ID system and opens the possibility of allowing IDs to be re-used in some circumstances. We can thus consider whether to embrace that in the CLI and add some mechanism for getting the IDs of objects and re-use those.

To be clear, this isn't super high priority, the status quo of hiding ids is fine for now and we should theoretically be able to make adjustments here in the future in backwards compatible way.

cc @vito

Activity

  1. added
    area/cli
    on Jan 3, 2024
  2. helderco commented on Jan 3, 2024

    @helderco
    Contributor

    Yeah, sounds good to hide for now. Should at least hide from sync as well but that's in:

  3. helderco commented on Jan 29, 2024

    @helderco
    Contributor

    As I described in #6517 I think it’s best to ignore/hide IDs for now until the use case surfaces, at which point we'll create a new issue to bring ids into the foreground.

  4. shykes commented on Feb 21, 2024

    @shykes
    Contributor

    FYI the use case is there. I need id, and so will everyone composing dagger call in a shell script. 🙏 .

  5. helderco commented on Feb 21, 2024

    @helderco
    Contributor

    I also considered what @sipsma said in:

    However, #6297 will drastically improve the ID system and opens the possibility of allowing IDs to be re-used in some circumstances.

    Is it confirmed that IDs are stable now to be used in this way? Only in certain cases? Which cases?

  6. sipsma commented on Feb 22, 2024

    @sipsma
    ContributorAuthor

    No the new ID system opens up a path to plausibly making IDs generally re-usable across sessions but it still requires more work.

    The biggest source of problems are local dirs, but there's some others like secrets too. We can't make all IDs perfectly reusable but it's theoretically possible to make them re-usable for a certain amount of time (and then error clearly once they expire).

    I'm also not convinced we really should do this since it just encourages wrapping the CLI rather than writing modules that implement the logic (and thus avoid the need for persisting IDs for re-use across sessions).

  7. shykes commented on Feb 22, 2024

    @shykes
    Contributor

    @sipsma if I wrap my shell in a persistent session ie. dagger run sh, then are IDs guaranteed to work across commands of that shell?

  8. sipsma commented on Feb 22, 2024

    @sipsma
    ContributorAuthor

    @shykes I think so yes (at least, I can't think of why it wouldn't work off the top of my head). We'd still need the CLI to support providing ID strings as arguments to functions for all IDable types.

    In the choice between A) investing time in doing this vs. B) investing time in alternative solutions like #5774, I'd vote for B). Just because I think it will result in a better end experience.

  9. shykes commented on Feb 22, 2024

    @shykes
    Contributor

    We'd still need the CLI to support providing ID strings as arguments to functions for all IDable types.

    Does that boil down to exposing core functions to the CLI? Or does it involve more than that?

    In the choice between A) investing time in doing this vs. B) investing time in alternative solutions like #5774, I'd vote for B)

    Makes sense. I think those two things might converge eventually (eg. one valuable scripting language for us to support would be bash).

  10. sipsma commented on Feb 22, 2024

    @sipsma
    ContributorAuthor

    Does that boil down to exposing core functions to the CLI? Or does it involve more than that?

    No it's just that right now when you e.g. dagger call fn --dir-arg foobar (where --dir-arg is of type Directory), the CLI assumes the value of the arg is a path to a local dir. But now we'd need it to be able to identify args as being in an ID format and use those instead of trying to interpret as a path. Wouldn't be that hard or anything (the corner cases are obscure enough to ignore), just was noting it wouldn't work out of the box even when wrapping in dagger run yet.

  11. shykes commented on Feb 22, 2024

    @shykes
    Contributor

    Does that boil down to exposing core functions to the CLI? Or does it involve more than that?

    No it's just that right now when you e.g. dagger call fn --dir-arg foobar (where --dir-arg is of type Directory), the CLI assumes the value of the arg is a path to a local dir. But now we'd need it to be able to identify args as being in an ID format and use those instead of trying to interpret as a path. Wouldn't be that hard or anything (the corner cases are obscure enough to ignore), just was noting it wouldn't work out of the box even when wrapping in dagger run yet.

    Oh, right! Duh.

  12. removed
    area/cli
    on May 31, 2024
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions