Skip to content

[Feature] Missing dagger input list style feature in Europa #1806

Closed

Description

@hongchaodeng

In v0.1 , you can list all the fields that needs to input with type and description:

$ dagger input list
Name      Type         Description
token     string       Token to access Github

But in v0.2, you can not list the inputs in client:

	client: {
		filesystem: {
			".": read: {...}
			build: write: contents: actions.build.contents.output
		}
		env: {
			APP_NAME:      string
			NETLIFY_TEAM:  string
			NETLIFY_TOKEN: dagger.#Secret
		}
	}

Here, the path to read and write, envs, are all inputs to the plan. How can I show their type and description? It would be great if dagger could provide an API to interact with.

Activity

  1. helderco commented on Mar 15, 2022

    @helderco
    Contributor

    In Europa there's no need to setup inputs before hand, you just declare them in your plan. The way inputs worked before was very different. We dropped that concept now.

    What is your use case for needing the input list in Europa?

  2. hongchaodeng commented on Mar 15, 2022

    @hongchaodeng
    ContributorAuthor

    We just want to print out what envs that user needs to input.

    We will add another layer to translate key=value env to CUE like the following:

    User input:

    APP_NAME=my-app
    TOKEN="xxx"
    

    CUE:

    client: env: {
      APP_NAME: my-app
      TOKEN: "xxx"
    }
    

    But we want to let users know that APP_NAME and TOKEN are inputs they can specify.

  3. TomChv commented on Mar 15, 2022

    @TomChv
    Member

    Basically if you do not set those inputs, plan will fail to start

  4. helderco commented on Mar 15, 2022

    @helderco
    Contributor

    These are just environment variables, do you need other types of inputs?

  5. helderco commented on Mar 15, 2022

    @helderco
    Contributor

    By the way, I feel the same way about #1351, but with outputs. There's a PR (#1486) but we need more discussion for it in Europa.

    I think the best way to resolve your case is to create an output that you control yourself.

    Let's say we go ahead with having outputs defined in actions:

    #Spec: {
        // Something that makes sense for you.
        // You can have a group for env vars, others for other types of inputs,
        // with specific messages on how to set them up (e.g., file with KEY=value).
        [name=string]: {
            description: string
            type: string | dagger.#Secret
        }
    }
    
    dagger.#Plan & {
        client: env: {
            // generate from an instance of #Spec
        }
        actions: {
            input_list: #InputList & {
                // generate output from instance of #Spec
            }
            ...
        }
    }

    Then you call this action for the list:

    dagger do input_list

    @shykes WDYT?

  6. gerhard commented on Mar 15, 2022

    @gerhard
    Contributor

    While we currently list actions by default when running dagger do, I think that we should also list client commands, filesystems and envs too. cc @aluzzardi

  7. shykes commented on Mar 16, 2022

    @shykes
    Contributor

    I think the ideal form would be to add the client resources required by each individual action, as part of the usage message of that action. This has the benefit of taking a first step towards a much-needed security model, similar to eg. iOS sandboxing. “this action interacts with the client system in the following ways:”. Later we could make an interactive prompt as well.

  8. hongchaodeng commented on Mar 16, 2022

    @hongchaodeng
    ContributorAuthor

    “this action interacts with the client system in the following ways:”. Later we could make an interactive prompt as well.

    Awesome! The interactive prompt sounds great idea as well :+1

  9. shykes commented on Mar 27, 2022

    @shykes
    Contributor

    @jlongtine I'm adding this on your radar, since you're working on improvements to the CLI at the moment.

  10. shykes commented on Jun 17, 2022

    @shykes
    Contributor

    I believe this is solved, you can pass inputs as command-line flags, and list available inputs with dagger do --help.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions