Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions pkg/bean/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,21 +602,23 @@ type Rollback struct {
}

type CiArtifactBean struct {
Id int `json:"id"`
Image string `json:"image,notnull"`
ImageDigest string `json:"image_digest,notnull"`
MaterialInfo json.RawMessage `json:"material_info"` //git material metadata json array string
DataSource string `json:"data_source,notnull"`
DeployedTime string `json:"deployed_time"`
Deployed bool `json:"deployed,notnull"`
Latest bool `json:"latest,notnull"`
LastSuccessfulTriggerOnParent bool `json:"lastSuccessfulTriggerOnParent,notnull"`
RunningOnParentCd bool `json:"runningOnParentCd,omitempty"`
IsVulnerable bool `json:"vulnerable,notnull"`
ScanEnabled bool `json:"scanEnabled,notnull"`
Scanned bool `json:"scanned,notnull"`
WfrId int `json:"wfrId"`
DeployedBy string `json:"deployedBy"`
Id int `json:"id"`
Image string `json:"image,notnull"`
ImageDigest string `json:"image_digest,notnull"`
MaterialInfo json.RawMessage `json:"material_info"` //git material metadata json array string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this work correctly, we can use map

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's working fine, also it's previous code

DataSource string `json:"data_source,notnull"`
DeployedTime string `json:"deployed_time"`
Deployed bool `json:"deployed,notnull"`
Latest bool `json:"latest,notnull"`
LastSuccessfulTriggerOnParent bool `json:"lastSuccessfulTriggerOnParent,notnull"`
RunningOnParentCd bool `json:"runningOnParentCd,omitempty"`
IsVulnerable bool `json:"vulnerable,notnull"`
ScanEnabled bool `json:"scanEnabled,notnull"`
Scanned bool `json:"scanned,notnull"`
WfrId int `json:"wfrId"`
DeployedBy string `json:"deployedBy"`
CiConfigureSourceType pipelineConfig.SourceType `json:"ciConfigureSourceType"`
CiConfigureSourceValue string `json:"ciConfigureSourceValue"`
}

type CiArtifactResponse struct {
Expand Down
10 changes: 5 additions & 5 deletions pkg/pipeline/GitopsOrHelmOption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestGitopsOrHelmOption(t *testing.T) {
nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: false}, nil, nil, nil, nil)
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: false}, nil, nil, nil, nil, nil)

pipelineCreateRequest := &bean.CdPipelines{
Pipelines: []*bean.CDPipelineConfigObject{
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestGitopsOrHelmOption(t *testing.T) {
nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: false}, nil, nil, nil, nil)
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: false}, nil, nil, nil, nil, nil)

pipelineCreateRequest := &bean.CdPipelines{
Pipelines: []*bean.CDPipelineConfigObject{
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestGitopsOrHelmOption(t *testing.T) {
nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: true}, nil, nil, nil, nil)
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: true}, nil, nil, nil, nil, nil)

pipelineCreateRequestHelm := &bean.CdPipelines{
Pipelines: []*bean.CDPipelineConfigObject{
Expand Down Expand Up @@ -221,7 +221,7 @@ func TestGitopsOrHelmOption(t *testing.T) {
nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: false}, nil, nil, nil, nil)
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: false}, nil, nil, nil, nil, nil)

pipelineCreateRequest := &bean.CdPipelines{
Pipelines: []*bean.CDPipelineConfigObject{
Expand Down Expand Up @@ -278,7 +278,7 @@ func TestGitopsOrHelmOption(t *testing.T) {
nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: true}, nil, nil, nil, nil)
nil, nil, nil, nil, nil, nil, nil, nil, &DeploymentServiceTypeConfig{IsInternalUse: true}, nil, nil, nil, nil, nil)

pipelineCreateRequest := &bean.CdPipelines{
Pipelines: []*bean.CDPipelineConfigObject{
Expand Down
21 changes: 20 additions & 1 deletion pkg/pipeline/PipelineBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ type PipelineBuilderImpl struct {
helmAppService client.HelmAppService
deploymentGroupRepository repository.DeploymentGroupRepository
ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository
ciWorkflowRepository pipelineConfig.CiWorkflowRepository
//ciTemplateOverrideRepository pipelineConfig.CiTemplateOverrideRepository
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this commented code

//ciBuildConfigService CiBuildConfigService
ciTemplateService CiTemplateService
Expand Down Expand Up @@ -244,7 +245,8 @@ func NewPipelineBuilderImpl(logger *zap.SugaredLogger,
globalStrategyMetadataChartRefMappingRepository chartRepoRepository.GlobalStrategyMetadataChartRefMappingRepository,
deploymentConfig *DeploymentServiceTypeConfig, appStatusRepository appStatus.AppStatusRepository,
workflowDagExecutor WorkflowDagExecutor,
enforcerUtil rbac.EnforcerUtil, ArgoUserService argo.ArgoUserService) *PipelineBuilderImpl {
enforcerUtil rbac.EnforcerUtil, ArgoUserService argo.ArgoUserService,
ciWorkflowRepository pipelineConfig.CiWorkflowRepository) *PipelineBuilderImpl {
return &PipelineBuilderImpl{
logger: logger,
ciCdPipelineOrchestrator: ciCdPipelineOrchestrator,
Expand Down Expand Up @@ -300,6 +302,7 @@ func NewPipelineBuilderImpl(logger *zap.SugaredLogger,
ArgoUserService: ArgoUserService,
workflowDagExecutor: workflowDagExecutor,
enforcerUtil: enforcerUtil,
ciWorkflowRepository: ciWorkflowRepository,
}
}

Expand Down Expand Up @@ -2716,6 +2719,22 @@ func (impl PipelineBuilderImpl) GetArtifactsForCdStage(cdPipelineId int, parentI
return ciArtifacts[i].Id > ciArtifacts[j].Id
})
}
for i, artifact := range ciArtifacts {
artifactBean, err := impl.ciArtifactRepository.Get(artifact.Id)
if err != nil {
impl.logger.Errorw("error in getting artifactBean for one ci_artifact", "err", err, "parentStage", parentType, "stage", stage)
return ciArtifactsResponse, err
}

ciWorkflow, err := impl.ciWorkflowRepository.FindById(*artifactBean.WorkflowId)
if err != nil {
impl.logger.Errorw("error in getting ci_workflow for artifacts", "err", err, "artifact", artifact, "parentStage", parentType, "stage", stage)
return ciArtifactsResponse, err
}
ciArtifacts[i].CiConfigureSourceType = ciWorkflow.GitTriggers[ciWorkflow.CiPipelineId].CiConfigureSourceType
ciArtifacts[i].CiConfigureSourceValue = ciWorkflow.GitTriggers[ciWorkflow.CiPipelineId].CiConfigureSourceValue
}

ciArtifactsResponse.CdPipelineId = cdPipelineId
ciArtifactsResponse.LatestWfArtifactId = latestWfArtifactId
ciArtifactsResponse.LatestWfArtifactStatus = latestWfArtifactStatus
Expand Down
2 changes: 1 addition & 1 deletion wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.