Skip to content

Commit ce1566d

Browse files
authored
Merge pull request #6289 from devtron-labs/target-platform-display
feat: support for target platforms
2 parents 822fa30 + 03c806e commit ce1566d

File tree

24 files changed

+71
-12
lines changed

24 files changed

+71
-12
lines changed

cmd/external-app/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.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ require gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
289289
replace (
290290
github.com/argoproj/argo-workflows/v3 v3.5.10 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
291291
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250117064214-73c2e66ce2d7
292-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250117064214-73c2e66ce2d7
292+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250122110043-4d939279c70a
293293
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
294294
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
295295
k8s.io/api => k8s.io/api v0.29.7

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,8 @@ github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpS
794794
github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA=
795795
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250117064214-73c2e66ce2d7 h1:Z29616pM3W6fcDvFsiX6JTWz2lYvdZdqzIRBfBwnK1U=
796796
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250117064214-73c2e66ce2d7/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
797-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250117064214-73c2e66ce2d7 h1:8s8qUv8D0kU34oJ68p7pujIYbKfLIBK4mq97/+55DOo=
798-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250117064214-73c2e66ce2d7/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
797+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250122110043-4d939279c70a h1:kDemKb2wGKXaRjRqWuu7FIGcfeacoW0kH9yzpSDTWN8=
798+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250122110043-4d939279c70a/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
799799
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
800800
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
801801
github.com/devtron-labs/protos v0.0.3-0.20240802105333-92ee9bb85d80 h1:xwbTeijNTf4/j1v+tSfwVqwLVnReas/NqEKeQHvSTys=

internal/sql/repository/CiArtifactRepository.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type CiArtifact struct {
7777
IsArtifactUploaded bool `sql:"is_artifact_uploaded"` // Deprecated; Use pipelineConfig.CiWorkflow instead.
7878
CredentialsSourceType string `sql:"credentials_source_type"`
7979
CredentialSourceValue string `sql:"credentials_source_value"`
80+
TargetPlatforms string `sql:"target_platforms"`
8081
ComponentId int `sql:"component_id"`
8182
DeployedTime time.Time `sql:"-"`
8283
Deployed bool `sql:"-"`

internal/sql/repository/pipelineConfig/CiWorkflowRepository.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ type WorkflowWithArtifact struct {
120120
TriggeredBy int32 `sql:"triggered_by"`
121121
EmailId string `sql:"email_id"`
122122
Image string `sql:"image"`
123+
TargetPlatforms string `sql:"target_platforms"`
123124
CiArtifactLocation string `sql:"ci_artifact_location"`
124125
CiArtifactId int `sql:"ci_artifact_id"`
125126
BlobStorageEnabled bool `sql:"blob_storage_enabled"`
@@ -193,6 +194,7 @@ func (impl *CiWorkflowRepositoryImpl) FindByPipelineId(pipelineId int, offset in
193194
ColumnExpr("cia.id AS ci_artifact_id").
194195
ColumnExpr("env.environment_name").
195196
ColumnExpr("cia.image").
197+
ColumnExpr("cia.target_platforms").
196198
ColumnExpr("cia.is_artifact_uploaded AS old_is_artifact_uploaded").
197199
ColumnExpr("wf.*").
198200
ColumnExpr("u.email_id").

pkg/bean/app.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package bean
1818

1919
import (
2020
"encoding/json"
21+
bean4 "github.com/devtron-labs/common-lib/utils/bean"
2122
bean2 "github.com/devtron-labs/devtron/api/bean/AppView"
2223
"github.com/devtron-labs/devtron/internal/sql/constants"
2324
repository3 "github.com/devtron-labs/devtron/internal/sql/repository"
@@ -827,6 +828,7 @@ type CiArtifactBean struct {
827828
CiWorkflowId int `json:"-"`
828829
RegistryType string `json:"registryType"`
829830
RegistryName string `json:"registryName"`
831+
TargetPlatforms []*bean4.TargetPlatform `json:"targetPlatforms"`
830832
CiPipelineId int `json:"-"`
831833
CredentialsSourceType string `json:"-"`
832834
CredentialsSourceValue string `json:"-"`

pkg/eventProcessor/bean/workflowEventBean.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type CiCompleteEvent struct {
8383
PluginRegistryArtifactDetails map[string][]string `json:"PluginRegistryArtifactDetails"`
8484
PluginArtifactStage string `json:"pluginArtifactStage"`
8585
IsScanEnabled bool `json:"isScanEnabled"`
86+
TargetPlatforms []string `json:"targetPlatforms"`
8687
pluginImageDetails *registry.ImageDetailsFromCR
8788
PluginArtifacts *PluginArtifacts `json:"pluginArtifacts"`
8889
}

pkg/eventProcessor/in/WorkflowEventProcessorService.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ func (impl *WorkflowEventProcessorImpl) BuildCiArtifactRequest(event bean.CiComp
678678
PluginRegistryArtifactDetails: pluginArtifacts,
679679
PluginArtifactStage: event.PluginArtifactStage,
680680
IsScanEnabled: event.IsScanEnabled,
681+
TargetPlatforms: event.TargetPlatforms,
681682
}
682683
// if DataSource is empty, repository.WEBHOOK is considered as default
683684
if request.DataSource == "" {

pkg/pipeline/AppArtifactManager.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package pipeline
1818

1919
import (
20+
"github.com/devtron-labs/common-lib/utils"
2021
argoApplication "github.com/devtron-labs/devtron/client/argocdServer/bean"
2122
"github.com/devtron-labs/devtron/pkg/build/artifacts/imageTagging"
2223
"github.com/devtron-labs/devtron/pkg/build/pipeline"
@@ -402,6 +403,7 @@ func (impl *AppArtifactManagerImpl) BuildRollbackArtifactsList(artifactListingFi
402403
deployedCiArtifacts = append(deployedCiArtifacts, bean2.CiArtifactBean{
403404
Id: ciArtifact.Id,
404405
Image: ciArtifact.Image,
406+
TargetPlatforms: utils.ConvertTargetPlatformStringToObject(ciArtifact.TargetPlatforms),
405407
MaterialInfo: mInfo,
406408
DeployedTime: formatDate(ciArtifact.StartedOn, bean2.LayoutRFC3339),
407409
WfrId: ciArtifact.CdWorkflowRunnerId,
@@ -656,6 +658,7 @@ func (impl *AppArtifactManagerImpl) BuildArtifactsList(listingFilterOpts *bean.A
656658
currentRunningArtifactBean = &bean2.CiArtifactBean{
657659
Id: currentRunningArtifact.Id,
658660
Image: currentRunningArtifact.Image,
661+
TargetPlatforms: utils.ConvertTargetPlatformStringToObject(currentRunningArtifact.TargetPlatforms),
659662
ImageDigest: currentRunningArtifact.ImageDigest,
660663
MaterialInfo: mInfo,
661664
ScanEnabled: currentRunningArtifact.ScanEnabled,
@@ -735,10 +738,11 @@ func (impl *AppArtifactManagerImpl) BuildArtifactsForCdStageV2(listingFilterOpts
735738
impl.logger.Errorw("Error in parsing artifact material info", "err", err)
736739
}
737740
ciArtifact := &bean2.CiArtifactBean{
738-
Id: artifact.Id,
739-
Image: artifact.Image,
740-
ImageDigest: artifact.ImageDigest,
741-
MaterialInfo: mInfo,
741+
Id: artifact.Id,
742+
Image: artifact.Image,
743+
TargetPlatforms: utils.ConvertTargetPlatformStringToObject(artifact.TargetPlatforms),
744+
ImageDigest: artifact.ImageDigest,
745+
MaterialInfo: mInfo,
742746
//TODO:LastSuccessfulTriggerOnParent
743747
Scanned: artifact.Scanned,
744748
ScanEnabled: artifact.ScanEnabled,
@@ -781,6 +785,7 @@ func (impl *AppArtifactManagerImpl) BuildArtifactsForCIParentV2(listingFilterOpt
781785
ciArtifact := &bean2.CiArtifactBean{
782786
Id: artifact.Id,
783787
Image: artifact.Image,
788+
TargetPlatforms: utils.ConvertTargetPlatformStringToObject(artifact.TargetPlatforms),
784789
ImageDigest: artifact.ImageDigest,
785790
MaterialInfo: mInfo,
786791
ScanEnabled: artifact.ScanEnabled,

pkg/pipeline/CdHandler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"bufio"
2121
"errors"
2222
"fmt"
23+
"github.com/devtron-labs/common-lib/utils"
24+
bean4 "github.com/devtron-labs/common-lib/utils/bean"
2325
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/adapter/cdWorkflow"
2426
bean2 "github.com/devtron-labs/devtron/pkg/bean"
2527
"github.com/devtron-labs/devtron/pkg/build/artifacts/imageTagging"
@@ -611,13 +613,16 @@ func (impl *CdHandlerImpl) FetchCdWorkflowDetails(appId int, environmentId int,
611613
triggeredByUserEmailId = "anonymous"
612614
}
613615
ciArtifactId := workflow.CiArtifactId
616+
targetPlatforms := []*bean4.TargetPlatform{}
614617
if ciArtifactId > 0 {
615618
ciArtifact, err := impl.ciArtifactRepository.Get(ciArtifactId)
616619
if err != nil {
617620
impl.Logger.Errorw("error fetching artifact data", "err", err)
618621
return types.WorkflowResponse{}, err
619622
}
620623

624+
targetPlatforms = utils.ConvertTargetPlatformStringToObject(ciArtifact.TargetPlatforms)
625+
621626
// handling linked ci pipeline
622627
if ciArtifact.ParentCiArtifact > 0 && ciArtifact.WorkflowId == nil {
623628
ciArtifactId = ciArtifact.ParentCiArtifact
@@ -673,6 +678,7 @@ func (impl *CdHandlerImpl) FetchCdWorkflowDetails(appId int, environmentId int,
673678
ArtifactId: workflow.CiArtifactId,
674679
IsArtifactUploaded: workflow.IsArtifactUploaded,
675680
CiPipelineId: ciWf.CiPipelineId,
681+
TargetPlatforms: targetPlatforms,
676682
}
677683
return workflowResponse, nil
678684

@@ -776,6 +782,7 @@ func (impl *CdHandlerImpl) converterWFR(wfr pipelineConfig.CdWorkflowRunner) pip
776782
workflow.WorkflowType = string(wfr.WorkflowType)
777783
workflow.CdWorkflowId = wfr.CdWorkflowId
778784
workflow.Image = wfr.CdWorkflow.CiArtifact.Image
785+
workflow.TargetPlatforms = utils.ConvertTargetPlatformStringToObject(wfr.CdWorkflow.CiArtifact.TargetPlatforms)
779786
workflow.PipelineId = wfr.CdWorkflow.PipelineId
780787
workflow.CiArtifactId = wfr.CdWorkflow.CiArtifactId
781788
isArtifactUploaded, isMigrationRequired := wfr.GetIsArtifactUploaded()

0 commit comments

Comments
 (0)