Skip to content

Commit 9c9bb11

Browse files
committed
updated ArtifactsSourceType const
1 parent 9031282 commit 9c9bb11

File tree

7 files changed

+22
-19
lines changed

7 files changed

+22
-19
lines changed

api/router/pubsub/CiEventHandler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ func (impl *CiEventHandlerImpl) BuildCiArtifactRequest(event CiCompleteEvent) (*
242242
PluginRegistryArtifactDetails: event.PluginRegistryArtifactDetails,
243243
PluginArtifactStage: event.PluginArtifactStage,
244244
}
245+
// if DataSource is empty, repository.WEBHOOK is considered as default
245246
if request.DataSource == "" {
246247
request.DataSource = repository.WEBHOOK
247248
}
@@ -334,6 +335,7 @@ func (impl *CiEventHandlerImpl) BuildCiArtifactRequestForWebhook(event CiComplet
334335
WorkflowId: event.WorkflowId,
335336
IsArtifactUploaded: event.IsArtifactUploaded,
336337
}
338+
// if DataSource is empty, repository.WEBHOOK is considered as default
337339
if request.DataSource == "" {
338340
request.DataSource = repository.WEBHOOK
339341
}

internal/sql/repository/AppListingRepository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ func parseMaterialInfo(materialInfo string, source string) (json.RawMessage, err
429429
fmt.Printf("PARSEMATERIALINFO_MATERIAL_RECOVER, materialInfo: %s, source: %s, err: %s \n", materialInfo, source, r)
430430
}
431431
}()
432-
if source != GOCD && source != CI_RUNNER && source != WEBHOOK && source != DEPRICATED_EXT {
432+
if source != GOCD && source != CI_RUNNER && source != WEBHOOK && source != EXT {
433433
return nil, fmt.Errorf("datasource: %s not supported", source)
434434
}
435435
if materialInfo == "" {

internal/sql/repository/CiArtifactRepository.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ const (
4040

4141
// List of possible DataSource Type for an artifact
4242
const (
43-
CI_RUNNER ArtifactsSourceType = "CI-RUNNER"
44-
WEBHOOK ArtifactsSourceType = "EXTERNAL" // Currently in use instead of DEPRICATED_EXT
45-
PRE_CD ArtifactsSourceType = "pre_cd"
46-
POST_CD ArtifactsSourceType = "post_cd"
47-
POST_CI ArtifactsSourceType = "post_ci"
48-
GOCD ArtifactsSourceType = "GOCD"
49-
DEPRICATED_EXT ArtifactsSourceType = "ext" // For backward compatibility
43+
CI_RUNNER ArtifactsSourceType = "CI-RUNNER"
44+
WEBHOOK ArtifactsSourceType = "EXTERNAL" // Currently in use instead of EXT
45+
PRE_CD ArtifactsSourceType = "pre_cd"
46+
POST_CD ArtifactsSourceType = "post_cd"
47+
POST_CI ArtifactsSourceType = "post_ci"
48+
GOCD ArtifactsSourceType = "GOCD"
49+
// deprecated; Handled for backward compatibility
50+
EXT ArtifactsSourceType = "ext"
5051
// PRE_CI is not a valid DataSource for an artifact
5152
)
5253

@@ -495,7 +496,7 @@ func (impl CiArtifactRepositoryImpl) GetArtifactsByCDPipelineAndRunnerType(cdPip
495496

496497
// return map of gitUrl:hash
497498
func (info *CiArtifact) ParseMaterialInfo() (map[string]string, error) {
498-
if info.DataSource != GOCD && info.DataSource != CI_RUNNER && info.DataSource != WEBHOOK && info.DataSource != DEPRICATED_EXT {
499+
if info.DataSource != GOCD && info.DataSource != CI_RUNNER && info.DataSource != WEBHOOK && info.DataSource != EXT {
499500
return nil, fmt.Errorf("datasource: %s not supported", info.DataSource)
500501
}
501502
var ciMaterials []*CiMaterialInfo
@@ -606,7 +607,7 @@ func (impl CiArtifactRepositoryImpl) GetArtifactsByCDPipelineV2(cdPipelineId int
606607
}
607608

608609
func GetCiMaterialInfo(materialInfo string, source string) ([]CiMaterialInfo, error) {
609-
if source != GOCD && source != CI_RUNNER && source != WEBHOOK && source != POST_CI && source != PRE_CD && source != POST_CD && source != DEPRICATED_EXT {
610+
if source != GOCD && source != CI_RUNNER && source != WEBHOOK && source != POST_CI && source != PRE_CD && source != POST_CD && source != EXT {
610611
return nil, fmt.Errorf("datasource: %s not supported", source)
611612
}
612613
var ciMaterials []CiMaterialInfo

pkg/deploymentGroup/DeploymentGroupService.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ func (impl *DeploymentGroupServiceImpl) GetArtifactsByCiPipeline(ciPipelineId in
610610
}
611611

612612
func (impl *DeploymentGroupServiceImpl) parseMaterialInfo(materialInfo json.RawMessage, source string) (json.RawMessage, error) {
613-
if source != repository.GOCD && source != repository.CI_RUNNER && source != repository.WEBHOOK && source != repository.DEPRICATED_EXT {
613+
if source != repository.GOCD && source != repository.CI_RUNNER && source != repository.WEBHOOK && source != repository.EXT {
614614
return nil, fmt.Errorf("datasource: %s not supported", source)
615615
}
616616
var ciMaterials []repository.CiMaterialInfo

pkg/pipeline/PipelineBuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ type ConfigMapSecretsResponse struct {
253253
}
254254

255255
func parseMaterialInfo(materialInfo json.RawMessage, source string) (json.RawMessage, error) {
256-
if source != repository.GOCD && source != repository.CI_RUNNER && source != repository.WEBHOOK && source != repository.DEPRICATED_EXT && source != repository.PRE_CD && source != repository.POST_CD && source != repository.POST_CI {
256+
if source != repository.GOCD && source != repository.CI_RUNNER && source != repository.WEBHOOK && source != repository.EXT && source != repository.PRE_CD && source != repository.POST_CD && source != repository.POST_CI {
257257
return nil, fmt.Errorf("datasource: %s not supported", source)
258258
}
259259
var ciMaterials []repository.CiMaterialInfo

pkg/pipeline/WorkflowDagExecutor.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ func (impl *WorkflowDagExecutorImpl) HandlePreStageSuccessEvent(cdStageCompleteE
920920
return err
921921
}
922922
// Migration of deprecated DataSource Type
923-
if ciArtifact.DataSource == repository.DEPRICATED_EXT {
923+
if ciArtifact.DataSource == repository.EXT {
924924
migrationErr := impl.ciArtifactRepository.MigrateToWebHookDataSourceType(ciArtifact.Id)
925925
if migrationErr != nil {
926926
impl.logger.Warnw("unable to migrate deprecated DataSource", "artifactId", ciArtifact.Id)
@@ -1286,7 +1286,7 @@ func (impl *WorkflowDagExecutorImpl) TriggerPostStage(cdWf *pipelineConfig.CdWor
12861286
}
12871287
}
12881288
// Migration of deprecated DataSource Type
1289-
if cdWf.CiArtifact.DataSource == repository.DEPRICATED_EXT {
1289+
if cdWf.CiArtifact.DataSource == repository.EXT {
12901290
migrationErr := impl.ciArtifactRepository.MigrateToWebHookDataSourceType(cdWf.CiArtifact.Id)
12911291
if migrationErr != nil {
12921292
impl.logger.Warnw("unable to migrate deprecated DataSource", "artifactId", cdWf.CiArtifact.Id)
@@ -1457,7 +1457,7 @@ func (impl *WorkflowDagExecutorImpl) buildWFRequest(runner *pipelineConfig.CdWor
14571457
return nil, err
14581458
}
14591459
// Migration of deprecated DataSource Type
1460-
if artifact.DataSource == repository.DEPRICATED_EXT {
1460+
if artifact.DataSource == repository.EXT {
14611461
migrationErr := impl.ciArtifactRepository.MigrateToWebHookDataSourceType(artifact.Id)
14621462
if migrationErr != nil {
14631463
impl.logger.Warnw("unable to migrate deprecated DataSource", "artifactId", artifact.Id)
@@ -2347,7 +2347,7 @@ func (impl *WorkflowDagExecutorImpl) ManualCdTrigger(overrideRequest *bean.Value
23472347
return 0, err
23482348
}
23492349
// Migration of deprecated DataSource Type
2350-
if artifact.DataSource == repository.DEPRICATED_EXT {
2350+
if artifact.DataSource == repository.EXT {
23512351
migrationErr := impl.ciArtifactRepository.MigrateToWebHookDataSourceType(artifact.Id)
23522352
if migrationErr != nil {
23532353
impl.logger.Warnw("unable to migrate deprecated DataSource", "artifactId", artifact.Id)
@@ -2426,7 +2426,7 @@ func (impl *WorkflowDagExecutorImpl) ManualCdTrigger(overrideRequest *bean.Value
24262426
return 0, err
24272427
}
24282428
// Migration of deprecated DataSource Type
2429-
if artifact.DataSource == repository.DEPRICATED_EXT {
2429+
if artifact.DataSource == repository.EXT {
24302430
migrationErr := impl.ciArtifactRepository.MigrateToWebHookDataSourceType(artifact.Id)
24312431
if migrationErr != nil {
24322432
impl.logger.Warnw("unable to migrate deprecated DataSource", "artifactId", artifact.Id)
@@ -2661,7 +2661,7 @@ func (impl *WorkflowDagExecutorImpl) subscribeTriggerBulkAction() error {
26612661
return
26622662
}
26632663
// Migration of deprecated DataSource Type
2664-
if artifact.DataSource == repository.DEPRICATED_EXT {
2664+
if artifact.DataSource == repository.EXT {
26652665
migrationErr := impl.ciArtifactRepository.MigrateToWebHookDataSourceType(artifact.Id)
26662666
if migrationErr != nil {
26672667
impl.logger.Warnw("unable to migrate deprecated DataSource", "artifactId", artifact.Id)

wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)