Skip to content

Commit

Permalink
chore: renamed poiana package to pigeon.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Feb 14, 2023
1 parent fcd6874 commit b2fda30
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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")
}
Expand Down Expand Up @@ -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)
}
Expand Down
17 changes: 8 additions & 9 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pkg/poiana/secrets.go → pkg/pigeon/secrets.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/poiana/secrets_mock.go → pkg/pigeon/secrets_mock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

type ServiceFactory interface {
NewOrgVariableService(org string) ActionsVarsService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import "github.com/google/go-github/v50/github"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import "fmt"

Expand Down
2 changes: 1 addition & 1 deletion pkg/poiana/variables.go → pkg/pigeon/variables.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package poiana
package pigeon

import (
"context"
Expand Down

0 comments on commit b2fda30

Please sign in to comment.