Skip to content

Commit

Permalink
feat: common-lib version update (#4399)
Browse files Browse the repository at this point in the history
* common-lib version update

* fixed: nil pointer test case

* updated: common-lib version

* version update
  • Loading branch information
Ash-exp committed Dec 19, 2023
1 parent 1f040a2 commit 4abad59
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 40 deletions.
5 changes: 3 additions & 2 deletions api/router/pubsub/ApplicationStatusHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
"github.com/devtron-labs/devtron/pkg/app"
"time"

Expand Down Expand Up @@ -89,7 +90,7 @@ type ApplicationDetail struct {
}

func (impl *ApplicationStatusHandlerImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debugw("APP_STATUS_UPDATE_REQ", "stage", "raw", "data", msg.Data)
applicationDetail := ApplicationDetail{}
err := json.Unmarshal([]byte(msg.Data), &applicationDetail)
Expand Down Expand Up @@ -170,7 +171,7 @@ func (impl *ApplicationStatusHandlerImpl) Subscribe() error {
}

func (impl *ApplicationStatusHandlerImpl) SubscribeDeleteStatus() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("received app delete event")

impl.logger.Debugw("APP_STATUS_DELETE_REQ", "stage", "raw", "data", msg.Data)
Expand Down
3 changes: 2 additions & 1 deletion api/router/pubsub/CiEventHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ecr/types"
"github.com/caarlos0/env/v6"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
"github.com/devtron-labs/devtron/internal/sql/repository"
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
"github.com/devtron-labs/devtron/pkg/pipeline"
Expand Down Expand Up @@ -95,7 +96,7 @@ func NewCiEventHandlerImpl(logger *zap.SugaredLogger, pubsubClient *pubsub.PubSu
}

func (impl *CiEventHandlerImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debugw("ci complete event received")
//defer msg.Ack()
ciCompleteEvent := CiCompleteEvent{}
Expand Down
3 changes: 2 additions & 1 deletion api/router/pubsub/GitWebhookHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package pubsub

import (
"encoding/json"
"github.com/devtron-labs/common-lib/pubsub-lib/model"

pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/devtron/client/gitSensor"
Expand Down Expand Up @@ -52,7 +53,7 @@ func NewGitWebhookHandler(logger *zap.SugaredLogger, pubsubClient *pubsub.PubSub
}

func (impl *GitWebhookHandlerImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
//defer msg.Ack()
ciPipelineMaterial := gitSensor.CiPipelineMaterial{}
err := json.Unmarshal([]byte(string(msg.Data)), &ciPipelineMaterial)
Expand Down
5 changes: 3 additions & 2 deletions api/router/pubsub/WorkflowStatusUpdateHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
"github.com/devtron-labs/devtron/api/bean"
client "github.com/devtron-labs/devtron/client/events"
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
Expand Down Expand Up @@ -69,7 +70,7 @@ func NewWorkflowStatusUpdateHandlerImpl(logger *zap.SugaredLogger, pubsubClient
}

func (impl *WorkflowStatusUpdateHandlerImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("received wf update request")
//defer msg.Ack()
wfStatus := v1alpha1.WorkflowStatus{}
Expand Down Expand Up @@ -102,7 +103,7 @@ func (impl *WorkflowStatusUpdateHandlerImpl) Subscribe() error {
}

func (impl *WorkflowStatusUpdateHandlerImpl) SubscribeCD() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("received cd wf update request")
//defer msg.Ack()
wfStatus := v1alpha1.WorkflowStatus{}
Expand Down
3 changes: 2 additions & 1 deletion client/cron/CdApplicationStatusUpdateHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
"github.com/devtron-labs/devtron/api/bean"
client2 "github.com/devtron-labs/devtron/client/events"
"github.com/devtron-labs/devtron/internal/middleware"
Expand Down Expand Up @@ -116,7 +117,7 @@ func NewCdApplicationStatusUpdateHandlerImpl(logger *zap.SugaredLogger, appServi
}

func (impl *CdApplicationStatusUpdateHandlerImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
statusUpdateEvent := pipeline.ArgoPipelineStatusSyncEvent{}
var err error
var cdPipeline *pipelineConfig.Pipeline
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set v1.8.0
github.com/devtron-labs/authenticator v0.4.32
github.com/devtron-labs/common-lib v0.0.8-0.20231204083642-08f7f57000d9
github.com/devtron-labs/common-lib v0.0.8
github.com/devtron-labs/protos v0.0.0-20230503113602-282404f70fd2
github.com/evanphx/json-patch v5.6.0+incompatible
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4 h1:YcpmyvADG
github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
github.com/devtron-labs/authenticator v0.4.32 h1:JAIJ0WqTXWj2nW7b8so9wunNICQn7O1Qpkk8INpatcs=
github.com/devtron-labs/authenticator v0.4.32/go.mod h1:ozNfT8WcruiSgnUbyp48WVfc41++W6xYXhKFp67lNTU=
github.com/devtron-labs/common-lib v0.0.8-0.20231204083642-08f7f57000d9 h1:zIYeYpnj2vB6P17xtpbgEsagmgJpSN4kzJMd8UJ/WR0=
github.com/devtron-labs/common-lib v0.0.8-0.20231204083642-08f7f57000d9/go.mod h1:x6OdUIo2z9kxXtBfz7fJEfD4s8kiAtEmlApozOf7ECM=
github.com/devtron-labs/common-lib v0.0.8 h1:rK8uGwNLrsbgzAzXot2JR+oKceb8vLRNsei4MySXDUI=
github.com/devtron-labs/common-lib v0.0.8/go.mod h1:x6OdUIo2z9kxXtBfz7fJEfD4s8kiAtEmlApozOf7ECM=
github.com/devtron-labs/protos v0.0.0-20230503113602-282404f70fd2 h1:/IEIsJTxDZ3hv8uOoCaqdWCXqcv7nCAgX9AP/v84dUY=
github.com/devtron-labs/protos v0.0.0-20230503113602-282404f70fd2/go.mod h1:l85jxWHlcSo910hdUfRycL40yGzC6glE93V1sVxVPto=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/json"
"fmt"
"github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
"path"
"regexp"
"time"
Expand Down Expand Up @@ -503,7 +504,7 @@ func (impl AppStoreDeploymentFullModeServiceImpl) UpdateRequirementYaml(installA

func (impl AppStoreDeploymentFullModeServiceImpl) SubscribeHelmInstallStatus() error {

callback := func(msg *pubsub_lib.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {

impl.logger.Debug("received helm install status event - HELM_INSTALL_STATUS", "data", msg.Data)
helmInstallNatsMessage := &appStoreBean.HelmReleaseStatusConfig{}
Expand Down
3 changes: 2 additions & 1 deletion pkg/appStore/deployment/service/InstalledAppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"bytes"
"context"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
util4 "github.com/devtron-labs/common-lib/utils/k8s"
k8sCommonBean "github.com/devtron-labs/common-lib/utils/k8s/commonBean"
k8sObjectUtils "github.com/devtron-labs/common-lib/utils/k8sObjectsUtil"
Expand Down Expand Up @@ -621,7 +622,7 @@ func (impl *InstalledAppServiceImpl) triggerDeploymentEvent(installAppVersions [
}

func (impl *InstalledAppServiceImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("cd stage event received")
//defer msg.Ack()
deployPayload := &appStoreBean.DeployPayload{}
Expand Down
3 changes: 2 additions & 1 deletion pkg/bulkAction/BulkUpdateService.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
"github.com/devtron-labs/devtron/api/bean"
client "github.com/devtron-labs/devtron/api/helm-app"
openapi "github.com/devtron-labs/devtron/api/helm-app/openapiClient"
Expand Down Expand Up @@ -1421,7 +1422,7 @@ func (impl BulkUpdateServiceImpl) BulkDeploy(request *BulkApplicationForEnvironm

func (impl BulkUpdateServiceImpl) SubscribeToCdBulkTriggerTopic() error {

callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Infow("Event received",
"topic", pubsub.CD_BULK_DEPLOY_TRIGGER_TOPIC,
"msg", msg.Data)
Expand Down
11 changes: 6 additions & 5 deletions pkg/pipeline/WorkflowDagExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/aws/aws-sdk-go/service/autoscaling"
blob_storage "github.com/devtron-labs/common-lib/blob-storage"
"github.com/devtron-labs/common-lib/pubsub-lib/model"
util5 "github.com/devtron-labs/common-lib/utils/k8s"
"github.com/devtron-labs/common-lib/utils/k8s/health"
client2 "github.com/devtron-labs/devtron/api/helm-app"
Expand Down Expand Up @@ -409,7 +410,7 @@ func NewWorkflowDagExecutorImpl(Logger *zap.SugaredLogger, pipelineRepository pi
}

func (impl *WorkflowDagExecutorImpl) Subscribe() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("cd stage event received")
//defer msg.Ack()
cdStageCompleteEvent := CdStageCompleteEvent{}
Expand Down Expand Up @@ -448,7 +449,7 @@ func (impl *WorkflowDagExecutorImpl) Subscribe() error {
return nil
}

func (impl *WorkflowDagExecutorImpl) extractOverrideRequestFromCDAsyncInstallEvent(msg *pubsub.PubSubMsg) (*bean.AsyncCdDeployEvent, *client2.AppIdentifier, error) {
func (impl *WorkflowDagExecutorImpl) extractOverrideRequestFromCDAsyncInstallEvent(msg *model.PubSubMsg) (*bean.AsyncCdDeployEvent, *client2.AppIdentifier, error) {
CDAsyncInstallNatsMessage := &bean.AsyncCdDeployEvent{}
err := json.Unmarshal([]byte(msg.Data), CDAsyncInstallNatsMessage)
if err != nil {
Expand Down Expand Up @@ -727,7 +728,7 @@ func (impl *WorkflowDagExecutorImpl) processDevtronAsyncHelmInstallRequest(CDAsy
}

func (impl *WorkflowDagExecutorImpl) SubscribeDevtronAsyncHelmInstallRequest() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("received Devtron App helm async install request event, SubscribeDevtronAsyncHelmInstallRequest", "data", msg.Data)
CDAsyncInstallNatsMessage, appIdentifier, err := impl.extractOverrideRequestFromCDAsyncInstallEvent(msg)
if err != nil {
Expand Down Expand Up @@ -2581,7 +2582,7 @@ func (impl *WorkflowDagExecutorImpl) triggerNatsEventForBulkAction(cdWorkflows [
}

func (impl *WorkflowDagExecutorImpl) subscribeTriggerBulkAction() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("subscribeTriggerBulkAction event received")
//defer msg.Ack()
cdWorkflow := new(pipelineConfig.CdWorkflow)
Expand Down Expand Up @@ -2639,7 +2640,7 @@ func (impl *WorkflowDagExecutorImpl) subscribeTriggerBulkAction() error {
}

func (impl *WorkflowDagExecutorImpl) subscribeHibernateBulkAction() error {
callback := func(msg *pubsub.PubSubMsg) {
callback := func(msg *model.PubSubMsg) {
impl.logger.Debug("subscribeHibernateBulkAction event received")
//defer msg.Ack()
deploymentGroupAppWithEnv := new(DeploymentGroupAppWithEnv)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4abad59

Please sign in to comment.