Created
October 19, 2023 20:11
-
-
Save stobias123/31cdd19d2dd9cf7c979f7225a317d6b7 to your computer and use it in GitHub Desktop.
Dagger Whoops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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