Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-partial-delete-ar…
Browse files Browse the repository at this point in the history
…go-pipeline
  • Loading branch information
Ash-exp committed Jun 20, 2024
2 parents ab683c9 + e054f06 commit 475c3e0
Show file tree
Hide file tree
Showing 367 changed files with 70,243 additions and 2,270 deletions.
45 changes: 29 additions & 16 deletions App.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import (
"crypto/tls"
"fmt"
"github.com/devtron-labs/common-lib/middlewares"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/devtron/pkg/eventProcessor"
"github.com/devtron-labs/devtron/pkg/eventProcessor/in"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -53,10 +55,12 @@ type App struct {
posthogClient *telemetry.PosthogClient
centralEventProcessor *eventProcessor.CentralEventProcessor
// used for local dev only
serveTls bool
sessionManager2 *authMiddleware.SessionManager
OtelTracingService *otel.OtelTracingServiceImpl
loggingMiddleware util.LoggingMiddleware
serveTls bool
sessionManager2 *authMiddleware.SessionManager
OtelTracingService *otel.OtelTracingServiceImpl
loggingMiddleware util.LoggingMiddleware
pubSubClient *pubsub.PubSubClientServiceImpl
workflowEventProcessorImpl *in.WorkflowEventProcessorImpl
}

func NewApp(router *router.MuxRouter,
Expand All @@ -68,21 +72,25 @@ func NewApp(router *router.MuxRouter,
posthogClient *telemetry.PosthogClient,
loggingMiddleware util.LoggingMiddleware,
centralEventProcessor *eventProcessor.CentralEventProcessor,
pubSubClient *pubsub.PubSubClientServiceImpl,
workflowEventProcessorImpl *in.WorkflowEventProcessorImpl,
) *App {
//check argo connection
//todo - check argo-cd version on acd integration installation
app := &App{
MuxRouter: router,
Logger: Logger,
SSE: sse,
Enforcer: enforcer,
db: db,
serveTls: false,
sessionManager2: sessionManager2,
posthogClient: posthogClient,
OtelTracingService: otel.NewOtelTracingServiceImpl(Logger),
loggingMiddleware: loggingMiddleware,
centralEventProcessor: centralEventProcessor,
MuxRouter: router,
Logger: Logger,
SSE: sse,
Enforcer: enforcer,
db: db,
serveTls: false,
sessionManager2: sessionManager2,
posthogClient: posthogClient,
OtelTracingService: otel.NewOtelTracingServiceImpl(Logger),
loggingMiddleware: loggingMiddleware,
centralEventProcessor: centralEventProcessor,
pubSubClient: pubSubClient,
workflowEventProcessorImpl: workflowEventProcessorImpl,
}
return app
}
Expand Down Expand Up @@ -132,14 +140,19 @@ func (app *App) Start() {

func (app *App) Stop() {
app.Logger.Info("orchestrator shutdown initiating")
err := app.pubSubClient.ShutDown()
if err != nil {
app.Logger.Errorw("error in NATS client shutdown", "err", err)
}
app.workflowEventProcessorImpl.ShutDownDevtronAppReleaseContext()
posthogCl := app.posthogClient.Client
if posthogCl != nil {
app.Logger.Info("flushing messages of posthog")
posthogCl.Close()
}
timeoutContext, _ := context.WithTimeout(context.Background(), 5*time.Second)
app.Logger.Infow("closing router")
err := app.server.Shutdown(timeoutContext)
err = app.server.Shutdown(timeoutContext)
if err != nil {
app.Logger.Errorw("error in mux router shutdown", "err", err)
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Devtron is built on some of the most trusted and loved technologies:

## :muscle: Trusted By

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


## :question: FAQs & Troubleshooting
Expand Down
18 changes: 8 additions & 10 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ Currently, Devtron is being used by the following organizations:
5. [Bluecopa](https://www.bluecopa.com/)
6. [Chitale Bandhu](https://www.chitalebandhu.in/)
7. [Centricity](https://centricity.co.in/)
8. [Cyble](https://cyble.com/)
9. [Delhivery](https://www.delhivery.com/)
10. [KHEL Group](https://thekhelgroup.com/)
11. [Lemnisk](https://www.lemnisk.co/)
12. [OTPLess](https://otpless.com/)
14. [Spinny](https://www.spinny.com/)
15. [Tata 1Mg](https://www.1mg.com/)
16. [TravClan](https://www.travclan.com/)
17. [Unity Small Finance Bank](https://theunitybank.com/)
18. [Xoxoday](https://www.xoxoday.com/)
8. [Delhivery](https://www.delhivery.com/)
9. [KHELGroup](https://thekhelgroup.com/)
10. [Lemnisk](https://www.lemnisk.co/)
11. [OTPLess](https://otpless.com/)
12. [Spinny](https://www.spinny.com/)
13. [Tata 1Mg](https://www.1mg.com/)
14. [TravClan](https://www.travclan.com/)
15. [Xoxoday](https://www.xoxoday.com/)



9 changes: 7 additions & 2 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import (
"github.com/devtron-labs/devtron/api/terminal"
util5 "github.com/devtron-labs/devtron/api/util"
webhookHelm "github.com/devtron-labs/devtron/api/webhook/helm"
"github.com/devtron-labs/devtron/cel"
"github.com/devtron-labs/devtron/client/argocdServer"
"github.com/devtron-labs/devtron/client/argocdServer/application"
cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster"
Expand Down Expand Up @@ -121,6 +122,7 @@ import (
delete2 "github.com/devtron-labs/devtron/pkg/delete"
deployment2 "github.com/devtron-labs/devtron/pkg/deployment"
git2 "github.com/devtron-labs/devtron/pkg/deployment/gitOps/git"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/publish"
"github.com/devtron-labs/devtron/pkg/deploymentGroup"
"github.com/devtron-labs/devtron/pkg/dockerRegistry"
"github.com/devtron-labs/devtron/pkg/eventProcessor"
Expand Down Expand Up @@ -926,8 +928,8 @@ func InitializeApp() (*App, error) {
wire.Bind(new(executors.SystemWorkflowExecutor), new(*executors.SystemWorkflowExecutorImpl)),
repository5.NewManifestPushConfigRepository,
wire.Bind(new(repository5.ManifestPushConfigRepository), new(*repository5.ManifestPushConfigRepositoryImpl)),
app.NewGitOpsManifestPushServiceImpl,
wire.Bind(new(app.GitOpsPushService), new(*app.GitOpsManifestPushServiceImpl)),
publish.NewGitOpsManifestPushServiceImpl,
wire.Bind(new(publish.GitOpsPushService), new(*publish.GitOpsManifestPushServiceImpl)),

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

appStoreRestHandler.AppStoreWireSet,

cel.NewCELServiceImpl,
wire.Bind(new(cel.EvaluatorService), new(*cel.EvaluatorServiceImpl)),
)
return &App{}, nil
}
18 changes: 14 additions & 4 deletions api/bean/ValuesOverrideRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,38 @@ func (workflowType WorkflowType) WorkflowTypeToStageType() repository.PipelineSt
}
}

func (workflowType WorkflowType) IsStageTypeDeploy() bool {
switch workflowType {
case CD_WORKFLOW_TYPE_DEPLOY:
return true
}
return false
}

type ValuesOverrideRequest struct {
PipelineId int `json:"pipelineId" validate:"required"`
AppId int `json:"appId" validate:"required"`
CiArtifactId int `json:"ciArtifactId" validate:"required"`
AdditionalOverride json.RawMessage `json:"additionalOverride,omitempty"`
TargetDbVersion int `json:"targetDbVersion"`
ForceTrigger bool `json:"forceTrigger,notnull"`
DeploymentTemplate string `json:"strategy,omitempty"` // validate:"oneof=BLUE-GREEN ROLLING"`
DeploymentWithConfig DeploymentConfigurationType `json:"deploymentWithConfig"`
WfrIdForDeploymentWithSpecificTrigger int `json:"wfrIdForDeploymentWithSpecificTrigger"`
WfrIdForDeploymentWithSpecificTrigger int `json:"wfrIdForDeploymentWithSpecificTrigger"` // target cd_workflow_runner_id for rollback. Used in rollback deployment cases
CdWorkflowType WorkflowType `json:"cdWorkflowType,notnull"`
WfrId int `json:"wfrId,notnull"`
CdWorkflowId int `json:"cdWorkflowId"`
PipelineOverrideId int `json:"pipelineOverrideId"` //required for async install/upgrade event;
DeploymentType models.DeploymentType `json:"deploymentType"` //required for async install/upgrade handling; previously if was used internally
PipelineOverrideId int `json:"pipelineOverrideId"` // required for async install/upgrade event;
DeploymentType models.DeploymentType `json:"deploymentType"` // required for async install/upgrade handling; previously if was used internally
ForceSyncDeployment bool `json:"forceSyncDeployment,notnull"`
UserId int32 `json:"-"`
EnvId int `json:"-"`
EnvName string `json:"-"`
ClusterId int `json:"-"`
AppName string `json:"-"`
PipelineName string `json:"-"`
DeploymentAppType string `json:"-"`
Namespace string `json:"-"`
ReleaseName string `json:"-"`
Image string `json:"-"`
}

Expand Down
5 changes: 4 additions & 1 deletion api/helm-app/gRPC/applicationClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"github.com/caarlos0/env"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/otel"
"go.uber.org/zap"
"google.golang.org/grpc"
"time"
Expand Down Expand Up @@ -228,11 +229,13 @@ func (impl *HelmAppClientImpl) DeleteApplication(ctx context.Context, in *Releas
}

func (impl *HelmAppClientImpl) UpdateApplication(ctx context.Context, in *UpgradeReleaseRequest) (*UpgradeReleaseResponse, error) {
newCtx, span := otel.Tracer("orchestrator").Start(ctx, "HelmAppClientImpl.UpdateApplication")
defer span.End()
applicationClient, err := impl.getApplicationClient()
if err != nil {
return nil, err
}
manifest, err := applicationClient.UpgradeRelease(ctx, in)
manifest, err := applicationClient.UpgradeRelease(newCtx, in)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 475c3e0

Please sign in to comment.