Skip to content

fix: conflicting ci/cd events in a multi cluster devtron setup #6495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions App.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"github.com/devtron-labs/common-lib/middlewares"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
posthogTelemetry "github.com/devtron-labs/common-lib/telemetry"
"github.com/devtron-labs/devtron/pkg/eventProcessor"
"github.com/devtron-labs/devtron/pkg/eventProcessor/in"
"log"
Expand All @@ -31,7 +32,6 @@ import (
"time"

"github.com/devtron-labs/devtron/api/util"
"github.com/devtron-labs/devtron/client/telemetry"
"github.com/devtron-labs/devtron/otel"
"github.com/devtron-labs/devtron/pkg/auth/user"

Expand All @@ -55,7 +55,7 @@ type App struct {
EnforcerV2 *casbinv2.SyncedEnforcer
server *http.Server
db *pg.DB
posthogClient *telemetry.PosthogClient
posthogClient *posthogTelemetry.PosthogClient
// eventProcessor.CentralEventProcessor is used to register event processors
centralEventProcessor *eventProcessor.CentralEventProcessor // do not remove this.
// used for local dev only
Expand All @@ -73,7 +73,7 @@ func NewApp(router *router.MuxRouter,
enforcer *casbin.SyncedEnforcer,
db *pg.DB,
sessionManager2 *authMiddleware.SessionManager,
posthogClient *telemetry.PosthogClient,
posthogClient *posthogTelemetry.PosthogClient,
loggingMiddleware util.LoggingMiddleware,
centralEventProcessor *eventProcessor.CentralEventProcessor,
pubSubClient *pubsub.PubSubClientServiceImpl,
Expand Down
9 changes: 6 additions & 3 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ package main
import (
"github.com/devtron-labs/authenticator/middleware"
cloudProviderIdentifier "github.com/devtron-labs/common-lib/cloud-provider-identifier"
pubsub1 "github.com/devtron-labs/common-lib/pubsub-lib"
pubSub "github.com/devtron-labs/common-lib/pubsub-lib"
posthogTelemetry "github.com/devtron-labs/common-lib/telemetry"
util4 "github.com/devtron-labs/common-lib/utils/k8s"
"github.com/devtron-labs/devtron/api/apiToken"
appStoreRestHandler "github.com/devtron-labs/devtron/api/appStore"
Expand Down Expand Up @@ -165,6 +166,7 @@ import (
resourceGroup2 "github.com/devtron-labs/devtron/pkg/resourceGroup"
"github.com/devtron-labs/devtron/pkg/resourceQualifiers"
"github.com/devtron-labs/devtron/pkg/sql"
"github.com/devtron-labs/devtron/pkg/ucid"
util3 "github.com/devtron-labs/devtron/pkg/util"
"github.com/devtron-labs/devtron/pkg/variables"
"github.com/devtron-labs/devtron/pkg/variables/parsers"
Expand Down Expand Up @@ -501,7 +503,7 @@ func InitializeApp() (*App, error) {
pipeline.NewCiLogServiceImpl,
wire.Bind(new(pipeline.CiLogService), new(*pipeline.CiLogServiceImpl)),

pubsub1.NewPubSubClientServiceImpl,
pubSub.NewPubSubClientServiceImpl,

rbac.NewEnforcerUtilImpl,
wire.Bind(new(rbac.EnforcerUtil), new(*rbac.EnforcerUtilImpl)),
Expand Down Expand Up @@ -696,7 +698,8 @@ func InitializeApp() (*App, error) {
wire.Bind(new(router.TelemetryRouter), new(*router.TelemetryRouterImpl)),
restHandler.NewTelemetryRestHandlerImpl,
wire.Bind(new(restHandler.TelemetryRestHandler), new(*restHandler.TelemetryRestHandlerImpl)),
telemetry.NewPosthogClient,
posthogTelemetry.NewPosthogClient,
ucid.WireSet,

cloudProviderIdentifier.NewProviderIdentifierServiceImpl,
wire.Bind(new(cloudProviderIdentifier.ProviderIdentifierService), new(*cloudProviderIdentifier.ProviderIdentifierServiceImpl)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/devtron-labs/devtron/internal/sql/constants"
"github.com/devtron-labs/devtron/pkg/build/artifacts/imageTagging"
bean2 "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
eventProcessorBean "github.com/devtron-labs/devtron/pkg/eventProcessor/bean"
constants2 "github.com/devtron-labs/devtron/pkg/pipeline/constants"
"github.com/devtron-labs/devtron/util/stringsUtil"
"golang.org/x/exp/maps"
Expand All @@ -36,7 +37,6 @@ import (
"github.com/devtron-labs/devtron/util/response/pagination"
"github.com/gorilla/schema"

"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/devtron-labs/devtron/api/restHandler/common"
"github.com/devtron-labs/devtron/client/gitSensor"
"github.com/devtron-labs/devtron/internal/sql/repository"
Expand Down Expand Up @@ -1500,15 +1500,15 @@ func (handler *PipelineConfigRestHandlerImpl) DeleteMaterial(w http.ResponseWrit

func (handler *PipelineConfigRestHandlerImpl) HandleWorkflowWebhook(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
var wfUpdateReq v1alpha1.WorkflowStatus
var wfUpdateReq eventProcessorBean.CiCdStatus
err := decoder.Decode(&wfUpdateReq)
if err != nil {
handler.Logger.Errorw("request err, HandleWorkflowWebhook", "err", err, "payload", wfUpdateReq)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
handler.Logger.Infow("request payload, HandleWorkflowWebhook", "payload", wfUpdateReq)
resp, err := handler.ciHandler.UpdateWorkflow(wfUpdateReq)
resp, _, err := handler.ciHandler.UpdateWorkflow(wfUpdateReq)
if err != nil {
handler.Logger.Errorw("service err, HandleWorkflowWebhook", "err", err, "payload", wfUpdateReq)
common.WriteJsonResp(w, err, resp, http.StatusInternalServerError)
Expand Down
2 changes: 1 addition & 1 deletion client/argocdServer/config/Config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (impl *ArgoCDConfigGetterImpl) GetGRPCConfig() (*bean.ArgoGRPCConfig, error
}

func (impl *ArgoCDConfigGetterImpl) GetK8sConfig() (*bean.ArgoK8sConfig, error) {
clusterBean, err := impl.clusterReadService.FindOne(bean2.DEFAULT_CLUSTER)
clusterBean, err := impl.clusterReadService.FindOne(bean2.DefaultCluster)
if err != nil {
impl.logger.Errorw("error in fetching cluster bean from db", "err", err)
return nil, err
Expand Down
Loading