Skip to content

Commit 475c3e0

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-partial-delete-argo-pipeline
2 parents ab683c9 + e054f06 commit 475c3e0

File tree

367 files changed

+70243
-2270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+70243
-2270
lines changed

App.go

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import (
2121
"crypto/tls"
2222
"fmt"
2323
"github.com/devtron-labs/common-lib/middlewares"
24+
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
2425
"github.com/devtron-labs/devtron/pkg/eventProcessor"
26+
"github.com/devtron-labs/devtron/pkg/eventProcessor/in"
2527
"log"
2628
"net/http"
2729
"os"
@@ -53,10 +55,12 @@ type App struct {
5355
posthogClient *telemetry.PosthogClient
5456
centralEventProcessor *eventProcessor.CentralEventProcessor
5557
// used for local dev only
56-
serveTls bool
57-
sessionManager2 *authMiddleware.SessionManager
58-
OtelTracingService *otel.OtelTracingServiceImpl
59-
loggingMiddleware util.LoggingMiddleware
58+
serveTls bool
59+
sessionManager2 *authMiddleware.SessionManager
60+
OtelTracingService *otel.OtelTracingServiceImpl
61+
loggingMiddleware util.LoggingMiddleware
62+
pubSubClient *pubsub.PubSubClientServiceImpl
63+
workflowEventProcessorImpl *in.WorkflowEventProcessorImpl
6064
}
6165

6266
func NewApp(router *router.MuxRouter,
@@ -68,21 +72,25 @@ func NewApp(router *router.MuxRouter,
6872
posthogClient *telemetry.PosthogClient,
6973
loggingMiddleware util.LoggingMiddleware,
7074
centralEventProcessor *eventProcessor.CentralEventProcessor,
75+
pubSubClient *pubsub.PubSubClientServiceImpl,
76+
workflowEventProcessorImpl *in.WorkflowEventProcessorImpl,
7177
) *App {
7278
//check argo connection
7379
//todo - check argo-cd version on acd integration installation
7480
app := &App{
75-
MuxRouter: router,
76-
Logger: Logger,
77-
SSE: sse,
78-
Enforcer: enforcer,
79-
db: db,
80-
serveTls: false,
81-
sessionManager2: sessionManager2,
82-
posthogClient: posthogClient,
83-
OtelTracingService: otel.NewOtelTracingServiceImpl(Logger),
84-
loggingMiddleware: loggingMiddleware,
85-
centralEventProcessor: centralEventProcessor,
81+
MuxRouter: router,
82+
Logger: Logger,
83+
SSE: sse,
84+
Enforcer: enforcer,
85+
db: db,
86+
serveTls: false,
87+
sessionManager2: sessionManager2,
88+
posthogClient: posthogClient,
89+
OtelTracingService: otel.NewOtelTracingServiceImpl(Logger),
90+
loggingMiddleware: loggingMiddleware,
91+
centralEventProcessor: centralEventProcessor,
92+
pubSubClient: pubSubClient,
93+
workflowEventProcessorImpl: workflowEventProcessorImpl,
8694
}
8795
return app
8896
}
@@ -132,14 +140,19 @@ func (app *App) Start() {
132140

133141
func (app *App) Stop() {
134142
app.Logger.Info("orchestrator shutdown initiating")
143+
err := app.pubSubClient.ShutDown()
144+
if err != nil {
145+
app.Logger.Errorw("error in NATS client shutdown", "err", err)
146+
}
147+
app.workflowEventProcessorImpl.ShutDownDevtronAppReleaseContext()
135148
posthogCl := app.posthogClient.Client
136149
if posthogCl != nil {
137150
app.Logger.Info("flushing messages of posthog")
138151
posthogCl.Close()
139152
}
140153
timeoutContext, _ := context.WithTimeout(context.Background(), 5*time.Second)
141154
app.Logger.Infow("closing router")
142-
err := app.server.Shutdown(timeoutContext)
155+
err = app.server.Shutdown(timeoutContext)
143156
if err != nil {
144157
app.Logger.Errorw("error in mux router shutdown", "err", err)
145158
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Devtron is built on some of the most trusted and loved technologies:
187187

188188
## :muscle: Trusted By
189189

190-
Devtron is trusted by communities all across the globe. The list of organizations using Devtron can be found [here](./USERS.MD).
190+
Devtron is trusted by communities all across the globe. The list of organizations using Devtron can be found [here](./USERS.md).
191191

192192

193193
## :question: FAQs & Troubleshooting

USERS.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ Currently, Devtron is being used by the following organizations:
1111
5. [Bluecopa](https://www.bluecopa.com/)
1212
6. [Chitale Bandhu](https://www.chitalebandhu.in/)
1313
7. [Centricity](https://centricity.co.in/)
14-
8. [Cyble](https://cyble.com/)
15-
9. [Delhivery](https://www.delhivery.com/)
16-
10. [KHEL Group](https://thekhelgroup.com/)
17-
11. [Lemnisk](https://www.lemnisk.co/)
18-
12. [OTPLess](https://otpless.com/)
19-
14. [Spinny](https://www.spinny.com/)
20-
15. [Tata 1Mg](https://www.1mg.com/)
21-
16. [TravClan](https://www.travclan.com/)
22-
17. [Unity Small Finance Bank](https://theunitybank.com/)
23-
18. [Xoxoday](https://www.xoxoday.com/)
14+
8. [Delhivery](https://www.delhivery.com/)
15+
9. [KHELGroup](https://thekhelgroup.com/)
16+
10. [Lemnisk](https://www.lemnisk.co/)
17+
11. [OTPLess](https://otpless.com/)
18+
12. [Spinny](https://www.spinny.com/)
19+
13. [Tata 1Mg](https://www.1mg.com/)
20+
14. [TravClan](https://www.travclan.com/)
21+
15. [Xoxoday](https://www.xoxoday.com/)
2422

2523

2624

Wire.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import (
7272
"github.com/devtron-labs/devtron/api/terminal"
7373
util5 "github.com/devtron-labs/devtron/api/util"
7474
webhookHelm "github.com/devtron-labs/devtron/api/webhook/helm"
75+
"github.com/devtron-labs/devtron/cel"
7576
"github.com/devtron-labs/devtron/client/argocdServer"
7677
"github.com/devtron-labs/devtron/client/argocdServer/application"
7778
cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster"
@@ -121,6 +122,7 @@ import (
121122
delete2 "github.com/devtron-labs/devtron/pkg/delete"
122123
deployment2 "github.com/devtron-labs/devtron/pkg/deployment"
123124
git2 "github.com/devtron-labs/devtron/pkg/deployment/gitOps/git"
125+
"github.com/devtron-labs/devtron/pkg/deployment/manifest/publish"
124126
"github.com/devtron-labs/devtron/pkg/deploymentGroup"
125127
"github.com/devtron-labs/devtron/pkg/dockerRegistry"
126128
"github.com/devtron-labs/devtron/pkg/eventProcessor"
@@ -926,8 +928,8 @@ func InitializeApp() (*App, error) {
926928
wire.Bind(new(executors.SystemWorkflowExecutor), new(*executors.SystemWorkflowExecutorImpl)),
927929
repository5.NewManifestPushConfigRepository,
928930
wire.Bind(new(repository5.ManifestPushConfigRepository), new(*repository5.ManifestPushConfigRepositoryImpl)),
929-
app.NewGitOpsManifestPushServiceImpl,
930-
wire.Bind(new(app.GitOpsPushService), new(*app.GitOpsManifestPushServiceImpl)),
931+
publish.NewGitOpsManifestPushServiceImpl,
932+
wire.Bind(new(publish.GitOpsPushService), new(*publish.GitOpsManifestPushServiceImpl)),
931933

932934
// start: docker registry wire set injection
933935
router.NewDockerRegRouterImpl,
@@ -965,6 +967,9 @@ func InitializeApp() (*App, error) {
965967
wire.Bind(new(imageDigestPolicy.ImageDigestPolicyService), new(*imageDigestPolicy.ImageDigestPolicyServiceImpl)),
966968

967969
appStoreRestHandler.AppStoreWireSet,
970+
971+
cel.NewCELServiceImpl,
972+
wire.Bind(new(cel.EvaluatorService), new(*cel.EvaluatorServiceImpl)),
968973
)
969974
return &App{}, nil
970975
}

api/bean/ValuesOverrideRequest.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,38 @@ func (workflowType WorkflowType) WorkflowTypeToStageType() repository.PipelineSt
4949
}
5050
}
5151

52+
func (workflowType WorkflowType) IsStageTypeDeploy() bool {
53+
switch workflowType {
54+
case CD_WORKFLOW_TYPE_DEPLOY:
55+
return true
56+
}
57+
return false
58+
}
59+
5260
type ValuesOverrideRequest struct {
5361
PipelineId int `json:"pipelineId" validate:"required"`
5462
AppId int `json:"appId" validate:"required"`
5563
CiArtifactId int `json:"ciArtifactId" validate:"required"`
5664
AdditionalOverride json.RawMessage `json:"additionalOverride,omitempty"`
57-
TargetDbVersion int `json:"targetDbVersion"`
5865
ForceTrigger bool `json:"forceTrigger,notnull"`
5966
DeploymentTemplate string `json:"strategy,omitempty"` // validate:"oneof=BLUE-GREEN ROLLING"`
6067
DeploymentWithConfig DeploymentConfigurationType `json:"deploymentWithConfig"`
61-
WfrIdForDeploymentWithSpecificTrigger int `json:"wfrIdForDeploymentWithSpecificTrigger"`
68+
WfrIdForDeploymentWithSpecificTrigger int `json:"wfrIdForDeploymentWithSpecificTrigger"` // target cd_workflow_runner_id for rollback. Used in rollback deployment cases
6269
CdWorkflowType WorkflowType `json:"cdWorkflowType,notnull"`
6370
WfrId int `json:"wfrId,notnull"`
6471
CdWorkflowId int `json:"cdWorkflowId"`
65-
PipelineOverrideId int `json:"pipelineOverrideId"` //required for async install/upgrade event;
66-
DeploymentType models.DeploymentType `json:"deploymentType"` //required for async install/upgrade handling; previously if was used internally
72+
PipelineOverrideId int `json:"pipelineOverrideId"` // required for async install/upgrade event;
73+
DeploymentType models.DeploymentType `json:"deploymentType"` // required for async install/upgrade handling; previously if was used internally
74+
ForceSyncDeployment bool `json:"forceSyncDeployment,notnull"`
6775
UserId int32 `json:"-"`
6876
EnvId int `json:"-"`
6977
EnvName string `json:"-"`
7078
ClusterId int `json:"-"`
7179
AppName string `json:"-"`
7280
PipelineName string `json:"-"`
7381
DeploymentAppType string `json:"-"`
82+
Namespace string `json:"-"`
83+
ReleaseName string `json:"-"`
7484
Image string `json:"-"`
7585
}
7686

api/helm-app/gRPC/applicationClient.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"github.com/caarlos0/env"
2323
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
24+
"go.opentelemetry.io/otel"
2425
"go.uber.org/zap"
2526
"google.golang.org/grpc"
2627
"time"
@@ -228,11 +229,13 @@ func (impl *HelmAppClientImpl) DeleteApplication(ctx context.Context, in *Releas
228229
}
229230

230231
func (impl *HelmAppClientImpl) UpdateApplication(ctx context.Context, in *UpgradeReleaseRequest) (*UpgradeReleaseResponse, error) {
232+
newCtx, span := otel.Tracer("orchestrator").Start(ctx, "HelmAppClientImpl.UpdateApplication")
233+
defer span.End()
231234
applicationClient, err := impl.getApplicationClient()
232235
if err != nil {
233236
return nil, err
234237
}
235-
manifest, err := applicationClient.UpgradeRelease(ctx, in)
238+
manifest, err := applicationClient.UpgradeRelease(newCtx, in)
236239
if err != nil {
237240
return nil, err
238241
}

0 commit comments

Comments
 (0)