Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ coverage.txt
!/api/proto/odpf/optimus/*
!/api/proto/odpf/optimus/**/*

!/api/proto/odpf/metadata/
!/api/proto/odpf/metadata/optimus/
!/api/proto/odpf/metadata/optimus/*
!/api/proto/odpf/metadata/optimus/**/*

api/third_party/openapi/odpf/**/*
api/third_party/openapi/odpf/optimus/plugins/*
api/third_party/openapi/odpf/optimus/cluster/*
api/third_party/openapi/odpf/optimus/core/*
!api/third_party/openapi/odpf/optimus/
!api/third_party/openapi/odpf/optimus/runtime_service.swagger.json
!api/third_party/openapi/odpf/optimus/core/v1beta1/runtime.swagger.json
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NAME = "github.com/odpf/optimus"
LAST_COMMIT := $(shell git rev-parse --short HEAD)
LAST_TAG := "$(shell git rev-list --tags --max-count=1)"
OPMS_VERSION := "$(shell git describe --tags ${LAST_TAG})-next"
PROTON_COMMIT := "ae233f3d942e8e72e2ec3f66ed404c57390d37fb"
PROTON_COMMIT := "4eed966804481fc19c02ce99c2df9fb3907899d0"

all: build

Expand All @@ -28,7 +28,7 @@ pack-files:
generate-proto: ## regenerate protos
@echo " > generating protobuf from odpf/proton"
@echo " > [info] make sure correct version of dependencies are installed using 'make install'"
@buf generate https://github.com/odpf/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path odpf/optimus --path odpf/metadata
@buf generate https://github.com/odpf/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path odpf/optimus
@echo " > protobuf compilation finished"

unit-test:
Expand Down
17 changes: 10 additions & 7 deletions api/handler/v1/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"strings"
"time"

"github.com/odpf/optimus/utils"

"google.golang.org/protobuf/types/known/durationpb"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
pb "github.com/odpf/optimus/api/proto/odpf/optimus"
pb "github.com/odpf/optimus/api/proto/odpf/optimus/core/v1beta1"
"github.com/odpf/optimus/core/tree"
"github.com/odpf/optimus/models"
"github.com/pkg/errors"
Expand Down Expand Up @@ -81,7 +84,7 @@ func (adapt *Adapter) FromJobProto(spec *pb.JobSpecification) (models.JobSpec, e

for _, notify := range spec.Behavior.Notify {
notifiers = append(notifiers, models.JobSpecNotifier{
On: models.JobEventType(strings.ToLower(notify.On.String())),
On: models.JobEventType(utils.FromEnumProto(notify.On.String(), "type")),
Config: notify.Config,
Channels: notify.Channels,
})
Expand Down Expand Up @@ -156,7 +159,7 @@ func (adapt *Adapter) ToJobProto(spec models.JobSpec) (*pb.JobSpecification, err
var notifyProto []*pb.JobSpecification_Behavior_Notifiers
for _, notify := range spec.Behavior.Notify {
notifyProto = append(notifyProto, &pb.JobSpecification_Behavior_Notifiers{
On: pb.JobEvent_Type(pb.JobEvent_Type_value[strings.ToUpper(string(notify.On))]),
On: pb.JobEvent_Type(pb.JobEvent_Type_value[utils.ToEnumProto(string(notify.On), "type")]),
Channels: notify.Channels,
Config: notify.Config,
})
Expand All @@ -182,7 +185,7 @@ func (adapt *Adapter) ToJobProto(spec models.JobSpec) (*pb.JobSpecification, err
Behavior: &pb.JobSpecification_Behavior{
Retry: &pb.JobSpecification_Behavior_Retry{
Count: int32(spec.Behavior.Retry.Count),
Delay: ptypes.DurationProto(spec.Behavior.Retry.Delay),
Delay: durationpb.New(spec.Behavior.Retry.Delay),
ExponentialBackoff: spec.Behavior.Retry.ExponentialBackoff,
},
Notify: notifyProto,
Expand Down Expand Up @@ -333,7 +336,7 @@ func (adapt *Adapter) FromInstanceProto(conf *pb.InstanceSpec) (models.InstanceS
for _, asset := range conf.GetData() {
assetType := models.InstanceDataTypeEnv
switch asset.Type {
case pb.InstanceSpecData_FILE:
case pb.InstanceSpecData_TYPE_FILE:
assetType = models.InstanceDataTypeFile
}
data = append(data, models.InstanceSpecData{
Expand All @@ -342,7 +345,7 @@ func (adapt *Adapter) FromInstanceProto(conf *pb.InstanceSpec) (models.InstanceS
Type: assetType,
})
}
instanceType, err := models.InstanceType("").New(conf.Type.String())
instanceType, err := models.ToInstanceType(conf.Type.String())
if err != nil {
return models.InstanceSpec{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/handler/v1/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

v1 "github.com/odpf/optimus/api/handler/v1"
pb "github.com/odpf/optimus/api/proto/odpf/optimus"
pb "github.com/odpf/optimus/api/proto/odpf/optimus/core/v1beta1"
"github.com/odpf/optimus/core/set"
"github.com/odpf/optimus/core/tree"
"github.com/odpf/optimus/job"
Expand Down
Loading