Skip to content

Instantly share code, notes, and snippets.

@stobias123
Created October 19, 2023 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stobias123/31cdd19d2dd9cf7c979f7225a317d6b7 to your computer and use it in GitHub Desktop.
Save stobias123/31cdd19d2dd9cf7c979f7225a317d6b7 to your computer and use it in GitHub Desktop.
Dagger Whoops
package main
import (
"context"
"os"
"dagger.io/dagger"
log "github.com/sirupsen/logrus"
)
func main() {
var err error
ctx := context.Background()
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout), dagger.WithLogOutput(os.Stderr))
if err != nil {
log.Error(err)
}
gitUrlRaw := "https://username:please-dont-print@github.com/dagger/dagger"
c.SetSecret("ghApiToken", gitUrlRaw)
src := c.Git(gitUrlRaw, dagger.GitOpts{KeepGitDir: true}).
Branch("main").
Tree()
c.Container().WithMountedDirectory("/src", src).WithExec([]string{"ls", "-la", "/src"}).Stdout(ctx)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment