Skip to content

Commit f0e01b3

Browse files
Merge branch 'develop' into chore-nil-implementation
2 parents 6856cc0 + 0e67f5b commit f0e01b3

File tree

652 files changed

+176599
-611
lines changed

Some content is hidden

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

652 files changed

+176599
-611
lines changed

api/restHandler/CoreAppRestHandler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,11 +1847,11 @@ func (handler CoreAppRestHandlerImpl) createEnvDeploymentTemplate(appId int, use
18471847
templateRequest := bean3.TemplateRequest{
18481848
AppId: appId,
18491849
ChartRefId: chartRefId,
1850-
ValuesOverride: []byte("{}"),
1850+
ValuesOverride: util.GetEmptyJSON(),
18511851
UserId: userId,
18521852
IsAppMetricsEnabled: deploymentTemplateOverride.ShowAppMetrics,
18531853
}
1854-
newChartEntry, err := handler.chartService.CreateChartFromEnvOverride(templateRequest, context.Background())
1854+
newChartEntry, err := handler.chartService.CreateChartFromEnvOverride(context.Background(), templateRequest)
18551855
if err != nil {
18561856
handler.logger.Errorw("service err, CreateChartFromEnvOverride", "err", err, "appId", appId, "envId", envId, "chartRefId", chartRefId)
18571857
return err

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

Lines changed: 103 additions & 163 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2020-2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package configure
18+
19+
type DevtronAppDeploymentConfigRestHandlerEnt interface {
20+
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import (
3030
read5 "github.com/devtron-labs/devtron/pkg/chart/read"
3131
repository2 "github.com/devtron-labs/devtron/pkg/cluster/environment/repository"
3232
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deployedAppMetrics"
33-
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate"
3433
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/chartRef"
34+
validator2 "github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/validator"
3535
security2 "github.com/devtron-labs/devtron/pkg/policyGovernance/security/imageScanning"
3636
"github.com/devtron-labs/devtron/pkg/policyGovernance/security/imageScanning/read"
3737
read3 "github.com/devtron-labs/devtron/pkg/team/read"
@@ -108,7 +108,7 @@ type PipelineConfigRestHandlerImpl struct {
108108
ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository
109109
ciHandler pipeline.CiHandler
110110
Logger *zap.SugaredLogger
111-
deploymentTemplateValidationService deploymentTemplate.DeploymentTemplateValidationService
111+
deploymentTemplateValidationService validator2.DeploymentTemplateValidationService
112112
chartService chart.ChartService
113113
devtronAppGitOpConfigService gitOpsConfig.DevtronAppGitOpConfigService
114114
propertiesConfigService pipeline.PropertiesConfigService
@@ -141,7 +141,7 @@ type PipelineConfigRestHandlerImpl struct {
141141
}
142142

143143
func NewPipelineRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, Logger *zap.SugaredLogger,
144-
deploymentTemplateValidationService deploymentTemplate.DeploymentTemplateValidationService,
144+
deploymentTemplateValidationService validator2.DeploymentTemplateValidationService,
145145
chartService chart.ChartService,
146146
devtronAppGitOpConfigService gitOpsConfig.DevtronAppGitOpConfigService,
147147
propertiesConfigService pipeline.PropertiesConfigService,

client/cron/CiTriggerCron.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"github.com/caarlos0/env"
2222
repository2 "github.com/devtron-labs/devtron/internal/sql/repository"
23+
bean2 "github.com/devtron-labs/devtron/pkg/auth/user/bean"
2324
"github.com/devtron-labs/devtron/pkg/bean"
2425
pipelineConfigBean "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
2526
"github.com/devtron-labs/devtron/pkg/pipeline"
@@ -98,7 +99,7 @@ func (impl *CiTriggerCronImpl) TriggerCiCron() {
9899
ciTriggerRequest := bean.CiTriggerRequest{
99100
PipelineId: ciPipelineId,
100101
CiPipelineMaterial: ciPipelineMaterials,
101-
TriggeredBy: 1,
102+
TriggeredBy: bean2.SYSTEM_USER_ID,
102103
InvalidateCache: false,
103104
PipelineType: string(pipelineConfigBean.CI_JOB),
104105
}

go.mod

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,34 @@ require (
281281
require github.com/docker/distribution v2.8.2+incompatible
282282

283283
require (
284+
github.com/aws/aws-sdk-go-v2 v1.36.1 // indirect
285+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.8 // indirect
286+
github.com/aws/aws-sdk-go-v2/config v1.29.6 // indirect
287+
github.com/aws/aws-sdk-go-v2/credentials v1.17.59 // indirect
288+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.28 // indirect
289+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.61 // indirect
290+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.32 // indirect
291+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.32 // indirect
292+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
293+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.32 // indirect
294+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2 // indirect
295+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.6.0 // indirect
296+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.13 // indirect
297+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.13 // indirect
298+
github.com/aws/aws-sdk-go-v2/service/s3 v1.76.1 // indirect
299+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.15 // indirect
300+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14 // indirect
301+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 // indirect
302+
github.com/aws/smithy-go v1.22.2 // indirect
284303
github.com/dlclark/regexp2 v1.11.2 // indirect
285304
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
286305
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
287306
)
288307

289308
replace (
290309
github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
291-
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250401095543-affde454fe43
292-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250401095543-affde454fe43
310+
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250402105331-120c20ff29d9
311+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250402105331-120c20ff29d9
293312
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
294313
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
295314
k8s.io/api => k8s.io/api v0.29.7

go.sum

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,44 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:l
699699
github.com/aws/aws-sdk-go v1.44.290/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
700700
github.com/aws/aws-sdk-go v1.50.8 h1:gY0WoOW+/Wz6XmYSgDH9ge3wnAevYDSQWPxxJvqAkP4=
701701
github.com/aws/aws-sdk-go v1.50.8/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
702+
github.com/aws/aws-sdk-go-v2 v1.36.1 h1:iTDl5U6oAhkNPba0e1t1hrwAo02ZMqbrGq4k5JBWM5E=
703+
github.com/aws/aws-sdk-go-v2 v1.36.1/go.mod h1:5PMILGVKiW32oDzjj6RU52yrNrDPUHcbZQYr1sM7qmM=
704+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.8 h1:zAxi9p3wsZMIaVCdoiQp2uZ9k1LsZvmAnoTBeZPXom0=
705+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.8/go.mod h1:3XkePX5dSaxveLAYY7nsbsZZrKxCyEuE5pM4ziFxyGg=
706+
github.com/aws/aws-sdk-go-v2/config v1.29.6 h1:fqgqEKK5HaZVWLQoLiC9Q+xDlSp+1LYidp6ybGE2OGg=
707+
github.com/aws/aws-sdk-go-v2/config v1.29.6/go.mod h1:Ft+WLODzDQmCTHDvqAH1JfC2xxbZ0MxpZAcJqmE1LTQ=
708+
github.com/aws/aws-sdk-go-v2/credentials v1.17.59 h1:9btwmrt//Q6JcSdgJOLI98sdr5p7tssS9yAsGe8aKP4=
709+
github.com/aws/aws-sdk-go-v2/credentials v1.17.59/go.mod h1:NM8fM6ovI3zak23UISdWidyZuI1ghNe2xjzUZAyT+08=
710+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.28 h1:KwsodFKVQTlI5EyhRSugALzsV6mG/SGrdjlMXSZSdso=
711+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.28/go.mod h1:EY3APf9MzygVhKuPXAc5H+MkGb8k/DOSQjWS0LgkKqI=
712+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.61 h1:BBIPjlEWLxX1huGTkBu/eeqyaXC0pVwDCYbQuE/JPfU=
713+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.61/go.mod h1:6dkLZQM1D/wKKFJEvyB1OCXJ0f68wcIPDOiXm0KyT8A=
714+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.32 h1:BjUcr3X3K0wZPGFg2bxOWW3VPN8rkE3/61zhP+IHviA=
715+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.32/go.mod h1:80+OGC/bgzzFFTUmcuwD0lb4YutwQeKLFpmt6hoWapU=
716+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.32 h1:m1GeXHVMJsRsUAqG6HjZWx9dj7F5TR+cF1bjyfYyBd4=
717+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.32/go.mod h1:IitoQxGfaKdVLNg0hD8/DXmAqNy0H4K2H2Sf91ti8sI=
718+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 h1:Pg9URiobXy85kgFev3og2CuOZ8JZUBENF+dcgWBaYNk=
719+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
720+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.32 h1:OIHj/nAhVzIXGzbAE+4XmZ8FPvro3THr6NlqErJc3wY=
721+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.32/go.mod h1:LiBEsDo34OJXqdDlRGsilhlIiXR7DL+6Cx2f4p1EgzI=
722+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2 h1:D4oz8/CzT9bAEYtVhSBmFj2dNOtaHOtMKc2vHBwYizA=
723+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2/go.mod h1:Za3IHqTQ+yNcRHxu1OFucBh0ACZT4j4VQFF0BqpZcLY=
724+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.6.0 h1:kT2WeWcFySdYpPgyqJMSUE7781Qucjtn6wBvrgm9P+M=
725+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.6.0/go.mod h1:WYH1ABybY7JK9TITPnk6ZlP7gQB8psI4c9qDmMsnLSA=
726+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.13 h1:SYVGSFQHlchIcy6e7x12bsrxClCXSP5et8cqVhL8cuw=
727+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.13/go.mod h1:kizuDaLX37bG5WZaoxGPQR/LNFXpxp0vsUnqfkWXfNE=
728+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.13 h1:OBsrtam3rk8NfBEq7OLOMm5HtQ9Yyw32X4UQMya/wjw=
729+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.13/go.mod h1:3U4gFA5pmoCOja7aq4nSaIAGbaOHv2Yl2ug018cmC+Q=
730+
github.com/aws/aws-sdk-go-v2/service/s3 v1.76.1 h1:d4ZG8mELlLeUWFBMCqPtRfEP3J6aQgg/KTC9jLSlkMs=
731+
github.com/aws/aws-sdk-go-v2/service/s3 v1.76.1/go.mod h1:uZoEIR6PzGOZEjgAZE4hfYfsqK2zOHhq68JLKEvvXj4=
732+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.15 h1:/eE3DogBjYlvlbhd2ssWyeuovWunHLxfgw3s/OJa4GQ=
733+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.15/go.mod h1:2PCJYpi7EKeA5SkStAmZlF6fi0uUABuhtF8ILHjGc3Y=
734+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14 h1:M/zwXiL2iXUrHputuXgmO94TVNmcenPHxgLXLutodKE=
735+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14/go.mod h1:RVwIw3y/IqxC2YEXSIkAzRDdEU1iRabDPaYjpGCbCGQ=
736+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 h1:TzeR06UCMUq+KA3bDkujxK1GVGy+G8qQN/QVYzGLkQE=
737+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.14/go.mod h1:dspXf/oYWGWo6DEvj98wpaTeqt5+DMidZD0A9BYTizc=
738+
github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
739+
github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
702740
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
703741
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
704742
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -791,10 +829,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq
791829
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
792830
github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU=
793831
github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA=
794-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250401095543-affde454fe43 h1:sNxDziQuDDVTch6wPI9/d6lCkIml/2RvyLK7S//Zj9c=
795-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250401095543-affde454fe43/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
796-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250401095543-affde454fe43 h1:yGHHNhpaGPpOlj5O+bT4hJrNxr1J3opRZCPWk84NGms=
797-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250401095543-affde454fe43/go.mod h1:eJxpq4uIG1fww604WrQAlf1Gkr66b59LHaOOod6t6FA=
832+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250402105331-120c20ff29d9 h1:Imo0tZ6diaOwFzwJZWJkadEgrFO41gcOIGUmhYT4SUc=
833+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250402105331-120c20ff29d9/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
834+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250402105331-120c20ff29d9 h1:sMbW7oI9AL40MH9jcz4S4szyGs3LwmgcIU0UrReRZbw=
835+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250402105331-120c20ff29d9/go.mod h1:ceFKgQ2qm40PR95g5Xp2EClq7nDBKFTcglJ0JdsgClA=
798836
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
799837
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
800838
github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs=

internal/sql/repository/app/AppRepository.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ func (app *App) IsEmpty() bool {
4848
return app.Id == 0
4949
}
5050

51-
const (
52-
SYSTEM_USER_ID = 1
53-
)
54-
5551
func (app *App) IsAppJobOrExternalType() bool {
5652
return len(app.DisplayName) > 0
5753
}

internal/sql/repository/chartConfig/PipelineConfigRepository.go

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type PipelineConfigRepository interface {
4242
FindByStrategyAndPipelineId(strategy chartRepoRepository.DeploymentStrategy, pipelineId int) (pipelineStrategy *PipelineStrategy, err error)
4343
GetAllStrategyByPipelineId(pipelineId int) ([]*PipelineStrategy, error)
4444
GetDefaultStrategyByPipelineId(pipelineId int) (pipelineStrategy *PipelineStrategy, err error)
45-
Delete(pipelineStrategy *PipelineStrategy, tx *pg.Tx) error
45+
MarkAsDeleted(pipelineStrategy *PipelineStrategy, userId int32, tx *pg.Tx) error
4646
GetAllStrategyByPipelineIds(pipelineIds []int) ([]*PipelineStrategy, error)
4747
}
4848

@@ -59,33 +59,41 @@ func (impl PipelineConfigRepositoryImpl) Save(pipelineStrategy *PipelineStrategy
5959
}
6060

6161
func (impl PipelineConfigRepositoryImpl) Update(pipelineStrategy *PipelineStrategy, tx *pg.Tx) error {
62-
_, err := impl.dbConnection.Model(pipelineStrategy).WherePK().UpdateNotNull()
62+
_, err := tx.Model(pipelineStrategy).WherePK().UpdateNotNull()
6363
return err
6464
}
6565

6666
func (impl PipelineConfigRepositoryImpl) FindById(id int) (pipelineStrategy *PipelineStrategy, err error) {
6767
pipelineStrategy = &PipelineStrategy{}
6868
err = impl.dbConnection.Model(pipelineStrategy).
69-
Where("id = ?", id).Select()
69+
Where("id = ?", id).
70+
Where("deleted = ?", false).
71+
Select()
7072
return pipelineStrategy, err
7173
}
7274

7375
func (impl PipelineConfigRepositoryImpl) FindByStrategy(strategy chartRepoRepository.DeploymentStrategy) (pipelineStrategy *PipelineStrategy, err error) {
7476
pipelineStrategy = &PipelineStrategy{}
7577
err = impl.dbConnection.Model(pipelineStrategy).
76-
Where("strategy = ?", strategy).Select()
78+
Where("strategy = ?", strategy).
79+
Where("deleted = ?", false).
80+
Select()
7781
return pipelineStrategy, err
7882
}
7983

8084
func (impl PipelineConfigRepositoryImpl) FindByStrategyAndPipelineId(strategy chartRepoRepository.DeploymentStrategy, pipelineId int) (pipelineStrategy *PipelineStrategy, err error) {
8185
pipelineStrategy = &PipelineStrategy{}
8286
err = impl.dbConnection.Model(pipelineStrategy).
8387
Where("strategy = ?", strategy).
84-
Where("pipeline_id = ?", pipelineId).Select()
88+
Where("pipeline_id = ?", pipelineId).
89+
Where("deleted = ?", false).
90+
Select()
8591
return pipelineStrategy, err
8692
}
8793

88-
// it will return for multiple pipeline config for pipeline, per pipeline single pipeline config(blue green, canary)
94+
// GetAllStrategyByPipelineId -
95+
// it will return for multiple pipeline strategies for a pipeline
96+
// per pipeline single pipeline strategy (BLUE_GREEN, CANARY, ROLLING, RECREATE) can be there
8997
func (impl PipelineConfigRepositoryImpl) GetAllStrategyByPipelineId(pipelineId int) ([]*PipelineStrategy, error) {
9098
var pipelineStrategies []*PipelineStrategy
9199
err := impl.dbConnection.
@@ -99,7 +107,8 @@ func (impl PipelineConfigRepositoryImpl) GetAllStrategyByPipelineId(pipelineId i
99107
return pipelineStrategies, err
100108
}
101109

102-
// it will return single latest pipeline config for requested pipeline
110+
// GetDefaultStrategyByPipelineId -
111+
// it will return single latest pipeline strategy for the requested pipeline
103112
func (impl PipelineConfigRepositoryImpl) GetDefaultStrategyByPipelineId(pipelineId int) (pipelineStrategy *PipelineStrategy, err error) {
104113
pipelineStrategy = &PipelineStrategy{}
105114
err = impl.dbConnection.
@@ -114,8 +123,12 @@ func (impl PipelineConfigRepositoryImpl) GetDefaultStrategyByPipelineId(pipeline
114123
return pipelineStrategy, err
115124
}
116125

117-
func (impl PipelineConfigRepositoryImpl) Delete(pipelineStrategy *PipelineStrategy, tx *pg.Tx) error {
118-
return tx.Delete(pipelineStrategy)
126+
// MarkAsDeleted -
127+
// it will soft-delete the pipeline strategy from the database
128+
func (impl PipelineConfigRepositoryImpl) MarkAsDeleted(pipelineStrategy *PipelineStrategy, userId int32, tx *pg.Tx) error {
129+
pipelineStrategy.Deleted = true
130+
pipelineStrategy.UpdateAuditLog(userId)
131+
return impl.Update(pipelineStrategy, tx)
119132
}
120133

121134
func (impl PipelineConfigRepositoryImpl) GetAllStrategyByPipelineIds(pipelineIds []int) ([]*PipelineStrategy, error) {

internal/sql/repository/chartConfig/mocks/PipelineConfigRepository.go

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

0 commit comments

Comments
 (0)