github.com/octohelm/wagon@v0.0.0-20240308040401-88662650dc0b/pkg/engine/plan/task/core/auth.go (about)

     1  package core
     2  
     3  import (
     4  	"context"
     5  
     6  	"dagger.io/dagger"
     7  	"github.com/octohelm/wagon/pkg/engine/daggerutil"
     8  )
     9  
    10  type Auth struct {
    11  	Username string `json:"username"`
    12  	Secret   Secret `json:"secret"`
    13  }
    14  
    15  func (a Auth) ApplyTo(ctx context.Context, ct *dagger.Container, address string) *dagger.Container {
    16  	c := daggerutil.ClientContext.From(ctx)
    17  	return ct.WithRegistryAuth(address, a.Username, c.LoadSecretFromID(a.Secret.SecretID()))
    18  }