mirror of
https://github.com/cooperspencer/gickup
synced 2024-10-18 07:38:08 +02:00
added interval
This commit is contained in:
parent
082821bfb9
commit
ce41bb2882
@ -199,6 +199,7 @@ destination:
|
||||
user: some-name # can be a user or an organization, it must exist on the system
|
||||
url: http(s)://url-to-gitea
|
||||
createorg: true # creates an organization if it doesn't exist already, if no user is set it creates an organization with the name of the original author
|
||||
mirrorinterval: 2h0m0s # interval to pull changes from source repo
|
||||
visibility:
|
||||
repositories: private # private, public, default: private
|
||||
organizations: private # private, limited, public, default: private
|
||||
|
@ -100,27 +100,29 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) bool {
|
||||
repo, _, err := giteaclient.GetRepo(user.UserName, r.Name)
|
||||
if err != nil {
|
||||
opts := gitea.MigrateRepoOption{
|
||||
RepoName: r.Name,
|
||||
RepoOwner: user.UserName,
|
||||
Mirror: true,
|
||||
CloneAddr: r.URL,
|
||||
AuthToken: r.Token,
|
||||
Wiki: r.Origin.Wiki,
|
||||
Private: repovisibility,
|
||||
Description: r.Description,
|
||||
RepoName: r.Name,
|
||||
RepoOwner: user.UserName,
|
||||
Mirror: true,
|
||||
CloneAddr: r.URL,
|
||||
AuthToken: r.Token,
|
||||
Wiki: r.Origin.Wiki,
|
||||
Private: repovisibility,
|
||||
Description: r.Description,
|
||||
MirrorInterval: d.MirrorInterval,
|
||||
}
|
||||
|
||||
if r.Token == "" {
|
||||
opts = gitea.MigrateRepoOption{
|
||||
RepoName: r.Name,
|
||||
RepoOwner: user.UserName,
|
||||
Mirror: true,
|
||||
CloneAddr: r.URL,
|
||||
AuthUsername: r.Origin.User,
|
||||
AuthPassword: r.Origin.Password,
|
||||
Wiki: r.Origin.Wiki,
|
||||
Private: repovisibility,
|
||||
Description: r.Description,
|
||||
RepoName: r.Name,
|
||||
RepoOwner: user.UserName,
|
||||
Mirror: true,
|
||||
CloneAddr: r.URL,
|
||||
AuthUsername: r.Origin.User,
|
||||
AuthPassword: r.Origin.Password,
|
||||
Wiki: r.Origin.Wiki,
|
||||
Private: repovisibility,
|
||||
Description: r.Description,
|
||||
MirrorInterval: d.MirrorInterval,
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,6 +132,17 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) bool {
|
||||
Str("stage", "gitea").
|
||||
Str("url", d.URL).
|
||||
Msg(err.Error())
|
||||
log.Info().
|
||||
Str("stage", "gitea").
|
||||
Str("url", d.URL).
|
||||
Msgf("deleting %s again", types.Blue(r.Name))
|
||||
_, err = giteaclient.DeleteRepo(user.UserName, r.Name)
|
||||
if err != nil {
|
||||
log.Error().
|
||||
Str("stage", "gitea").
|
||||
Str("url", d.URL).
|
||||
Msgf("couldn't delete %s!", types.Red(r.Name))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
11
gogs/gogs.go
11
gogs/gogs.go
@ -103,6 +103,17 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) bool {
|
||||
Str("stage", "gogs").
|
||||
Str("url", d.URL).
|
||||
Msg(err.Error())
|
||||
log.Info().
|
||||
Str("stage", "gogs").
|
||||
Str("url", d.URL).
|
||||
Msgf("deleting %s again", types.Blue(r.Name))
|
||||
err = gogsclient.DeleteRepo(user.UserName, r.Name)
|
||||
if err != nil {
|
||||
log.Error().
|
||||
Str("stage", "gogs").
|
||||
Str("url", d.URL).
|
||||
Msgf("couldn't delete %s!", types.Red(r.Name))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -228,26 +228,27 @@ func (source Source) Count() int {
|
||||
|
||||
// GenRepo Generell Repo.
|
||||
type GenRepo struct {
|
||||
Token string `yaml:"token"`
|
||||
TokenFile string `yaml:"token_file"`
|
||||
User string `yaml:"user"`
|
||||
Organization string `yaml:"organization"`
|
||||
SSH bool `yaml:"ssh"`
|
||||
SSHKey string `yaml:"sshkey"`
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
URL string `yaml:"url"`
|
||||
Exclude []string `yaml:"exclude"`
|
||||
ExcludeOrgs []string `yaml:"excludeorgs"`
|
||||
Include []string `yaml:"include"`
|
||||
IncludeOrgs []string `yaml:"includeorgs"`
|
||||
Wiki bool `yaml:"wiki"`
|
||||
Starred bool `yaml:"starred"`
|
||||
CreateOrg bool `yaml:"createorg"`
|
||||
Visibility Visibility `yaml:"visibility"`
|
||||
Filter Filter `yaml:"filter"`
|
||||
Force bool `yaml:"force"`
|
||||
Contributed bool `yaml:"contributed"`
|
||||
Token string `yaml:"token"`
|
||||
TokenFile string `yaml:"token_file"`
|
||||
User string `yaml:"user"`
|
||||
Organization string `yaml:"organization"`
|
||||
SSH bool `yaml:"ssh"`
|
||||
SSHKey string `yaml:"sshkey"`
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
URL string `yaml:"url"`
|
||||
Exclude []string `yaml:"exclude"`
|
||||
ExcludeOrgs []string `yaml:"excludeorgs"`
|
||||
Include []string `yaml:"include"`
|
||||
IncludeOrgs []string `yaml:"includeorgs"`
|
||||
Wiki bool `yaml:"wiki"`
|
||||
Starred bool `yaml:"starred"`
|
||||
CreateOrg bool `yaml:"createorg"`
|
||||
Visibility Visibility `yaml:"visibility"`
|
||||
Filter Filter `yaml:"filter"`
|
||||
Force bool `yaml:"force"`
|
||||
Contributed bool `yaml:"contributed"`
|
||||
MirrorInterval string `yaml:"mirrorinterval"`
|
||||
}
|
||||
|
||||
// Visibility struct
|
||||
|
Loading…
Reference in New Issue
Block a user