Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Fixed race condition when loading PAT from access.yaml (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlouie authored Jul 4, 2019
1 parent 6fdae7a commit 8d86c79
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func Install(path string) (err error) {
return err
}

// Track access tokens across installations
accessTokens := map[string]string{}
results := core.WalkComponentTree(path, []string{}, func(path string, component *core.Component) (err error) {
log.Info(emoji.Sprintf(":point_right: Starting install for component: %s", component.Name))

Expand All @@ -42,15 +40,15 @@ func Install(path string) (err error) {
}

// Load access tokens and add them to the global token list. Do not overwrite if already present
if accessTokens, err = component.GetAccessTokens(); err == nil {
for repo, token := range accessTokens {
if _, exists := core.GitAccessTokens.Get(repo); !exists {
core.GitAccessTokens.Set(repo, token)
}
}
} else {
accessTokens, err := component.GetAccessTokens()
if err != nil {
return err
}
for repo, token := range accessTokens {
if _, exists := core.GitAccessTokens.Get(repo); !exists {
core.GitAccessTokens.Set(repo, token)
}
}

if err := component.Install(path, generator, accessTokens); err != nil {
return err
Expand Down

0 comments on commit 8d86c79

Please sign in to comment.