Skip to content

Commit

Permalink
Handle private Go modules
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 24, 2020
1 parent 36abffc commit 4277e0b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
22 changes: 16 additions & 6 deletions cmds/release_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,15 @@ func PrepareProject(gh *github.Client, sh *shell.Session, releaseTracker, repoUR
if err != nil {
panic(err)
}
if vcs != repoURL {
gm.VCSRoot = vcs
if vcs == "" {
// private module
modPath = ""
} else {
if vcs != repoURL {
gm.VCSRoot = vcs
}
modCache[modPath] = gm
}
modCache[modPath] = gm
}
}

Expand Down Expand Up @@ -787,10 +792,15 @@ func ReleaseProject(sh *shell.Session, releaseTracker, repoURL string, project a
if err != nil {
panic(err)
}
if vcs != repoURL {
gm.VCSRoot = vcs
if vcs == "" {
// private module
modPath = ""
} else {
if vcs != repoURL {
gm.VCSRoot = vcs
}
modCache[modPath] = gm
}
modCache[modPath] = gm
}

tags := project.Tags
Expand Down
3 changes: 2 additions & 1 deletion lib/gomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func DetectVCSRoot(repoURL string) (string, error) {

// GoImport: stash.appscode.dev/cli git https://github.com/stashed/cli
if data.GoImport == "" {
return "", fmt.Errorf("%s is missing go-import meta tag", uRepo.String())
fmt.Printf("%s is missing go-import meta tag", uRepo.String())
return "", nil
}
fmt.Printf("GoImport: %s\n", data.GoImport)

Expand Down
8 changes: 8 additions & 0 deletions main_extras.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ import (
"sigs.k8s.io/yaml"
)

func main_DetectVCSRoot() {
vcs, err := lib.DetectVCSRoot("github.com/appscode/stash-enterprise")
if err != nil {
panic(err)
}
fmt.Println(vcs)
}

func main_RepoURL2EnvKey() {
fmt.Println(lib.RepoURL2EnvKey("http://github.com/kubedb/mysql-replication-mode-detector"))
fmt.Println(lib.RepoURL2EnvKey("github.com/kubedb/mysql-replication-mode-detector"))
Expand Down

0 comments on commit 4277e0b

Please sign in to comment.