fixup for 2fa auth in gitea
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -246,39 +246,39 @@ func Execute(ctx context.Context, gitSource source.SourceControl, mvs map[string
|
||||
if mod, ok = mvs[path]; !ok {
|
||||
logger.Fatal(ctx, fmt.Sprintf("For %s update not exist", path))
|
||||
}
|
||||
logger.Debugf(ctx, fmt.Sprintf("Start update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
logger.Debug(ctx, fmt.Sprintf("Start update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
for _, branch := range cfg.Branches {
|
||||
if err := gitSource.RequestOpen(ctx, branch, path, mod); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to create pr: %v", err))
|
||||
}
|
||||
}
|
||||
logger.Debugf(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
logger.Debug(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
return
|
||||
}
|
||||
for _, branch := range cfg.Branches { // update all dep
|
||||
for path, mod = range mvs {
|
||||
logger.Debugf(ctx, fmt.Sprintf("Start update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
logger.Debug(ctx, fmt.Sprintf("Start update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
err := gitSource.RequestOpen(ctx, branch, path, mod)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "already exists") {
|
||||
logger.Debugf(ctx, fmt.Sprintf("skip %s, branch already exists"), path)
|
||||
logger.Debug(ctx, fmt.Sprintf("skip %s, branch already exists", path))
|
||||
continue
|
||||
}
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to create pr: %v", err))
|
||||
}
|
||||
logger.Debugf(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
logger.Debug(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
}
|
||||
}
|
||||
case "close":
|
||||
if cliCfg.Path != "" { // close one dep
|
||||
path = cliCfg.Path
|
||||
logger.Debugf(ctx, fmt.Sprintf("Start close for %s", path))
|
||||
logger.Debug(ctx, fmt.Sprintf("Start close for %s", path))
|
||||
for _, branch := range cfg.Branches {
|
||||
if err := gitSource.RequestClose(ctx, branch, path); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to close pr: %v", err))
|
||||
}
|
||||
}
|
||||
logger.Debugf(ctx, fmt.Sprintf("Close successful for %s", path))
|
||||
logger.Debug(ctx, fmt.Sprintf("Close successful for %s", path))
|
||||
return
|
||||
}
|
||||
for _, branch := range cfg.Branches {
|
||||
@@ -292,11 +292,11 @@ func Execute(ctx context.Context, gitSource source.SourceControl, mvs map[string
|
||||
logger.Info(ctx, fmt.Sprintf("Start close pr for base branch %s", branch))
|
||||
|
||||
for path, _ = range rMap {
|
||||
logger.Debugf(ctx, fmt.Sprintf("Start close for %s", path))
|
||||
logger.Debug(ctx, fmt.Sprintf("Start close for %s", path))
|
||||
if err = gitSource.RequestClose(ctx, branch, path); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to close pr: %v", err))
|
||||
}
|
||||
logger.Debugf(ctx, fmt.Sprintf("Close successful for %s", path))
|
||||
logger.Debug(ctx, fmt.Sprintf("Close successful for %s", path))
|
||||
}
|
||||
}
|
||||
case "list":
|
||||
@@ -351,8 +351,11 @@ func getRepoMgmt(ctx context.Context, cfg *configcli.Config) error {
|
||||
if cfg.Source.Owner == "" {
|
||||
cfg.Source.Owner = n.Machine(cfg.Source.APIURL).Get("login")
|
||||
}
|
||||
if cfg.Source.Token == "" {
|
||||
cfg.Source.Token = n.Machine(cfg.Source.APIURL).Get("password")
|
||||
if cfg.Source.Username == "" {
|
||||
cfg.Source.Username = n.Machine(cfg.Source.APIURL).Get("login")
|
||||
}
|
||||
if cfg.Source.Password == "" {
|
||||
cfg.Source.Password = n.Machine(cfg.Source.APIURL).Get("password")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user