Skip to content

Commit 9dbc1fb

Browse files
Merge branch 'main' into k8s-client-app
2 parents a27e8d1 + 766523c commit 9dbc1fb

File tree

1,333 files changed

+166991
-71333
lines changed

Some content is hidden

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

1,333 files changed

+166991
-71333
lines changed

App.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import (
3030

3131
"github.com/casbin/casbin"
3232
authMiddleware "github.com/devtron-labs/authenticator/middleware"
33+
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
3334
"github.com/devtron-labs/devtron/api/router"
3435
"github.com/devtron-labs/devtron/api/sse"
35-
"github.com/devtron-labs/devtron/client/pubsub"
3636
"github.com/devtron-labs/devtron/internal/middleware"
3737
"github.com/devtron-labs/devtron/pkg/user"
3838
"github.com/go-pg/pg"
@@ -48,7 +48,7 @@ type App struct {
4848
Enforcer *casbin.SyncedEnforcer
4949
server *http.Server
5050
db *pg.DB
51-
pubsubClient *pubsub.PubSubClient
51+
pubsubClient *pubsub.PubSubClientServiceImpl
5252
posthogClient *telemetry.PosthogClient
5353
// used for local dev only
5454
serveTls bool
@@ -61,7 +61,7 @@ func NewApp(router *router.MuxRouter,
6161
sse *sse.SSE,
6262
enforcer *casbin.SyncedEnforcer,
6363
db *pg.DB,
64-
pubsubClient *pubsub.PubSubClient,
64+
pubsubClient *pubsub.PubSubClientServiceImpl,
6565
sessionManager2 *authMiddleware.SessionManager,
6666
posthogClient *telemetry.PosthogClient,
6767
) *App {
@@ -145,7 +145,6 @@ func (app *App) Stop() {
145145
app.Logger.Errorw("error in closing db connection", "err", err)
146146
}
147147
//Close not needed if you Drain.
148-
err = app.pubsubClient.Conn.Drain()
149148

150149
if err != nil {
151150
app.Logger.Errorw("Error in draining nats connection", "error", err)

CHANGELOG/release-notes-v0.6.11.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## v0.6.11
2+
3+
## Bugs
4+
- fix: Nats server version upgrade (#2837)
5+
- fix: K8s side resources error handled some unable to fetch some kinds in cluster (#2896)
6+
- fix: helm and gitOps pipeline feature gap changes (#2891)
7+
- fix: Adding /Deleting git material reflection in workflow editor and build & deploy (#2744)
8+
- fix: issue resolved for notification on deployment trigger and telemetry summary event (#2893)
9+
- fix: helm manifest output in deployment history (#2822)
10+
- fix: sending appName in the response of getAppWorkflow API (#2879)
11+
- fix: cluster not reachable handling (#2872)
12+
## Enhancements
13+
- feat: Support of reuse container image in containers section in reference chart 4-17 (#2675)
14+
- feat: Added Rollout chart 4.17 and Deployment chart 1.1 with canary using flagger and Istio support (#2910)
15+
- feat: Codacy plugin integration (#2892)
16+
- feat: Semgrep plugin integration (#2877)
17+
- perf: Tracing observability tool integration (#2782)
18+
## Documentation
19+
- docs: removed command to install a particular version of Devtron (#2888)
20+
- docs: Updated README.md file for Devtron chart (#2887)
21+
- docs: added manage tags (#2907)
22+
- docs: updated target platform (#2857)
23+
## Others
24+
- task: added new fields for eso secrets (#2899)
25+
- task: updated deployment status timeline api for helm based pipelines (#2897)
26+
- task: updated logic for adding health status timeline (#2870)
27+
28+
29+
## v0.6.11-rc.0
30+
31+
## Bugs
32+
- fix: bitbucket gitops config fixes (#2768)
33+
- fix: updated sonarqube plugin script (#2855)
34+
- fix: updated the description in sonarqube migration (#2853)
35+
- fix: External Ci Trigger - Won't show images for manual Cd pipelines (#2802)
36+
- fix: app create api bug fix if chart ref is different (#2851)
37+
- fix: Dockerfile git repo delete tooltip view to build config (#2792)
38+
## Enhancements
39+
- feat: Option for changing project in Helm apps and project assignment to CLI helm apps. (#2780)
40+
- feat: Audit logs for resource deletion from devtron UI (#2791)
41+
- feat: verify token function scope made public (#2856)
42+
- feat: Sonarqube polling script update (#2846)
43+
- feat: deployment status restructuring (#2825)
44+
## Documentation
45+
- docs: updated aws external secret doc (#2781)
46+
- docs: updated broken links and minor updates (resource browser) (#2844)
47+
- docs: added cluster, k8s resource browser, k8s resource permission (#2787)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.18 AS build-env
1+
FROM golang:1.19 AS build-env
22

33
RUN echo $GOPATH
44
RUN apt update

DockerfileEA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.18 AS build-env
1+
FROM golang:1.19 AS build-env
22

33
RUN echo $GOPATH
44
RUN apt update

Wire.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package main
2222

2323
import (
2424
"github.com/devtron-labs/authenticator/middleware"
25+
pubsub1 "github.com/devtron-labs/common-lib/pubsub-lib"
2526
"github.com/devtron-labs/devtron/api/apiToken"
2627
appStoreRestHandler "github.com/devtron-labs/devtron/api/appStore"
2728
appStoreDeployment "github.com/devtron-labs/devtron/api/appStore/deployment"
@@ -58,10 +59,10 @@ import (
5859
"github.com/devtron-labs/devtron/client/grafana"
5960
jClient "github.com/devtron-labs/devtron/client/jira"
6061
"github.com/devtron-labs/devtron/client/lens"
61-
pubsub2 "github.com/devtron-labs/devtron/client/pubsub"
6262
"github.com/devtron-labs/devtron/client/telemetry"
6363
"github.com/devtron-labs/devtron/internal/sql/repository"
6464
app2 "github.com/devtron-labs/devtron/internal/sql/repository/app"
65+
appStatusRepo "github.com/devtron-labs/devtron/internal/sql/repository/appStatus"
6566
appWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
6667
"github.com/devtron-labs/devtron/internal/sql/repository/bulkUpdate"
6768
"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
@@ -74,6 +75,7 @@ import (
7475
"github.com/devtron-labs/devtron/pkg/app"
7576
"github.com/devtron-labs/devtron/pkg/appClone"
7677
"github.com/devtron-labs/devtron/pkg/appClone/batch"
78+
"github.com/devtron-labs/devtron/pkg/appStatus"
7779
appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean"
7880
appStoreDeploymentFullMode "github.com/devtron-labs/devtron/pkg/appStore/deployment/fullMode"
7981
repository4 "github.com/devtron-labs/devtron/pkg/appStore/deployment/repository"
@@ -397,7 +399,7 @@ func InitializeApp() (*App, error) {
397399
pipeline.NewCiLogServiceImpl,
398400
wire.Bind(new(pipeline.CiLogService), new(*pipeline.CiLogServiceImpl)),
399401

400-
pubsub2.NewPubSubClient,
402+
pubsub1.NewPubSubClientServiceImpl,
401403

402404
pubsub.NewGitWebhookHandler,
403405
wire.Bind(new(pubsub.GitWebhookHandler), new(*pubsub.GitWebhookHandlerImpl)),
@@ -518,8 +520,6 @@ func InitializeApp() (*App, error) {
518520
wire.Bind(new(repository.DeploymentGroupAppRepository), new(*repository.DeploymentGroupAppRepositoryImpl)),
519521
restHandler.NewPubSubClientRestHandlerImpl,
520522
wire.Bind(new(restHandler.PubSubClientRestHandler), new(*restHandler.PubSubClientRestHandlerImpl)),
521-
pubsub2.NewNatsPublishClientImpl,
522-
wire.Bind(new(pubsub2.NatsPublishClient), new(*pubsub2.NatsPublishClientImpl)),
523523

524524
//Batch actions
525525
batch.NewWorkflowActionImpl,
@@ -753,6 +753,13 @@ func InitializeApp() (*App, error) {
753753
cron.NewCdApplicationStatusUpdateHandlerImpl,
754754
wire.Bind(new(cron.CdApplicationStatusUpdateHandler), new(*cron.CdApplicationStatusUpdateHandlerImpl)),
755755

756+
//app_status
757+
appStatusRepo.NewAppStatusRepositoryImpl,
758+
wire.Bind(new(appStatusRepo.AppStatusRepository), new(*appStatusRepo.AppStatusRepositoryImpl)),
759+
appStatus.NewAppStatusServiceImpl,
760+
wire.Bind(new(appStatus.AppStatusService), new(*appStatus.AppStatusServiceImpl)),
761+
//app_status ends
762+
756763
cron.GetCiWorkflowStatusUpdateConfig,
757764
cron.NewCiStatusUpdateCronImpl,
758765
wire.Bind(new(cron.CiStatusUpdateCron), new(*cron.CiStatusUpdateCronImpl)),

api/appStore/InstalledAppRestHandler.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ func (handler InstalledAppRestHandlerImpl) GetAllInstalledApp(w http.ResponseWri
143143
}
144144
}
145145
}
146+
147+
var appStatuses []string
148+
appStatusesStr := v.Get("appStatuses")
149+
if len(appStatusesStr) > 0 {
150+
appStatuses = strings.Split(appStatusesStr, ",")
151+
}
146152
appStoreName := v.Get("appStoreName")
147153
appName := v.Get("appName")
148154
offset := 0
@@ -155,7 +161,15 @@ func (handler InstalledAppRestHandlerImpl) GetAllInstalledApp(w http.ResponseWri
155161
if len(sizeStr) > 0 {
156162
size, _ = strconv.Atoi(sizeStr)
157163
}
158-
filter := &appStoreBean.AppStoreFilter{OnlyDeprecated: onlyDeprecated, ChartRepoId: chartRepoIds, AppStoreName: appStoreName, EnvIds: envIds, AppName: appName, ClusterIds: clusterIds}
164+
filter := &appStoreBean.AppStoreFilter{
165+
OnlyDeprecated: onlyDeprecated,
166+
ChartRepoId: chartRepoIds,
167+
AppStoreName: appStoreName,
168+
EnvIds: envIds,
169+
AppName: appName,
170+
ClusterIds: clusterIds,
171+
AppStatuses: appStatuses,
172+
}
159173
if size > 0 {
160174
filter.Size = size
161175
filter.Offset = offset

api/bean/AppView.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type AppEnvironmentContainer struct {
6262
DeploymentCounter int `json:"deploymentCounter,omitempty"`
6363
InstanceCounter int `json:"instanceCounter,omitempty"`
6464
Status string `json:"status"`
65+
AppStatus string `json:"appStatus"`
6566
CdStageStatus *string `json:"cdStageStatus"`
6667
PreStageStatus *string `json:"preStageStatus"`
6768
PostStageStatus *string `json:"postStageStatus"`
@@ -123,6 +124,7 @@ type AppDetailContainer struct {
123124
}
124125

125126
type Environment struct {
127+
AppStatus string `json:"appStatus"` //this is not the status of environment , this make sense with a specific app only
126128
EnvironmentId int `json:"environmentId"`
127129
EnvironmentName string `json:"environmentName"`
128130
AppMetrics *bool `json:"appMetrics"`

api/helm-app/openapiClient/model_helm_app.go

Lines changed: 46 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/restHandler/AppListingRestHandler.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
3434
"github.com/devtron-labs/devtron/internal/util"
3535
"github.com/devtron-labs/devtron/pkg/app"
36+
"github.com/devtron-labs/devtron/pkg/appStatus"
3637
service1 "github.com/devtron-labs/devtron/pkg/appStore/deployment/service"
3738
"github.com/devtron-labs/devtron/pkg/cluster"
3839
"github.com/devtron-labs/devtron/pkg/deploymentGroup"
@@ -85,6 +86,7 @@ type AppListingRestHandlerImpl struct {
8586
installedAppService service1.InstalledAppService
8687
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler
8788
pipelineRepository pipelineConfig.PipelineRepository
89+
appStatusService appStatus.AppStatusService
8890
}
8991

9092
type AppStatus struct {
@@ -105,7 +107,8 @@ func NewAppListingRestHandlerImpl(application application.ServiceClient,
105107
helmAppClient client.HelmAppClient, clusterService cluster.ClusterService, helmAppService client.HelmAppService,
106108
argoUserService argo.ArgoUserService, k8sApplicationService k8s.K8sApplicationService, installedAppService service1.InstalledAppService,
107109
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler,
108-
pipelineRepository pipelineConfig.PipelineRepository) *AppListingRestHandlerImpl {
110+
pipelineRepository pipelineConfig.PipelineRepository,
111+
appStatusService appStatus.AppStatusService) *AppListingRestHandlerImpl {
109112
appListingHandler := &AppListingRestHandlerImpl{
110113
application: application,
111114
appListingService: appListingService,
@@ -124,6 +127,7 @@ func NewAppListingRestHandlerImpl(application application.ServiceClient,
124127
installedAppService: installedAppService,
125128
cdApplicationStatusUpdateHandler: cdApplicationStatusUpdateHandler,
126129
pipelineRepository: pipelineRepository,
130+
appStatusService: appStatusService,
127131
}
128132
return appListingHandler
129133
}
@@ -806,6 +810,12 @@ func (handler AppListingRestHandlerImpl) fetchResourceTree(w http.ResponseWriter
806810
handler.logger.Errorw("error in syncing pipeline status", "err", err)
807811
}
808812
}
813+
//updating app_status table here
814+
err = handler.appStatusService.UpdateStatusWithAppIdEnvId(appDetail.AppId, appDetail.EnvironmentId, resp.Status)
815+
if err != nil {
816+
handler.logger.Warnw("error in updating app status", "err", err, "appId", appDetail.AppId, "envId", appDetail.EnvironmentId)
817+
}
818+
809819
} else if len(appDetail.AppName) > 0 && len(appDetail.EnvironmentName) > 0 && util.IsHelmApp(appDetail.DeploymentAppType) {
810820
config, err := handler.helmAppService.GetClusterConf(appDetail.ClusterId)
811821
if err != nil {

api/restHandler/PubSubClientRestHandler.go

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"net/http"
2323
"strings"
2424

25+
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
2526
"github.com/devtron-labs/devtron/api/restHandler/common"
26-
"github.com/devtron-labs/devtron/client/pubsub"
2727
"github.com/devtron-labs/devtron/pkg/pipeline"
2828
"go.uber.org/zap"
2929
)
@@ -33,22 +33,27 @@ type PubSubClientRestHandler interface {
3333
}
3434

3535
type PubSubClientRestHandlerImpl struct {
36-
natsPublishClient pubsub.NatsPublishClient
37-
logger *zap.SugaredLogger
38-
cdConfig *pipeline.CdConfig
36+
pubsubClient *pubsub.PubSubClientServiceImpl
37+
logger *zap.SugaredLogger
38+
cdConfig *pipeline.CdConfig
3939
}
4040

41-
func NewPubSubClientRestHandlerImpl(natsPublishClient pubsub.NatsPublishClient, logger *zap.SugaredLogger, cdConfig *pipeline.CdConfig) *PubSubClientRestHandlerImpl {
41+
type PublishRequest struct {
42+
Topic string `json:"topic"`
43+
Payload json.RawMessage `json:"payload"`
44+
}
45+
46+
func NewPubSubClientRestHandlerImpl(pubsubClient *pubsub.PubSubClientServiceImpl, logger *zap.SugaredLogger, cdConfig *pipeline.CdConfig) *PubSubClientRestHandlerImpl {
4247
return &PubSubClientRestHandlerImpl{
43-
natsPublishClient: natsPublishClient,
44-
logger: logger,
45-
cdConfig: cdConfig,
48+
pubsubClient: pubsubClient,
49+
logger: logger,
50+
cdConfig: cdConfig,
4651
}
4752
}
4853

4954
func (impl *PubSubClientRestHandlerImpl) PublishEventsToNats(w http.ResponseWriter, r *http.Request) {
5055
decoder := json.NewDecoder(r.Body)
51-
var publishRequest pubsub.PublishRequest
56+
var publishRequest PublishRequest
5257
err := decoder.Decode(&publishRequest)
5358
if err != nil {
5459
impl.logger.Errorw("request err, HandleExternalCiWebhook", "err", err, "payload", publishRequest)
@@ -68,8 +73,13 @@ func (impl *PubSubClientRestHandlerImpl) PublishEventsToNats(w http.ResponseWrit
6873
common.WriteJsonResp(w, err, "Unauthorized req", http.StatusUnauthorized)
6974
return
7075
}
71-
72-
err = impl.natsPublishClient.Publish(&publishRequest)
76+
data, err := json.Marshal(publishRequest.Payload)
77+
if err != nil {
78+
impl.logger.Errorw("error occurred in un-marshaling publishResquest in publishEvents to Nats", "err", err)
79+
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
80+
return
81+
}
82+
err = impl.pubsubClient.Publish(publishRequest.Topic, string(data))
7383
if err != nil {
7484
impl.logger.Errorw("service err, HandleExternalCiWebhook", "err", err, "payload", publishRequest)
7585
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)

0 commit comments

Comments
 (0)