From b2fda30b0e937a877f41a53963dbfd5f8759f8d6 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Tue, 14 Feb 2023 12:51:59 +0100 Subject: [PATCH] chore: renamed poiana package to pigeon. Signed-off-by: Federico Di Pierro --- Makefile | 2 +- main.go | 8 ++++---- pkg/config/config.go | 17 ++++++++--------- pkg/config/config_test.go | 6 +++--- pkg/{poiana => pigeon}/secrets.go | 2 +- pkg/{poiana => pigeon}/secrets_client.go | 2 +- pkg/{poiana => pigeon}/secrets_mock.go | 2 +- pkg/{poiana => pigeon}/secrets_onepassword.go | 2 +- pkg/{poiana => pigeon}/service_factory.go | 2 +- .../service_factory_client.go | 2 +- pkg/{poiana => pigeon}/service_factory_mock.go | 2 +- pkg/{poiana => pigeon}/variables.go | 2 +- pkg/{poiana => pigeon}/variables_client.go | 2 +- pkg/{poiana => pigeon}/variables_mock.go | 2 +- 14 files changed, 26 insertions(+), 27 deletions(-) rename pkg/{poiana => pigeon}/secrets.go (97%) rename pkg/{poiana => pigeon}/secrets_client.go (99%) rename pkg/{poiana => pigeon}/secrets_mock.go (99%) rename pkg/{poiana => pigeon}/secrets_onepassword.go (98%) rename pkg/{poiana => pigeon}/service_factory.go (94%) rename pkg/{poiana => pigeon}/service_factory_client.go (98%) rename pkg/{poiana => pigeon}/service_factory_mock.go (98%) rename pkg/{poiana => pigeon}/variables.go (96%) rename pkg/{poiana => pigeon}/variables_client.go (99%) rename pkg/{poiana => pigeon}/variables_mock.go (98%) diff --git a/Makefile b/Makefile index cbdc173..0951051 100644 --- a/Makefile +++ b/Makefile @@ -15,4 +15,4 @@ ${pigeon}: test: go clean -testcache go test -v -cover -race ./... - go test -v -cover -buildmode=pie ./pkg/poiana + go test -v -cover -buildmode=pie ./pkg/pigeon diff --git a/main.go b/main.go index c77445d..11430f6 100644 --- a/main.go +++ b/main.go @@ -3,12 +3,12 @@ package main import ( "context" "flag" + "github.com/FedeDP/Pigeon/pkg/pigeon" "github.com/google/go-github/v50/github" "os" "strings" "github.com/FedeDP/Pigeon/pkg/config" - "github.com/FedeDP/Pigeon/pkg/poiana" "github.com/sirupsen/logrus" ) @@ -21,7 +21,7 @@ var ( func init() { flag.StringVar(&confFile, "conf", "", "path to yaml conf file") - flag.StringVar(&ghToken, "gh-token", "", "path to poiana github token with admin access on org/repo") + flag.StringVar(&ghToken, "gh-token", "", "path to github token with admin access on org/repo") flag.BoolVar(&dryRun, "dry-run", false, "enable dry run mode") flag.BoolVar(&verbose, "verbose", false, "enable verbose logging") } @@ -60,14 +60,14 @@ func main() { logrus.Fatal(err) } - provider, err := poiana.NewOnePasswordSecretsProvider() + provider, err := pigeon.NewOnePasswordSecretsProvider() if err != nil { logrus.Fatal(err) } ctx := context.Background() client := github.NewTokenClient(ctx, ghToken) - err = conf.Sync(poiana.NewClientServiceFactory(client), provider, dryRun) + err = conf.Sync(pigeon.NewClientServiceFactory(client), provider, dryRun) if err != nil { logrus.Fatal(err) } diff --git a/pkg/config/config.go b/pkg/config/config.go index d9ef06b..08a954c 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -3,11 +3,10 @@ package config import ( "context" "encoding/base64" + "github.com/FedeDP/Pigeon/pkg/pigeon" "os" "strings" - "github.com/FedeDP/Pigeon/pkg/poiana" - "github.com/google/go-github/v50/github" "github.com/jamesruan/sodium" "github.com/sirupsen/logrus" @@ -51,8 +50,8 @@ func FromData(yamlData string) (*GithubConfig, error) { func (goa *GitHubActionsConfig) syncSecrets( ctx context.Context, - service poiana.ActionsSecretsService, - provider poiana.SecretsProvider, + service pigeon.ActionsSecretsService, + provider pigeon.SecretsProvider, pKey *github.PublicKey) error { // Step 1: load repo secrets @@ -108,7 +107,7 @@ func (goa *GitHubActionsConfig) syncSecrets( func (goa *GitHubActionsConfig) syncVariables( ctx context.Context, - service poiana.ActionsVarsService) error { + service pigeon.ActionsVarsService) error { // Step 1: load repo variables vars, _, err := service.ListVariables(ctx, nil) @@ -143,9 +142,9 @@ func (goa *GitHubActionsConfig) syncVariables( func (g *GitHubActionsConfig) Sync( ctx context.Context, - provider poiana.SecretsProvider, - vars poiana.ActionsVarsService, - secrets poiana.ActionsSecretsService, + provider pigeon.SecretsProvider, + vars pigeon.ActionsVarsService, + secrets pigeon.ActionsSecretsService, dryRun bool) error { if dryRun { logrus.Infoln("skipping secrets sync due to dry run") @@ -164,7 +163,7 @@ func (g *GitHubActionsConfig) Sync( return g.syncVariables(ctx, vars) } -func (g *GithubConfig) Sync(f poiana.ServiceFactory, p poiana.SecretsProvider, dryRun bool) error { +func (g *GithubConfig) Sync(f pigeon.ServiceFactory, p pigeon.SecretsProvider, dryRun bool) error { logrus.Debugf("starting the synching loop") ctx := context.Background() for orgName, org := range g.Orgs { diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 552de1e..3a34ef1 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -2,9 +2,9 @@ package config import ( "context" + "github.com/FedeDP/Pigeon/pkg/pigeon" "testing" - "github.com/FedeDP/Pigeon/pkg/poiana" "github.com/stretchr/testify/assert" ) @@ -42,8 +42,8 @@ func TestConfigSync(t *testing.T) { assert.Contains(t, conf.Orgs[org].Actions.Variables, "orgVar1") assert.Contains(t, conf.Orgs[org].Repos, repo) - factory := poiana.NewMockServiceFactory() - provider, err := poiana.NewMockSecretsProvider(map[string]string{ + factory := pigeon.NewMockServiceFactory() + provider, err := pigeon.NewMockSecretsProvider(map[string]string{ "orgSecret0": "orgValue0", "repoSecret0": "repoValue0", "repoSecret1": "repoValue1", diff --git a/pkg/poiana/secrets.go b/pkg/pigeon/secrets.go similarity index 97% rename from pkg/poiana/secrets.go rename to pkg/pigeon/secrets.go index aa8ae40..c80f778 100644 --- a/pkg/poiana/secrets.go +++ b/pkg/pigeon/secrets.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "context" diff --git a/pkg/poiana/secrets_client.go b/pkg/pigeon/secrets_client.go similarity index 99% rename from pkg/poiana/secrets_client.go rename to pkg/pigeon/secrets_client.go index f1145ec..0deb668 100644 --- a/pkg/poiana/secrets_client.go +++ b/pkg/pigeon/secrets_client.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "context" diff --git a/pkg/poiana/secrets_mock.go b/pkg/pigeon/secrets_mock.go similarity index 99% rename from pkg/poiana/secrets_mock.go rename to pkg/pigeon/secrets_mock.go index 699b8de..9d762ae 100644 --- a/pkg/poiana/secrets_mock.go +++ b/pkg/pigeon/secrets_mock.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "context" diff --git a/pkg/poiana/secrets_onepassword.go b/pkg/pigeon/secrets_onepassword.go similarity index 98% rename from pkg/poiana/secrets_onepassword.go rename to pkg/pigeon/secrets_onepassword.go index d0d0148..cee2961 100644 --- a/pkg/poiana/secrets_onepassword.go +++ b/pkg/pigeon/secrets_onepassword.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "fmt" diff --git a/pkg/poiana/service_factory.go b/pkg/pigeon/service_factory.go similarity index 94% rename from pkg/poiana/service_factory.go rename to pkg/pigeon/service_factory.go index c66805a..0152efc 100644 --- a/pkg/poiana/service_factory.go +++ b/pkg/pigeon/service_factory.go @@ -1,4 +1,4 @@ -package poiana +package pigeon type ServiceFactory interface { NewOrgVariableService(org string) ActionsVarsService diff --git a/pkg/poiana/service_factory_client.go b/pkg/pigeon/service_factory_client.go similarity index 98% rename from pkg/poiana/service_factory_client.go rename to pkg/pigeon/service_factory_client.go index 5016959..c8f46d6 100644 --- a/pkg/poiana/service_factory_client.go +++ b/pkg/pigeon/service_factory_client.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import "github.com/google/go-github/v50/github" diff --git a/pkg/poiana/service_factory_mock.go b/pkg/pigeon/service_factory_mock.go similarity index 98% rename from pkg/poiana/service_factory_mock.go rename to pkg/pigeon/service_factory_mock.go index d58f728..7154eed 100644 --- a/pkg/poiana/service_factory_mock.go +++ b/pkg/pigeon/service_factory_mock.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import "fmt" diff --git a/pkg/poiana/variables.go b/pkg/pigeon/variables.go similarity index 96% rename from pkg/poiana/variables.go rename to pkg/pigeon/variables.go index d73a46c..b85f5e3 100644 --- a/pkg/poiana/variables.go +++ b/pkg/pigeon/variables.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "context" diff --git a/pkg/poiana/variables_client.go b/pkg/pigeon/variables_client.go similarity index 99% rename from pkg/poiana/variables_client.go rename to pkg/pigeon/variables_client.go index da89231..d3c8192 100644 --- a/pkg/poiana/variables_client.go +++ b/pkg/pigeon/variables_client.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "context" diff --git a/pkg/poiana/variables_mock.go b/pkg/pigeon/variables_mock.go similarity index 98% rename from pkg/poiana/variables_mock.go rename to pkg/pigeon/variables_mock.go index 7cc1da4..0f3e89d 100644 --- a/pkg/poiana/variables_mock.go +++ b/pkg/pigeon/variables_mock.go @@ -1,4 +1,4 @@ -package poiana +package pigeon import ( "context"