dagger / dagger

An engine to run your pipelines in containers
https://dagger.io
Apache License 2.0
11.49k stars 615 forks source link

✨ Passing auth to Dagger commands can become tedious #8286

Open nipuna-perera opened 2 months ago

nipuna-perera commented 2 months ago

What are you trying to do?

Many commands that I run especially in a corporate environment require authentication of some sort. Typically this is username/password but sometimes it could be a certain file or token too.

Why is this important to you?

When using Dagger modules it's typical to split certain functionality into it's own functions and each function can end up requiring to consumer to enter credentials. Examples:

This can become tedious.

How are you currently working around this?

No known workarounds at this point other than passing in user/pass/tokens or files for every command utilizing these CLIs.

theEndBeta commented 2 months ago

This would be fantastic - I consider this a barrier for wide adoption where I work.

The main resource I am concerned with is AWS - between SecretsManager, Parameter Store, ECS, and CodeArtifact, practically all of our commands need AWS credentials. This means two - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY - for most CI, plus AWS_SESSION_TOKEN token when being run directly by a user with SSO login.

MikaelElkiaer commented 2 months ago

Not a perfect solution, but what I have tried to do in my module is this:

  1. Set up creds in the "Main" module
  2. Utilize the creds in the submodules, setting up a base container used for most functions:
    1. https://github.com/MikaelElkiaer/daggerverse/blob/fb581b4e35e67ae9a83ba7e1ebeeb09abac262a9/helm.go#L331
    2. https://github.com/MikaelElkiaer/daggerverse/blob/fb581b4e35e67ae9a83ba7e1ebeeb09abac262a9/helm.go#L354
    3. https://github.com/MikaelElkiaer/daggerverse/blob/fb581b4e35e67ae9a83ba7e1ebeeb09abac262a9/dotnet.go#L166