Skip to content

Commit

Permalink
Bump module to v4 (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcastellm authored Feb 10, 2024
1 parent 41c82f3 commit 586f72d
Show file tree
Hide file tree
Showing 56 changed files with 135 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ builds:
id: dkron
binary: dkron
ldflags:
- -s -w -X github.com/distribworks/dkron/v3/dkron.Version={{.Version}} -X github.com/distribworks/dkron/v3/dkron.Codename=Abaniko
- -s -w -X github.com/distribworks/dkron/v4/dkron.Version={{.Version}} -X github.com/distribworks/dkron/v4/dkron.Codename=Abaniko

nfpms:
-
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ clean:
GOBIN=`pwd` go clean -i ./builtin/...
GOBIN=`pwd` go clean

.PHONY: doc apidoc test ui updatetestcert
doc:
.PHONY: docs apidoc test ui updatetestcert
docs:
#scripts/run doc --dir website/docs/cli
cd website; yarn build --out-dir ../public
cd website; bun run build --out-dir ../public
ghp-import -p public

test:
Expand Down
19 changes: 10 additions & 9 deletions builtin/bins/dkron-executor-gcppubsub/gcppubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"fmt"

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

// GCPPubSub plugin publish message to topic when Execute method is called.
Expand All @@ -24,12 +24,13 @@ const (

// Execute Process method of the plugin
// "executor": "gcppubsub",
// "executor_config": {
// "project": "project-id",
// "topic": "topic-name",
// "data": "aGVsbG8gd29ybGQ=" // Optional. base64 encoded data
// "attributes": "{\"hello\":\"world\",\"waka\":\"paka\"}" // JSON serialized attributes
// }
//
// "executor_config": {
// "project": "project-id",
// "topic": "topic-name",
// "data": "aGVsbG8gd29ybGQ=" // Optional. base64 encoded data
// "attributes": "{\"hello\":\"world\",\"waka\":\"paka\"}" // JSON serialized attributes
// }
func (g *GCPPubSub) Execute(args *dktypes.ExecuteRequest, _ dkplugin.StatusHelper) (*dktypes.ExecuteResponse, error) {
out, err := g.ExecuteImpl(args)
resp := &dktypes.ExecuteResponse{Output: out}
Expand Down Expand Up @@ -91,7 +92,7 @@ func configToPubSubMessage(config map[string]string) (*pubsub.Message, error) {

var attributes map[string]string
if attributesJSON != "" {
if err := json.Unmarshal([]byte(attributesJSON), &attributes); err != nil {
if err := json.Unmarshal([]byte(attributesJSON), &attributes); err != nil {
return nil, fmt.Errorf("invalid attributes JSON: %w", err)
}
msg.Attributes = attributes
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/v3/plugin/types"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-gcppubsub/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
dkplugin "github.com/distribworks/dkron/v3/plugin"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/hashicorp/go-plugin"
)

Expand Down
17 changes: 9 additions & 8 deletions builtin/bins/dkron-executor-grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"

"github.com/armon/circbuf"
dkplugin "github.com/distribworks/dkron/v3/plugin"
dktypes "github.com/distribworks/dkron/v3/plugin/types"
dkplugin "github.com/distribworks/dkron/v4/plugin"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
"github.com/fullstorydev/grpcurl"
"github.com/jhump/protoreflect/grpcreflect"
"github.com/pkg/errors"
Expand All @@ -33,12 +33,13 @@ type GRPC struct{}

// Execute Process method of the plugin
// "executor": "grpc",
// "executor_config": {
// "url": "127.0.0.1:9000/demo.DemoService/Demo", // Request url
// "body": "", // POST body
// "timeout": "30", // Request timeout, unit seconds
// "expectCode": "0", // Expect response code, any of the described here https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// }
//
// "executor_config": {
// "url": "127.0.0.1:9000/demo.DemoService/Demo", // Request url
// "body": "", // POST body
// "timeout": "30", // Request timeout, unit seconds
// "expectCode": "0", // Expect response code, any of the described here https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// }
func (g *GRPC) Execute(args *dktypes.ExecuteRequest, _ dkplugin.StatusHelper) (*dktypes.ExecuteResponse, error) {
out, err := g.ExecuteImpl(args)
resp := &dktypes.ExecuteResponse{Output: out}
Expand Down
9 changes: 5 additions & 4 deletions builtin/bins/dkron-executor-grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
"context"
"github.com/distribworks/dkron/v3/builtin/bins/dkron-executor-grpc/test"
dktypes "github.com/distribworks/dkron/v3/plugin/types"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"net"
"testing"

"github.com/distribworks/dkron/v4/builtin/bins/dkron-executor-grpc/test"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)

type DemoServer struct {
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-grpc/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
dkplugin "github.com/distribworks/dkron/v3/plugin"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/hashicorp/go-plugin"
)

Expand Down
25 changes: 13 additions & 12 deletions builtin/bins/dkron-executor-http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"time"

"github.com/armon/circbuf"
dkplugin "github.com/distribworks/dkron/v3/plugin"
"github.com/distribworks/dkron/v3/plugin/types"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
)

const (
Expand All @@ -35,16 +35,17 @@ type HTTP struct {

// Execute Process method of the plugin
// "executor": "http",
// "executor_config": {
// "method": "GET", // Request method in uppercase
// "url": "http://example.com", // Request url
// "headers": "[]" // Json string, such as "[\"Content-Type: application/json\"]"
// "body": "", // POST body
// "timeout": "30", // Request timeout, unit seconds
// "expectCode": "200", // Expect response code, such as 200,206
// "expectBody": "", // Expect response body, support regexp, such as /success/
// "debug": "true" // Debug option, will log everything when this option is not empty
// }
//
// "executor_config": {
// "method": "GET", // Request method in uppercase
// "url": "http://example.com", // Request url
// "headers": "[]" // Json string, such as "[\"Content-Type: application/json\"]"
// "body": "", // POST body
// "timeout": "30", // Request timeout, unit seconds
// "expectCode": "200", // Expect response code, such as 200,206
// "expectBody": "", // Expect response body, support regexp, such as /success/
// "debug": "true" // Debug option, will log everything when this option is not empty
// }
func (s *HTTP) Execute(args *types.ExecuteRequest, cb dkplugin.StatusHelper) (*types.ExecuteResponse, error) {
out, err := s.ExecuteImpl(args)
resp := &types.ExecuteResponse{Output: out}
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http/httptest"
"testing"

"github.com/distribworks/dkron/v3/plugin/types"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-http/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
dkplugin "github.com/distribworks/dkron/v3/plugin"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/hashicorp/go-plugin"
)

Expand Down
17 changes: 9 additions & 8 deletions builtin/bins/dkron-executor-kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/Shopify/sarama"
"github.com/armon/circbuf"

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

const (
Expand All @@ -26,12 +26,13 @@ type Kafka struct {

// Execute Process method of the plugin
// "executor": "kafka",
// "executor_config": {
// "brokerAddress": "192.168.59.103:9092", // kafka broker url
// "key": "",
// "message": "",
// "topic": "publishTopic"
// }
//
// "executor_config": {
// "brokerAddress": "192.168.59.103:9092", // kafka broker url
// "key": "",
// "message": "",
// "topic": "publishTopic"
// }
func (s *Kafka) Execute(args *dktypes.ExecuteRequest, cb dkplugin.StatusHelper) (*dktypes.ExecuteResponse, error) {

out, err := s.ExecuteImpl(args)
Expand Down
4 changes: 2 additions & 2 deletions 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/v3/plugin/types"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
)

func TestProduceExecuteWithKey(t *testing.T) {
Expand Down Expand Up @@ -44,4 +44,4 @@ func TestProduceExecuteWithoutKey(t *testing.T) {
if err != nil {
t.Fatal(err)
}
}
}
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-kafka/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
dkplugin "github.com/distribworks/dkron/v3/plugin"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/hashicorp/go-plugin"
)

Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-executor-nats/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
dkplugin "github.com/distribworks/dkron/v3/plugin"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/hashicorp/go-plugin"
)

Expand Down
21 changes: 11 additions & 10 deletions builtin/bins/dkron-executor-nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/armon/circbuf"
"github.com/nats-io/nats.go"

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

const (
Expand All @@ -24,13 +24,14 @@ type Nats struct {

// Execute Process method of the plugin
// "executor": "nats",
// "executor_config": {
// "url": "tls://nats.demo.io:4443", // nats server url
// "message": "",
// "subject": "Subject",
// "userName":"[email protected]",
// "password":"dfdffs"
// }
//
// "executor_config": {
// "url": "tls://nats.demo.io:4443", // nats server url
// "message": "",
// "subject": "Subject",
// "userName":"[email protected]",
// "password":"dfdffs"
// }
func (s *Nats) Execute(args *dktypes.ExecuteRequest, cb dkplugin.StatusHelper) (*dktypes.ExecuteResponse, error) {

out, err := s.ExecuteImpl(args)
Expand Down Expand Up @@ -73,7 +74,7 @@ func (s *Nats) ExecuteImpl(args *dktypes.ExecuteRequest) ([]byte, error) {
if debug {
log.Printf("request %#v\n\n", nc)
}

if nc.IsConnected() {
defer nc.Flush()
defer nc.Close()
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/v3/plugin/types"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
)

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

import (
dkplugin "github.com/distribworks/dkron/v3/plugin"
dkplugin "github.com/distribworks/dkron/v4/plugin"
"github.com/hashicorp/go-plugin"
)

Expand Down
15 changes: 8 additions & 7 deletions builtin/bins/dkron-executor-rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/base64"
"errors"

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

Expand All @@ -15,11 +15,12 @@ type RabbitMQ struct {

// Execute method of the plugin
// "executor": "rabbitmq",
// "executor_config": {
// "url": "amqp://guest:guest@localhost:5672/", // rabbitmq server url
// "text": "hello world!", // or "base64" to send bytes as rabbitmq message
// "queue": "test", //
// }
//
// "executor_config": {
// "url": "amqp://guest:guest@localhost:5672/", // rabbitmq server url
// "text": "hello world!", // or "base64" to send bytes as rabbitmq message
// "queue": "test", //
// }
func (r *RabbitMQ) Execute(args *dktypes.ExecuteRequest, cb dkplugin.StatusHelper) (*dktypes.ExecuteResponse, error) {
out, err := r.ExecuteImpl(args, cb)
resp := &dktypes.ExecuteResponse{Output: out}
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/v3/plugin/types"
dktypes "github.com/distribworks/dkron/v4/plugin/types"
)

func TestPublishExecute(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions builtin/bins/dkron-processor-files/files_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"strconv"

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

Expand Down
4 changes: 2 additions & 2 deletions builtin/bins/dkron-processor-files/files_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/distribworks/dkron/v3/plugin"
"github.com/distribworks/dkron/v3/plugin/types"
"github.com/distribworks/dkron/v4/plugin"
"github.com/distribworks/dkron/v4/plugin/types"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion builtin/bins/dkron-processor-files/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/distribworks/dkron/v3/plugin"
"github.com/distribworks/dkron/v4/plugin"
)

func main() {
Expand Down
Loading

0 comments on commit 586f72d

Please sign in to comment.