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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func BuildQueryForParentTypeCIOrWebhook(listingFilterOpts bean.ArtifactsListFilt
selectQuery := " SELECT cia.* "
remainingQuery := " FROM ci_artifact cia" +
" INNER JOIN ci_pipeline cp ON (cp.id=cia.pipeline_id or (cp.id=cia.component_id and cia.data_source='post_ci' ) )" +
" INNER JOIN pipeline p ON p.ci_pipeline_id = cp.id and p.id=%v" +
" INNER JOIN pipeline p ON (p.ci_pipeline_id = cp.id and p.id=%v )" +
" WHERE "
remainingQuery = fmt.Sprintf(remainingQuery, listingFilterOpts.PipelineId)
if len(listingFilterOpts.ExcludeArtifactIds) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/dockerRegistry/DockerRegistryIpsConfigService.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (impl DockerRegistryIpsConfigServiceImpl) getDockerRegistryIdForCiPipeline(
if artifact.CredentialsSourceType == repository3.GLOBAL_CONTAINER_REGISTRY {
dockerRegistryId = artifact.CredentialSourceValue
}
} else {
} else if artifact.DataSource == repository3.CI_RUNNER {
// if image is created by ci build
dockerRegistryId = *ciPipeline.CiTemplate.DockerRegistryId
if len(dockerRegistryId) == 0 {
Expand Down
12 changes: 6 additions & 6 deletions pkg/pipeline/AppArtifactManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,12 +623,12 @@ func (impl *AppArtifactManagerImpl) RetrieveArtifactsByCDPipelineV2(pipeline *pi
sort.SliceStable(ciArtifacts, func(i, j int) bool {
return ciArtifacts[i].Id > ciArtifacts[j].Id
})
}

ciArtifacts, err = impl.setAdditionalDataInArtifacts(ciArtifacts, pipeline)
if err != nil {
impl.logger.Errorw("error in setting additional data in fetched artifacts", "pipelineId", pipeline.Id, "err", err)
return ciArtifactsResponse, err
ciArtifacts, err = impl.setAdditionalDataInArtifacts(ciArtifacts, pipeline)
if err != nil {
impl.logger.Errorw("error in setting additional data in fetched artifacts", "pipelineId", pipeline.Id, "err", err)
return ciArtifactsResponse, err
}
}

ciArtifactsResponse.CdPipelineId = pipeline.Id
Expand Down Expand Up @@ -673,7 +673,7 @@ func (impl *AppArtifactManagerImpl) setAdditionalDataInArtifacts(ciArtifacts []b
if ciArtifacts[i].CredentialsSourceType == repository.GLOBAL_CONTAINER_REGISTRY {
dockerRegistryId = ciArtifacts[i].CredentialsSourceValue
}
} else {
} else if ciArtifacts[i].DataSource == repository.CI_RUNNER {
ciPipeline, err := impl.CiPipelineRepository.FindById(ciArtifacts[i].CiPipelineId)
if err != nil {
impl.logger.Errorw("error in fetching ciPipeline", "ciPipelineId", ciPipeline.Id, "error", err)
Expand Down
5 changes: 4 additions & 1 deletion pkg/pipeline/CiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,10 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig.
}
savedWf.ImagePathReservationIds = []int{imagePathReservation.Id}
//imagePath = docker.io/avd0/dashboard:fd23414b
dockerImageTag = strings.Split(imagePathReservation.ImagePath, ":")[1]
imagePathSplit := strings.Split(imagePathReservation.ImagePath, ":")
if len(imagePathSplit) >= 1 {
dockerImageTag = imagePathSplit[len(imagePathSplit)-1]
}
} else {
dockerImageTag = impl.buildImageTag(commitHashes, pipeline.Id, savedWf.Id)
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/pipeline/WebhookService.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ func (impl WebhookServiceImpl) HandleCiSuccessEvent(ciPipelineId int, request *C
if !imagePushedAt.IsZero() {
createdOn = *imagePushedAt
}

if pipeline.PipelineType == bean.CI_JOB && request.Image == "" {
impl.logger.Errorw("empty image artifact found!", "request", request)
return 0, fmt.Errorf("empty image artifact found")
}
buildArtifact := &repository.CiArtifact{
Image: request.Image,
ImageDigest: request.ImageDigest,
Expand Down Expand Up @@ -248,6 +251,9 @@ func (impl WebhookServiceImpl) HandleCiSuccessEvent(ciPipelineId int, request *C
var pluginArtifacts []*repository.CiArtifact
for registry, artifacts := range request.PluginRegistryArtifactDetails {
for _, image := range artifacts {
if pipeline.PipelineType == bean.CI_JOB && image == "" {
continue
}
pluginArtifact := &repository.CiArtifact{
Image: image,
ImageDigest: request.ImageDigest,
Expand Down