From 0ca78b015e2fe3eec54886e7c06235f53473af0b Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 15 Sep 2022 10:31:38 +0200 Subject: [PATCH 01/10] with gitea server --- _examples/actions/write_a_readme/kraken.yml | 2 +- go.mod | 2 + go.sum | 10 ++++ internal/gitproviders/gitea.go | 66 +++++++++++++++++++++ internal/serverdeps/server_deps.go | 5 ++ 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 internal/gitproviders/gitea.go diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index 77db45b..38ac8e1 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -138,7 +138,7 @@ select: - git@git.front.kjuulh.io:kjuulh/kraken-test.git - git@git.front.kjuulh.io:kjuulh/kraken-test.git providers: - - gitea: git.front.kjuulh.io/kraken + - gitea: git.front.kjuulh.io organisation: "kraken" actions: - type: go diff --git a/go.mod b/go.mod index cd1b597..9b543eb 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( ) require ( + code.gitea.io/sdk/gitea v0.15.1 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/ProtonMail/go-mime v0.0.0-20220302105931-303f85f7fe0f // indirect github.com/acomagu/bufpipe v1.0.3 // indirect @@ -30,6 +31,7 @@ require ( github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/validator/v10 v10.10.0 // indirect github.com/goccy/go-json v0.9.7 // indirect + github.com/hashicorp/go-version v1.2.1 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect diff --git a/go.sum b/go.sum index 03a8012..9f45bfb 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,6 @@ +code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE= +code.gitea.io/sdk/gitea v0.15.1 h1:WJreC7YYuxbn0UDaPuWIe/mtiNKTvLN8MLkaw71yx/M= +code.gitea.io/sdk/gitea v0.15.1/go.mod h1:klY2LVI3s3NChzIk/MzMn7G1FHrfU7qd63iSMVoHRBA= git.front.kjuulh.io/kjuulh/curre v1.2.2 h1:0OwWIfekrMykdQg9bdmG80I+Mjc2k4i+sy903phuDWs= git.front.kjuulh.io/kjuulh/curre v1.2.2/go.mod h1:m7WpSehONLqPh/XF3F0BI0UOpLOfGuDmDEFI1XsM6fE= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -71,6 +74,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= +github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= @@ -151,6 +156,7 @@ github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95 github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xanzy/ssh-agent v0.3.2 h1:eKj4SX2Fe7mui28ZgnFW5fmTz1EIr7ugo5s6wDxdHBM= github.com/xanzy/ssh-agent v0.3.2/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= @@ -184,10 +190,12 @@ golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= @@ -195,6 +203,7 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -233,6 +242,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/gitproviders/gitea.go b/internal/gitproviders/gitea.go new file mode 100644 index 0000000..536fe16 --- /dev/null +++ b/internal/gitproviders/gitea.go @@ -0,0 +1,66 @@ +package gitproviders + +import ( + "context" + "fmt" + "sync" + + "code.gitea.io/sdk/gitea" + "go.uber.org/zap" +) + +type Gitea struct { + logger *zap.Logger + giteamu sync.Mutex + giteaClients map[string]*gitea.Client +} + +func NewGitea(logger *zap.Logger) *Gitea { + return &Gitea{ + logger: logger, + } +} + +func (g *Gitea) ListRepositoriesForOrganization(ctx context.Context, server string, organization string) ([]string, error) { + client, err := g.getOrCreateClient(ctx, server) + if err != nil { + return nil, err + } + + repos, resp, err := client.ListOrgRepos(organization, gitea.ListOrgReposOptions{ + ListOptions: gitea.ListOptions{ + Page: 0, + PageSize: 0, + }, + }) + if err != nil { + return nil, err + } + + if resp.StatusCode >= 300 { + return nil, fmt.Errorf("gitea responded with a non 200 status code (gitea response: %s)", resp.Status) + } + + repoUrls := make([]string, len(repos)) + for i, repo := range repos { + repoUrls[i] = repo.SSHURL + } + + return repoUrls, err +} + +func (g *Gitea) getOrCreateClient(ctx context.Context, server string) (*gitea.Client, error) { + g.giteamu.Lock() + defer g.giteamu.Unlock() + client, ok := g.giteaClients[server] + if !ok { + c, err := gitea.NewClient(server) + if err != nil { + return nil, nil + } + g.giteaClients[server] = c + return c, nil + } + + return client, nil +} diff --git a/internal/serverdeps/server_deps.go b/internal/serverdeps/server_deps.go index d81c052..da9c333 100644 --- a/internal/serverdeps/server_deps.go +++ b/internal/serverdeps/server_deps.go @@ -2,6 +2,7 @@ package serverdeps import ( actionc "git.front.kjuulh.io/kjuulh/kraken/internal/actions" + "git.front.kjuulh.io/kjuulh/kraken/internal/gitproviders" "git.front.kjuulh.io/kjuulh/kraken/internal/services/actions" "git.front.kjuulh.io/kjuulh/kraken/internal/services/providers" "git.front.kjuulh.io/kjuulh/kraken/internal/services/signer" @@ -64,6 +65,10 @@ func (deps *ServerDeps) GetActionCreator() *actionc.ActionCreator { return actionc.NewActionCreator(deps.logger.With(zap.Namespace("action")), deps) } +func (deps *ServerDeps) GetGitea() *gitproviders.Gitea { + return gitproviders.NewGitea(deps.logger.With(zap.Namespace("gitea"))) +} + func (deps *ServerDeps) GetOpenPGP() *signer.OpenPGP { return deps.openPGP } -- 2.45.2 From 04d1ffc971a4e58a2c4c6fa9d127c7ab01d2fb7d Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 15 Sep 2022 10:42:44 +0200 Subject: [PATCH 02/10] with process repos --- cmd/kraken/commands/process.go | 2 +- internal/commands/process_repos.go | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/cmd/kraken/commands/process.go b/cmd/kraken/commands/process.go index 274b299..81642ea 100644 --- a/cmd/kraken/commands/process.go +++ b/cmd/kraken/commands/process.go @@ -22,7 +22,7 @@ func CreateKrakenProcessCmd() *cobra.Command { Path string `json:"path"` }{ Repository: "git@git.front.kjuulh.io:kjuulh/kraken.git", - Branch: "feature/add-actions", + Branch: "feature/process_repos", Path: "_examples/actions/write_a_readme/", }) if err != nil { diff --git a/internal/commands/process_repos.go b/internal/commands/process_repos.go index d29a30b..614f0cf 100644 --- a/internal/commands/process_repos.go +++ b/internal/commands/process_repos.go @@ -7,6 +7,8 @@ import ( "time" "git.front.kjuulh.io/kjuulh/kraken/internal/actions" + "git.front.kjuulh.io/kjuulh/kraken/internal/gitproviders" + "git.front.kjuulh.io/kjuulh/kraken/internal/schema" "git.front.kjuulh.io/kjuulh/kraken/internal/services/providers" "git.front.kjuulh.io/kjuulh/kraken/internal/services/storage" "go.uber.org/zap" @@ -18,12 +20,14 @@ type ( storage *storage.Service git *providers.Git actionCreator *actions.ActionCreator + gitea *gitproviders.Gitea } ProcessReposDeps interface { GetStorageService() *storage.Service GetGitProvider() *providers.Git GetActionCreator() *actions.ActionCreator + GetGitea() *gitproviders.Gitea } ) @@ -33,6 +37,7 @@ func NewProcessRepos(logger *zap.Logger, deps ProcessReposDeps) *ProcessRepos { storage: deps.GetStorageService(), git: deps.GetGitProvider(), actionCreator: deps.GetActionCreator(), + gitea: deps.GetGitea(), } } @@ -48,7 +53,10 @@ func (pr *ProcessRepos) Process(ctx context.Context, repository string, branch s return err } - repositoryUrls := action.Schema.Select.Repositories + repositoryUrls, err := pr.getRepoUrls(ctx, action.Schema) + if err != nil { + return err + } wg := sync.WaitGroup{} wg.Add(len(repositoryUrls)) @@ -76,6 +84,23 @@ func (pr *ProcessRepos) Process(ctx context.Context, repository string, branch s return nil } +func (pr *ProcessRepos) getRepoUrls(ctx context.Context, schema *schema.KrakenSchema) ([]string, error) { + repoUrls := make([]string, 0) + + repoUrls = append(repoUrls, schema.Select.Repositories...) + + for _, provider := range schema.Select.Providers { + repos, err := pr.gitea.ListRepositoriesForOrganization(ctx, provider.Gitea, provider.Organisation) + if err != nil { + return nil, err + } + + repoUrls = append(repoUrls, repos...) + } + + return repoUrls, nil +} + func (pr *ProcessRepos) processRepo(ctx context.Context, repoUrl string, action *actions.Action) error { cleanup, area, err := pr.prepareAction(ctx) defer func() { -- 2.45.2 From 2c37384af575f2efcb70e73da1f92747034e7d04 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 15 Sep 2022 10:48:31 +0200 Subject: [PATCH 03/10] with https --- _examples/actions/write_a_readme/kraken.yml | 2 +- cmd/kraken/commands/process.go | 2 +- internal/gitproviders/gitea.go | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index 38ac8e1..336f229 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -138,7 +138,7 @@ select: - git@git.front.kjuulh.io:kjuulh/kraken-test.git - git@git.front.kjuulh.io:kjuulh/kraken-test.git providers: - - gitea: git.front.kjuulh.io + - gitea: https://git.front.kjuulh.io organisation: "kraken" actions: - type: go diff --git a/cmd/kraken/commands/process.go b/cmd/kraken/commands/process.go index 81642ea..342ebc4 100644 --- a/cmd/kraken/commands/process.go +++ b/cmd/kraken/commands/process.go @@ -22,7 +22,7 @@ func CreateKrakenProcessCmd() *cobra.Command { Path string `json:"path"` }{ Repository: "git@git.front.kjuulh.io:kjuulh/kraken.git", - Branch: "feature/process_repos", + Branch: "feature/gitea-integration", Path: "_examples/actions/write_a_readme/", }) if err != nil { diff --git a/internal/gitproviders/gitea.go b/internal/gitproviders/gitea.go index 536fe16..7af3ca5 100644 --- a/internal/gitproviders/gitea.go +++ b/internal/gitproviders/gitea.go @@ -27,10 +27,11 @@ func (g *Gitea) ListRepositoriesForOrganization(ctx context.Context, server stri return nil, err } + g.logger.Debug("Listing repos for gitea", zap.String("server", server)) repos, resp, err := client.ListOrgRepos(organization, gitea.ListOrgReposOptions{ ListOptions: gitea.ListOptions{ Page: 0, - PageSize: 0, + PageSize: 20, }, }) if err != nil { @@ -53,7 +54,7 @@ func (g *Gitea) getOrCreateClient(ctx context.Context, server string) (*gitea.Cl g.giteamu.Lock() defer g.giteamu.Unlock() client, ok := g.giteaClients[server] - if !ok { + if !ok || client == nil { c, err := gitea.NewClient(server) if err != nil { return nil, nil -- 2.45.2 From 2c9a70e13cca7a5c32e983b9d565bf59c72e9843 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 15 Sep 2022 10:50:39 +0200 Subject: [PATCH 04/10] with real org --- _examples/actions/write_a_readme/kraken.yml | 2 +- internal/gitproviders/gitea.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index 336f229..4ebe89b 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -139,7 +139,7 @@ select: - git@git.front.kjuulh.io:kjuulh/kraken-test.git providers: - gitea: https://git.front.kjuulh.io - organisation: "kraken" + organisation: "cibus" actions: - type: go entry: "main.go" diff --git a/internal/gitproviders/gitea.go b/internal/gitproviders/gitea.go index 7af3ca5..ea85d1e 100644 --- a/internal/gitproviders/gitea.go +++ b/internal/gitproviders/gitea.go @@ -17,7 +17,9 @@ type Gitea struct { func NewGitea(logger *zap.Logger) *Gitea { return &Gitea{ - logger: logger, + logger: logger, + giteamu: sync.Mutex{}, + giteaClients: make(map[string]*gitea.Client, 0), } } @@ -35,7 +37,7 @@ func (g *Gitea) ListRepositoriesForOrganization(ctx context.Context, server stri }, }) if err != nil { - return nil, err + return nil, fmt.Errorf("could not list repos: %w", err) } if resp.StatusCode >= 300 { -- 2.45.2 From 21108fbc10021b5a0d64e83d529346fa40b0b283 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 15 Sep 2022 10:51:25 +0200 Subject: [PATCH 05/10] With only 1 --- _examples/actions/write_a_readme/kraken.yml | 134 -------------------- 1 file changed, 134 deletions(-) diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index 4ebe89b..e4065e6 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -3,140 +3,6 @@ name: write-a-readme select: repositories: - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git providers: - gitea: https://git.front.kjuulh.io organisation: "cibus" -- 2.45.2 From 6686cb83921b2fac2d7fb065cce0e254f2dd2eed Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 15 Sep 2022 10:58:28 +0200 Subject: [PATCH 06/10] with many --- _examples/actions/write_a_readme/kraken.yml | 107 ++++++++++++++++++++ internal/commands/process_repos.go | 2 +- 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index e4065e6..697a1b3 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -3,6 +3,113 @@ name: write-a-readme select: repositories: - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git + - git@git.front.kjuulh.io:kjuulh/kraken-test.git providers: - gitea: https://git.front.kjuulh.io organisation: "cibus" diff --git a/internal/commands/process_repos.go b/internal/commands/process_repos.go index 614f0cf..becfb03 100644 --- a/internal/commands/process_repos.go +++ b/internal/commands/process_repos.go @@ -75,7 +75,7 @@ func (pr *ProcessRepos) Process(ctx context.Context, repository string, branch s wg.Wait() close(errChan) - pr.logger.Debug("finished processing all repos") + pr.logger.Debug("finished processing all repos", zap.Strings("repos", repositoryUrls)) for err := range errChan { return err -- 2.45.2 From 9ad10d07be016a59d1fd0e93d4885d3d8e4b91b7 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Fri, 16 Sep 2022 00:06:49 +0200 Subject: [PATCH 07/10] with one --- _examples/actions/write_a_readme/kraken.yml | 107 -------------------- roadmap.md | 1 + 2 files changed, 1 insertion(+), 107 deletions(-) diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index 697a1b3..e4065e6 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -3,113 +3,6 @@ name: write-a-readme select: repositories: - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git - - git@git.front.kjuulh.io:kjuulh/kraken-test.git providers: - gitea: https://git.front.kjuulh.io organisation: "cibus" diff --git a/roadmap.md b/roadmap.md index dbb3f3e..ef0f323 100644 --- a/roadmap.md +++ b/roadmap.md @@ -20,6 +20,7 @@ - [x] Setup a way to choose actions and predicates - [x] Allow instantiation of actions, kraken template repo etc. +- [ ] Implement docker action - [ ] Create pr for gitea provider - [ ] Think about some sort of isolation - [ ] Create CLI to trigger action -- 2.45.2 From e3a672f9f7b6bdf82bbab4d04a7313bca583cbb3 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 17 Sep 2022 17:54:51 +0200 Subject: [PATCH 08/10] add more cuddle --- cuddle.yaml | 6 ++++++ roadmap.md | 1 + scripts/run.sh | 15 +++++++++++++++ scripts/run_client.sh | 5 +++++ scripts/run_server.sh | 5 +++++ 5 files changed, 32 insertions(+) create mode 100755 scripts/run.sh create mode 100755 scripts/run_client.sh create mode 100755 scripts/run_server.sh diff --git a/cuddle.yaml b/cuddle.yaml index 8b285a2..87fafac 100644 --- a/cuddle.yaml +++ b/cuddle.yaml @@ -9,3 +9,9 @@ vars: scripts: push_github: type: shell + run_server: + type: shell + run_client: + type: shell + run: + type: shell diff --git a/roadmap.md b/roadmap.md index ef0f323..707d348 100644 --- a/roadmap.md +++ b/roadmap.md @@ -21,6 +21,7 @@ - [x] Setup a way to choose actions and predicates - [x] Allow instantiation of actions, kraken template repo etc. - [ ] Implement docker action +- [ ] Providing query results - [ ] Create pr for gitea provider - [ ] Think about some sort of isolation - [ ] Create CLI to trigger action diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 0000000..e2f75ac --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +run_server="cuddle_cli x run_server" + +$run_server & + +sleep 1s + +cuddle_cli x run_client + +sleep 5s + +kill %1 diff --git a/scripts/run_client.sh b/scripts/run_client.sh new file mode 100755 index 0000000..cfe216e --- /dev/null +++ b/scripts/run_client.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +go run cmd/kraken/kraken.go process diff --git a/scripts/run_server.sh b/scripts/run_server.sh new file mode 100755 index 0000000..6fb5602 --- /dev/null +++ b/scripts/run_server.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +go run cmd/server/server.go start -- 2.45.2 From eef25c4c7a5f4c3efabc6923323e365f237221b4 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 17 Sep 2022 18:28:38 +0200 Subject: [PATCH 09/10] Without cibus --- _examples/actions/write_a_readme/kraken.yml | 6 ++-- go.mod | 1 + go.sum | 2 ++ internal/commands/process_repos.go | 32 ++++++++++++------ internal/gitproviders/gitea.go | 36 ++++++++++++++++++++- internal/services/providers/git.go | 9 ++++++ 6 files changed, 72 insertions(+), 14 deletions(-) diff --git a/_examples/actions/write_a_readme/kraken.yml b/_examples/actions/write_a_readme/kraken.yml index e4065e6..0e5c44e 100644 --- a/_examples/actions/write_a_readme/kraken.yml +++ b/_examples/actions/write_a_readme/kraken.yml @@ -3,9 +3,9 @@ name: write-a-readme select: repositories: - git@git.front.kjuulh.io:kjuulh/kraken-test.git - providers: - - gitea: https://git.front.kjuulh.io - organisation: "cibus" + # providers: + # - gitea: https://git.front.kjuulh.io + # organisation: "cibus" actions: - type: go entry: "main.go" diff --git a/go.mod b/go.mod index 9b543eb..2fab6ad 100644 --- a/go.mod +++ b/go.mod @@ -49,6 +49,7 @@ require ( github.com/sirupsen/logrus v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/ugorji/go/codec v1.2.7 // indirect + github.com/whilp/git-urls v1.0.0 // indirect github.com/xanzy/ssh-agent v0.3.2 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.8.0 // indirect diff --git a/go.sum b/go.sum index 9f45bfb..5f09503 100644 --- a/go.sum +++ b/go.sum @@ -153,6 +153,8 @@ github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6 github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/whilp/git-urls v1.0.0 h1:95f6UMWN5FKW71ECsXRUd3FVYiXdrE7aX4NZKcPmIjU= +github.com/whilp/git-urls v1.0.0/go.mod h1:J16SAmobsqc3Qcy98brfl5f5+e0clUvg1krgwk/qCfE= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xanzy/ssh-agent v0.3.2 h1:eKj4SX2Fe7mui28ZgnFW5fmTz1EIr7ugo5s6wDxdHBM= github.com/xanzy/ssh-agent v0.3.2/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= diff --git a/internal/commands/process_repos.go b/internal/commands/process_repos.go index becfb03..00634f4 100644 --- a/internal/commands/process_repos.go +++ b/internal/commands/process_repos.go @@ -3,6 +3,7 @@ package commands import ( "context" "fmt" + "strings" "sync" "time" @@ -11,6 +12,7 @@ import ( "git.front.kjuulh.io/kjuulh/kraken/internal/schema" "git.front.kjuulh.io/kjuulh/kraken/internal/services/providers" "git.front.kjuulh.io/kjuulh/kraken/internal/services/storage" + giturls "github.com/whilp/git-urls" "go.uber.org/zap" ) @@ -42,8 +44,6 @@ func NewProcessRepos(logger *zap.Logger, deps ProcessReposDeps) *ProcessRepos { } func (pr *ProcessRepos) Process(ctx context.Context, repository string, branch string, actionPath string) error { - errChan := make(chan error, 1) - action, err := pr.actionCreator.Prepare(ctx, &actions.ActionCreatorOps{ RepositoryUrl: repository, Branch: branch, @@ -68,19 +68,14 @@ func (pr *ProcessRepos) Process(ctx context.Context, repository string, branch s }() err := pr.processRepo(ctx, repoUrl, action) if err != nil { - errChan <- err + pr.logger.Error("could not process repo", zap.Error(err)) } }(ctx, repoUrl) } wg.Wait() - close(errChan) pr.logger.Debug("finished processing all repos", zap.Strings("repos", repositoryUrls)) - for err := range errChan { - return err - } - return nil } @@ -122,11 +117,13 @@ func (pr *ProcessRepos) processRepo(ctx context.Context, repoUrl string, action return err } - err = pr.commit(ctx, area, repo) + err = pr.commit(ctx, area, repo, repoUrl) if err != nil { return err } + //pr.gitea.CreatePr(ctx, ) + pr.logger.Debug("processing done", zap.String("path", area.Path), zap.String("repoUrl", repoUrl)) return nil } @@ -167,7 +164,7 @@ func (pr *ProcessRepos) clone(ctx context.Context, area *storage.Area, repoUrl s return repo, nil } -func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *providers.GitRepo) error { +func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *providers.GitRepo, repoUrl string) error { _, err := pr.git.Add(ctx, area, repo) if err != nil { return fmt.Errorf("could not add file: %w", err) @@ -184,6 +181,21 @@ func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *pr if err != nil { return fmt.Errorf("could not push to repo: %w", err) } + + url, err := giturls.Parse(repoUrl) + if err != nil { + return err + } + + head, err := repo.GetHEAD() + if err != nil { + return err + } + + path := strings.Split(url.Path, "/") + pr.logger.Debug("path string", zap.Strings("paths", path), zap.String("HEAD", head)) + + pr.gitea.CreatePr(ctx, url.Host, path[0], repoUrl, head, "", "kraken-apply") } return nil } diff --git a/internal/gitproviders/gitea.go b/internal/gitproviders/gitea.go index ea85d1e..4ba214d 100644 --- a/internal/gitproviders/gitea.go +++ b/internal/gitproviders/gitea.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "sync" + "time" "code.gitea.io/sdk/gitea" "go.uber.org/zap" @@ -23,7 +24,11 @@ func NewGitea(logger *zap.Logger) *Gitea { } } -func (g *Gitea) ListRepositoriesForOrganization(ctx context.Context, server string, organization string) ([]string, error) { +func (g *Gitea) ListRepositoriesForOrganization( + ctx context.Context, + server string, + organization string, +) ([]string, error) { client, err := g.getOrCreateClient(ctx, server) if err != nil { return nil, err @@ -52,6 +57,35 @@ func (g *Gitea) ListRepositoriesForOrganization(ctx context.Context, server stri return repoUrls, err } +func (g *Gitea) CreatePr( + ctx context.Context, + server string, + organization string, + repository string, + head string, + base string, + actionName string, +) error { + client, err := g.getOrCreateClient(ctx, server) + if err != nil { + return err + } + + client.CreatePullRequest(organization, repository, gitea.CreatePullRequestOption{ + Head: head, + Base: base, + Title: actionName, + Body: "", + Assignee: "", + Assignees: []string{}, + Milestone: 0, + Labels: []int64{}, + Deadline: &time.Time{}, + }) + + return nil +} + func (g *Gitea) getOrCreateClient(ctx context.Context, server string) (*gitea.Client, error) { g.giteamu.Lock() defer g.giteamu.Unlock() diff --git a/internal/services/providers/git.go b/internal/services/providers/git.go index 4a91121..df13898 100644 --- a/internal/services/providers/git.go +++ b/internal/services/providers/git.go @@ -30,6 +30,15 @@ type GitRepo struct { repo *git.Repository } +func (gr *GitRepo) GetHEAD() (string, error) { + head, err := gr.repo.Head() + if err != nil { + return "", err + } + + return head.Name().Short(), nil +} + type GitAuth string const ( -- 2.45.2 From 88430eb8796dd7d046d75f103ced4cfc87d3463c Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 18 Sep 2022 00:10:30 +0200 Subject: [PATCH 10/10] with prs --- internal/commands/process_repos.go | 33 ++++++++++++++++--- internal/gitproviders/gitea.go | 52 +++++++++++++++++++++++------- internal/services/providers/git.go | 28 ++++++++++++++++ roadmap.md | 2 +- 4 files changed, 98 insertions(+), 17 deletions(-) diff --git a/internal/commands/process_repos.go b/internal/commands/process_repos.go index 00634f4..ae8049d 100644 --- a/internal/commands/process_repos.go +++ b/internal/commands/process_repos.go @@ -122,8 +122,6 @@ func (pr *ProcessRepos) processRepo(ctx context.Context, repoUrl string, action return err } - //pr.gitea.CreatePr(ctx, ) - pr.logger.Debug("processing done", zap.String("path", area.Path), zap.String("repoUrl", repoUrl)) return nil } @@ -165,7 +163,7 @@ func (pr *ProcessRepos) clone(ctx context.Context, area *storage.Area, repoUrl s } func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *providers.GitRepo, repoUrl string) error { - _, err := pr.git.Add(ctx, area, repo) + wt, err := pr.git.Add(ctx, area, repo) if err != nil { return fmt.Errorf("could not add file: %w", err) } @@ -175,8 +173,18 @@ func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *pr return fmt.Errorf("could not get diff: %w", err) } - dryrun := true + dryrun := false if !dryrun { + status, err := wt.Status() + if err != nil { + return err + } + + if status.IsClean() { + pr.logger.Info("Returning early, as no modifications are detected") + return nil + } + err = pr.git.Push(ctx, repo) if err != nil { return fmt.Errorf("could not push to repo: %w", err) @@ -195,7 +203,22 @@ func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *pr path := strings.Split(url.Path, "/") pr.logger.Debug("path string", zap.Strings("paths", path), zap.String("HEAD", head)) - pr.gitea.CreatePr(ctx, url.Host, path[0], repoUrl, head, "", "kraken-apply") + org := path[0] + repoName := path[1] + semanticName, _, ok := strings.Cut(repoName, ".") + if !ok { + semanticName = repoName + } + + originHead, err := pr.git.GetOriginHEADForRepo(ctx, repo) + if err != nil { + return err + } + + err = pr.gitea.CreatePr(ctx, fmt.Sprintf("%s://%s", "https", url.Host), org, semanticName, head, originHead, "kraken-apply") + if err != nil { + return err + } } return nil } diff --git a/internal/gitproviders/gitea.go b/internal/gitproviders/gitea.go index 4ba214d..8fa3690 100644 --- a/internal/gitproviders/gitea.go +++ b/internal/gitproviders/gitea.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "sync" - "time" "code.gitea.io/sdk/gitea" "go.uber.org/zap" @@ -71,17 +70,47 @@ func (g *Gitea) CreatePr( return err } - client.CreatePullRequest(organization, repository, gitea.CreatePullRequestOption{ - Head: head, - Base: base, - Title: actionName, - Body: "", - Assignee: "", - Assignees: []string{}, + prs, _, err := client.ListRepoPullRequests(organization, repository, gitea.ListPullRequestsOptions{ + ListOptions: gitea.ListOptions{ + Page: 0, + PageSize: 30, + }, + State: gitea.StateOpen, + Sort: "recentupdate", Milestone: 0, - Labels: []int64{}, - Deadline: &time.Time{}, }) + if err != nil { + return fmt.Errorf( + "could not list repos, needed because we need to check for conflicts. Original error: %w", + err, + ) + } + for _, pr := range prs { + if pr.Head.Name == head { + g.logger.Info( + "returning early from creating pull-request, as it already exists.", + zap.String("repository", repository), + zap.String("pull-request", pr.URL), + ) + return nil + } + } + + pr, _, err := client.CreatePullRequest(organization, repository, gitea.CreatePullRequestOption{ + Head: head, + Base: base, + Title: actionName, + }) + if err != nil { + return err + } + + g.logger.Debug( + "Created pr", + zap.String("repository", repository), + zap.String("branch", head), + zap.String("pull-request", pr.URL), + ) return nil } @@ -92,8 +121,9 @@ func (g *Gitea) getOrCreateClient(ctx context.Context, server string) (*gitea.Cl client, ok := g.giteaClients[server] if !ok || client == nil { c, err := gitea.NewClient(server) + c.SetBasicAuth("kjuulh", "c0bd801cc9a7f2ed559ea45d603afc92f5443f19") if err != nil { - return nil, nil + return nil, err } g.giteaClients[server] = c return c, nil diff --git a/internal/services/providers/git.go b/internal/services/providers/git.go index df13898..07018b6 100644 --- a/internal/services/providers/git.go +++ b/internal/services/providers/git.go @@ -62,6 +62,34 @@ func NewGit(logger *zap.Logger, gitConfig *GitConfig, openPGP *signer.OpenPGP) * return &Git{logger: logger, gitConfig: gitConfig, openPGP: openPGP} } +func (g *Git) GetOriginHEADForRepo(ctx context.Context, gitRepo *GitRepo) (string, error) { + remote, err := gitRepo.repo.Remote("origin") + if err != nil { + return "", err + } + + auth, err := g.GetAuth() + if err != nil { + return "", err + } + + refs, err := remote.ListContext(ctx, &git.ListOptions{ + Auth: auth, + }) + if err != nil { + return "", err + } + + headRef := "" + for _, ref := range refs { + if !ref.Name().IsBranch() { + headRef = ref.Target().Short() + } + } + + return headRef, nil +} + func (g *Git) CloneBranch(ctx context.Context, storageArea *storage.Area, repoUrl string, branch string) (*GitRepo, error) { g.logger.Debug( "cloning repository", diff --git a/roadmap.md b/roadmap.md index 707d348..ae23587 100644 --- a/roadmap.md +++ b/roadmap.md @@ -22,7 +22,7 @@ - [x] Allow instantiation of actions, kraken template repo etc. - [ ] Implement docker action - [ ] Providing query results -- [ ] Create pr for gitea provider +- [x] Create pr for gitea provider - [ ] Think about some sort of isolation - [ ] Create CLI to trigger action - [ ] Setup pool of runners -- 2.45.2