-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (36 loc) · 1001 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"context"
"errors"
"github.com/mcblair/dagger-repro/.dagger/internal/dagger"
)
type DaggerRepro struct {
// +private
Source *dagger.Directory
// +private
GoToolchain *GoToolchain
}
func New(
ctx context.Context,
// Directory containing source code.
// +optional
// +defaultPath="/"
// +ignore=[".dagger", ".github"]
source *dagger.Directory,
// Secret containing Github PAT for cloning private GH repos on CI machines.
// +optional
githubToken *dagger.Secret,
// Directory containing SSH credentials for cloning private GH repos on dev machines.
// +optional
sshDir *dagger.Directory,
) (*DaggerRepro, error) {
if githubToken == nil && sshDir == nil {
return nil, errors.New("gh-token or ssh-dir is required")
} else if githubToken != nil && sshDir != nil {
return nil, errors.New("gh-token and ssh-dir cannot be used together")
}
return &DaggerRepro{
Source: source,
GoToolchain: NewGoToolchain("1.23.1", githubToken, sshDir),
}, nil
}