Skip to content

Commit 891d267

Browse files
committed
Merge branch 'develop' into config-diff-3-oss
# Conflicts: # pkg/bean/configSecretData.go
2 parents 060d5d7 + 00918bb commit 891d267

File tree

132 files changed

+2692
-1559
lines changed

Some content is hidden

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

132 files changed

+2692
-1559
lines changed

CHANGELOG/release-notes-v0.7.3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## v0.7.3
2+
3+
4+
5+
## Bugs
6+
- fix: Builds set to auto not getting triggered (#5925)
7+
- fix: User Rbac Fixes (#5940)

Wire.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ import (
105105
security2 "github.com/devtron-labs/devtron/internal/sql/repository/security"
106106
"github.com/devtron-labs/devtron/internal/util"
107107
"github.com/devtron-labs/devtron/pkg/app"
108+
"github.com/devtron-labs/devtron/pkg/app/dbMigration"
108109
"github.com/devtron-labs/devtron/pkg/app/status"
109110
"github.com/devtron-labs/devtron/pkg/appClone"
110111
"github.com/devtron-labs/devtron/pkg/appClone/batch"
@@ -1005,6 +1006,9 @@ func InitializeApp() (*App, error) {
10051006

10061007
repocreds.NewServiceClientImpl,
10071008
wire.Bind(new(repocreds.ServiceClient), new(*repocreds.ServiceClientImpl)),
1009+
1010+
dbMigration.NewDbMigrationServiceImpl,
1011+
wire.Bind(new(dbMigration.DbMigration), new(*dbMigration.DbMigrationServiceImpl)),
10081012
)
10091013
return &App{}, nil
10101014
}

api/appbean/AppDetail.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,10 @@ type Secret struct {
179179
}
180180

181181
type ConfigMapSecretDataVolumeUsageConfig struct {
182-
MountPath string `json:"mountPath"`
183-
SubPath bool `json:"subPath"`
184-
FilePermission string `json:"filePermission"`
182+
MountPath string `json:"mountPath"`
183+
SubPath bool `json:"subPath"`
184+
FilePermission string `json:"filePermission"`
185+
ESOSubPath []string `json:"esoSubPath"`
185186
}
186187

187188
type ExternalSecret struct {

api/bean/ConfigMapAndSecret.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type ConfigSecretMap struct {
5454
RoleARN string `json:"roleARN"`
5555
SecretData json.RawMessage `json:"secretData,omitempty"`
5656
SubPath bool `json:"subPath"`
57+
ESOSubPath []string `json:"esoSubPath"`
5758
FilePermission string `json:"filePermission"`
5859
}
5960

@@ -70,7 +71,7 @@ func (configSecretJson *ConfigSecretJson) SetReferencedSecrets(secrets []ConfigS
7071
configSecretJson.Secrets = util.GetReferencedArray(secrets)
7172
}
7273

73-
func (ConfigSecretRootJson) GetTransformedDataForSecretData(data string, mode util.SecretTransformMode) (string, error) {
74+
func GetTransformedDataForSecretData(data string, mode util.SecretTransformMode) (string, error) {
7475
secretsJson := ConfigSecretRootJson{}
7576
err := json.Unmarshal([]byte(data), &secretsJson)
7677
if err != nil {

api/restHandler/CoreAppRestHandler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ func (handler CoreAppRestHandlerImpl) buildAppConfigMaps(appId int, envId int, c
891891
}
892892
var dataObj map[string]interface{}
893893
if data != nil {
894-
err := json.Unmarshal([]byte(data), &dataObj)
894+
err := json.Unmarshal(data, &dataObj)
895895
if err != nil {
896896
handler.logger.Errorw("service err, un-marshaling of data fail in config map", "err", err, "appId", appId)
897897
return nil, err, http.StatusInternalServerError
@@ -1041,6 +1041,7 @@ func (handler CoreAppRestHandlerImpl) buildAppSecrets(appId int, envId int, secr
10411041
globalSecret.DataVolumeUsageConfig = &appBean.ConfigMapSecretDataVolumeUsageConfig{
10421042
SubPath: secret.SubPath,
10431043
FilePermission: secret.FilePermission,
1044+
ESOSubPath: secret.ESOSubPath,
10441045
}
10451046
considerGlobalDefaultData := envId > 0 && secret.Data == nil
10461047
if considerGlobalDefaultData {
@@ -1486,6 +1487,7 @@ func (handler CoreAppRestHandlerImpl) createGlobalSecrets(appId int, userId int3
14861487
secretData.MountPath = dataVolumeUsageConfig.MountPath
14871488
secretData.SubPath = dataVolumeUsageConfig.SubPath
14881489
secretData.FilePermission = dataVolumeUsageConfig.FilePermission
1490+
secretData.ESOSubPath = dataVolumeUsageConfig.ESOSubPath
14891491
}
14901492

14911493
if secret.IsExternal {
@@ -1989,6 +1991,7 @@ func (handler CoreAppRestHandlerImpl) createEnvSecret(appId int, userId int32, e
19891991
secretData.MountPath = secretOverrideDataVolumeUsageConfig.MountPath
19901992
secretData.SubPath = secretOverrideDataVolumeUsageConfig.SubPath
19911993
secretData.FilePermission = secretOverrideDataVolumeUsageConfig.FilePermission
1994+
secretData.ESOSubPath = secretOverrideDataVolumeUsageConfig.ESOSubPath
19921995
}
19931996
var secretDataRequest []*bean2.ConfigData
19941997
secretDataRequest = append(secretDataRequest, secretData)

api/restHandler/DockerRegRestHandler.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ func (impl DockerRegRestHandlerImpl) ValidateDockerRegistryConfig(w http.Respons
307307
}
308308
bean.User = userId
309309

310-
impl.logger.Infow("request payload, ValidateDockerRegistryConfig", "payload", bean)
310+
impl.logger.Infow("request payload, ValidateDockerRegistryConfig", "dockerRegistryId", bean.Id)
311311
err = impl.validator.Struct(bean)
312312
if err != nil {
313-
impl.logger.Errorw("validation err, ValidateDockerRegistryConfig", "err", err, "payload", bean)
313+
impl.logger.Errorw("validation err, ValidateDockerRegistryConfig", "err", err, "dockerRegistryId", bean.Id)
314314
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
315315
return
316316
}
@@ -494,23 +494,23 @@ func (impl DockerRegRestHandlerImpl) UpdateDockerRegistryConfig(w http.ResponseW
494494
var bean types.DockerArtifactStoreBean
495495
err = decoder.Decode(&bean)
496496
if err != nil {
497-
impl.logger.Errorw("request err, UpdateDockerRegistryConfig", "err", err, "payload", bean)
497+
impl.logger.Errorw("request err, UpdateDockerRegistryConfig", "err", err, "dockerRegistryId", bean.Id)
498498
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
499499
return
500500
}
501501
bean.User = userId
502502
requestErr := ValidateDockerArtifactStoreRequestBean(bean)
503503
if requestErr != nil {
504504
err = fmt.Errorf("invalid payload, missing or incorrect values for required fields")
505-
impl.logger.Errorw("validation err, SaveDockerRegistryConfig", "err", err, "payload", bean)
505+
impl.logger.Errorw("validation err, SaveDockerRegistryConfig", "err", err, "dockerRegistryId", bean.Id)
506506
common.WriteJsonResp(w, requestErr, nil, http.StatusBadRequest)
507507
return
508508
}
509509

510-
impl.logger.Infow("request payload, UpdateDockerRegistryConfig", "err", err, "payload", bean)
510+
impl.logger.Infow("request payload, UpdateDockerRegistryConfig", "err", err, "dockerRegistryId", bean.Id)
511511
err = impl.validator.Struct(bean)
512512
if err != nil {
513-
impl.logger.Errorw("validation err, UpdateDockerRegistryConfig", "err", err, "payload", bean)
513+
impl.logger.Errorw("validation err, UpdateDockerRegistryConfig", "err", err, "dockerRegistryId", bean.Id)
514514
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
515515
return
516516
}
@@ -525,7 +525,7 @@ func (impl DockerRegRestHandlerImpl) UpdateDockerRegistryConfig(w http.ResponseW
525525

526526
res, err := impl.dockerRegistryConfig.Update(&bean)
527527
if err != nil {
528-
impl.logger.Errorw("service err, UpdateDockerRegistryConfig", "err", err, "payload", bean)
528+
impl.logger.Errorw("service err, UpdateDockerRegistryConfig", "err", err, "dockerRegistryId", bean.Id)
529529
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
530530
return
531531
}

api/restHandler/GitProviderRestHandler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ func (impl GitProviderRestHandlerImpl) UpdateGitRepoConfig(w http.ResponseWriter
175175
var bean types.GitRegistry
176176
err = decoder.Decode(&bean)
177177
if err != nil {
178-
impl.logger.Errorw("request err, UpdateGitRepoConfig", "err", err, "payload", bean)
178+
impl.logger.Errorw("request err, UpdateGitRepoConfig", "err", err, "gitRegistryId", bean.Id)
179179
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
180180
return
181181
}
182182
bean.UserId = userId
183-
impl.logger.Infow("request payload, UpdateGitRepoConfig", "payload", bean)
183+
impl.logger.Infow("request payload, UpdateGitRepoConfig", "gitRegistryId", bean.Id)
184184
err = impl.validator.Struct(bean)
185185
if err != nil {
186-
impl.logger.Errorw("validation err, UpdateGitRepoConfig", "err", err, "payload", bean)
186+
impl.logger.Errorw("validation err, UpdateGitRepoConfig", "err", err, "gitRegistryId", bean.Id)
187187
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
188188
return
189189
}
@@ -197,7 +197,7 @@ func (impl GitProviderRestHandlerImpl) UpdateGitRepoConfig(w http.ResponseWriter
197197

198198
res, err := impl.gitRegistryConfig.Update(&bean)
199199
if err != nil {
200-
impl.logger.Errorw("service err, UpdateGitRepoConfig", "err", err, "payload", bean)
200+
impl.logger.Errorw("service err, UpdateGitRepoConfig", "err", err, "gitRegistryId", bean.Id)
201201
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
202202
return
203203
}

api/restHandler/app/pipeline/configure/BuildPipelineRestHandler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ func (handler *PipelineConfigRestHandlerImpl) GetHistoricBuildLogs(w http.Respon
10161016
return
10171017
}
10181018
//RBAC
1019-
resp, err := handler.ciHandler.GetHistoricBuildLogs(pipelineId, workflowId, nil)
1019+
resp, err := handler.ciHandler.GetHistoricBuildLogs(workflowId, nil)
10201020
if err != nil {
10211021
handler.Logger.Errorw("service err, GetHistoricBuildLogs", "err", err, "pipelineId", pipelineId, "workflowId", workflowId)
10221022
common.WriteJsonResp(w, err, resp, http.StatusInternalServerError)
@@ -1155,7 +1155,7 @@ func (handler *PipelineConfigRestHandlerImpl) GetBuildLogs(w http.ResponseWriter
11551155
return
11561156
}
11571157
}
1158-
logsReader, cleanUp, err := handler.ciHandler.GetRunningWorkflowLogs(pipelineId, workflowId)
1158+
logsReader, cleanUp, err := handler.ciHandler.GetRunningWorkflowLogs(workflowId)
11591159
if err != nil {
11601160
handler.Logger.Errorw("service err, GetBuildLogs", "err", err, "pipelineId", pipelineId, "workflowId", workflowId, "lastEventId", lastEventId)
11611161
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)

api/restHandler/app/pipeline/configure/DeploymentPipelineRestHandler.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ import (
5151
)
5252

5353
type DeploymentHistoryResp struct {
54-
CdWorkflows []pipelineConfig.CdWorkflowWithArtifact `json:"cdWorkflows"`
55-
TagsEdiatable bool `json:"tagsEditable"`
56-
AppReleaseTagNames []string `json:"appReleaseTagNames"` //unique list of tags exists in the app
57-
HideImageTaggingHardDelete bool `json:"hideImageTaggingHardDelete"`
54+
CdWorkflows []pipelineBean.CdWorkflowWithArtifact `json:"cdWorkflows"`
55+
TagsEdiatable bool `json:"tagsEditable"`
56+
AppReleaseTagNames []string `json:"appReleaseTagNames"` //unique list of tags exists in the app
57+
HideImageTaggingHardDelete bool `json:"hideImageTaggingHardDelete"`
5858
}
5959

6060
type DevtronAppDeploymentRestHandler interface {
@@ -1337,17 +1337,16 @@ func (handler *PipelineConfigRestHandlerImpl) GetArtifactsByCDPipeline(w http.Re
13371337
return
13381338
}
13391339
//rbac block ends here
1340-
var ciArtifactResponse *bean.CiArtifactResponse
1341-
if handler.pipelineRestHandlerEnvConfig.UseArtifactListApiV2 {
1342-
artifactsListFilterOptions := &bean2.ArtifactsListFilterOptions{
1343-
Limit: limit,
1344-
Offset: offset,
1345-
SearchString: searchString,
1346-
}
1347-
ciArtifactResponse, err = handler.pipelineBuilder.RetrieveArtifactsByCDPipelineV2(pipeline, bean2.WorkflowType(stage), artifactsListFilterOptions)
1348-
} else {
1349-
ciArtifactResponse, err = handler.pipelineBuilder.RetrieveArtifactsByCDPipeline(pipeline, bean2.WorkflowType(stage))
1340+
artifactsListFilterOptions := &bean2.ArtifactsListFilterOptions{
1341+
Limit: limit,
1342+
Offset: offset,
1343+
SearchString: searchString,
13501344
}
1345+
1346+
//RetrieveArtifactsByCDPipeline is deprecated and method is removed from code
1347+
//ciArtifactResponse, err = handler.pipelineBuilder.RetrieveArtifactsByCDPipeline(pipeline, bean2.WorkflowType(stage))
1348+
1349+
ciArtifactResponse, err := handler.pipelineBuilder.RetrieveArtifactsByCDPipelineV2(pipeline, bean2.WorkflowType(stage), artifactsListFilterOptions)
13511350
if err != nil {
13521351
handler.Logger.Errorw("service err, GetArtifactsByCDPipeline", "err", err, "cdPipelineId", cdPipelineId, "stage", stage)
13531352
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
@@ -1903,7 +1902,7 @@ func (handler *PipelineConfigRestHandlerImpl) DownloadArtifacts(w http.ResponseW
19031902
}
19041903
//RBAC CHECK
19051904

1906-
file, err := handler.cdHandler.DownloadCdWorkflowArtifacts(pipelineId, buildId)
1905+
file, err := handler.cdHandler.DownloadCdWorkflowArtifacts(buildId)
19071906
defer file.Close()
19081907

19091908
if err != nil {

api/restHandler/app/pipeline/configure/PipelineConfigRestHandler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import (
6262
)
6363

6464
type PipelineRestHandlerEnvConfig struct {
65-
UseArtifactListApiV2 bool `env:"USE_ARTIFACT_LISTING_API_V2" envDefault:"true"`
65+
UseArtifactListApiV2 bool `env:"USE_ARTIFACT_LISTING_API_V2" envDefault:"true"` //deprecated
6666
}
6767

6868
type DevtronAppRestHandler interface {

0 commit comments

Comments
 (0)