Skip to content

Commit

Permalink
Refactor location of types as they not only belong to plugins, but us…
Browse files Browse the repository at this point in the history
…ed in general. (#1485)

Also add Pro protobuf and gen code as this should be public.
  • Loading branch information
vcastellm authored Feb 25, 2024
1 parent b7235ee commit 794a178
Show file tree
Hide file tree
Showing 43 changed files with 892 additions and 48 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ dkron/ui-dist: ui/node_modules ui/public/* ui/src/* ui/src/*/*
rm -rf dkron/ui-dist
cd ui; bun run build --out-dir ../dkron/ui-dist

plugin/types/%.pb.go: proto/%.proto
protoc -I proto/ --go_out=plugin/types --go_opt=paths=source_relative --go-grpc_out=plugin/types --go-grpc_opt=paths=source_relative $<
proto: types/dkron.pb.go types/executor.pb.go types/pro.pb.go

types/%.pb.go: proto/%.proto
protoc -I proto/ --go_out=types --go_opt=paths=source_relative --go-grpc_out=types --go-grpc_opt=paths=source_relative $<

ui: dkron/ui-dist

main: dkron/ui-dist plugin/types/dkron.pb.go plugin/types/executor.pb.go *.go */*.go */*/*.go */*/*/*.go
main: dkron/ui-dist types/dkron.pb.go types/executor.pb.go *.go */*.go */*/*.go */*/*/*.go
GOBIN=`pwd` go install ./builtin/...
go mod tidy
go build main.go
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-gcppubsub/gcppubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"cloud.google.com/go/pubsub"
dkplugin "github.com/distribworks/dkron/v4/plugin"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
)

// GCPPubSub plugin publish message to topic when Execute method is called.
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-gcppubsub/gcppubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"cloud.google.com/go/pubsub"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/armon/circbuf"
dkplugin "github.com/distribworks/dkron/v4/plugin"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
"github.com/fullstorydev/grpcurl"
"github.com/jhump/protoreflect/grpcreflect"
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/distribworks/dkron/v4/builtin/bins/dkron-executor-grpc/test"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/armon/circbuf"

dkplugin "github.com/distribworks/dkron/v4/plugin"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-kafka/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
)

func TestProduceExecuteWithKey(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/nats-io/nats.go"

dkplugin "github.com/distribworks/dkron/v4/plugin"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-nats/nats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
)

func TestPublishExecute(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"

dkplugin "github.com/distribworks/dkron/v4/plugin"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
"github.com/streadway/amqp"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-rabbitmq/rabbitmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

dktypes "github.com/distribworks/dkron/v4/plugin/types"
dktypes "github.com/distribworks/dkron/v4/types"
)

func TestPublishExecute(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-files/files_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-files/files_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-fluent/fluent_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-log/log_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-log/log_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-syslog/syslog_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
gsyslog "github.com/hashicorp/go-syslog"
log "github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-syslog/syslog_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion dkron/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
metrics "github.com/armon/go-metrics"
"github.com/devopsfaith/krakend-usage/client"
"github.com/distribworks/dkron/v4/plugin"
proto "github.com/distribworks/dkron/v4/plugin/types"
proto "github.com/distribworks/dkron/v4/types"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/memberlist"
"github.com/hashicorp/raft"
Expand Down
2 changes: 1 addition & 1 deletion dkron/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"time"

proto "github.com/distribworks/dkron/v4/plugin/types"
proto "github.com/distribworks/dkron/v4/types"
"google.golang.org/protobuf/types/known/timestamppb"
)

Expand Down
2 changes: 1 addition & 1 deletion dkron/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dkron
import (
"io"

dkronpb "github.com/distribworks/dkron/v4/plugin/types"
dkronpb "github.com/distribworks/dkron/v4/types"
"github.com/hashicorp/raft"
"github.com/sirupsen/logrus"
"google.golang.org/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion dkron/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

metrics "github.com/armon/go-metrics"
"github.com/distribworks/dkron/v4/plugin"
proto "github.com/distribworks/dkron/v4/plugin/types"
proto "github.com/distribworks/dkron/v4/types"
"github.com/golang/protobuf/ptypes/empty"
"github.com/hashicorp/raft"
"github.com/hashicorp/serf/serf"
Expand Down
2 changes: 1 addition & 1 deletion dkron/grpc_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/armon/circbuf"
metrics "github.com/armon/go-metrics"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/distribworks/dkron/v4/types"
"github.com/sirupsen/logrus"
"google.golang.org/protobuf/types/known/timestamppb"
)
Expand Down
2 changes: 1 addition & 1 deletion dkron/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

metrics "github.com/armon/go-metrics"
proto "github.com/distribworks/dkron/v4/plugin/types"
proto "github.com/distribworks/dkron/v4/types"
"github.com/golang/protobuf/ptypes/empty"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion dkron/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/distribworks/dkron/v4/extcron"
"github.com/distribworks/dkron/v4/ntime"
"github.com/distribworks/dkron/v4/plugin"
proto "github.com/distribworks/dkron/v4/plugin/types"
proto "github.com/distribworks/dkron/v4/types"
"github.com/sirupsen/logrus"
"github.com/tidwall/buntdb"
"google.golang.org/protobuf/types/known/timestamppb"
Expand Down
2 changes: 1 addition & 1 deletion dkron/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/distribworks/dkron/v4/ntime"
"github.com/distribworks/dkron/v4/plugin"
proto "github.com/distribworks/dkron/v4/plugin/types"
proto "github.com/distribworks/dkron/v4/types"
"github.com/hashicorp/serf/testutil"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion dkron/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sync"
"time"

dkronpb "github.com/distribworks/dkron/v4/plugin/types"
dkronpb "github.com/distribworks/dkron/v4/types"
"github.com/sirupsen/logrus"
"github.com/tidwall/buntdb"
"google.golang.org/protobuf/proto"
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/armon/go-metrics v0.4.1
github.com/aws/aws-sdk-go v1.42.18 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/deepmap/oapi-codegen v1.16.2 // indirect
github.com/devopsfaith/krakend-usage v1.4.0
github.com/fluent/fluent-logger-golang v1.9.0
github.com/fullstorydev/grpcurl v1.8.9
Expand All @@ -34,6 +35,7 @@ require (
github.com/mattn/go-shellwords v1.0.12
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/nats-io/nats.go v1.32.0
github.com/oapi-codegen/runtime v1.1.1 // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.18.0
github.com/robfig/cron/v3 v3.0.1
Expand Down
Loading

0 comments on commit 794a178

Please sign in to comment.