Skip to content

Commit

Permalink
fix(contrib): start moving build.info.path inside project integration…
Browse files Browse the repository at this point in the history
… configuration (#5916)
  • Loading branch information
sguiheux authored Sep 2, 2021
1 parent 5b9b536 commit 0ab8446
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func (e *artifactoryBuildInfoPlugin) Run(_ context.Context, opts *integrationplu
lowMaturitySuffix := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigPromotionLowMaturity)]
artifactoryProjectKey := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactProjectKey)]

buildInfo := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPath)]
buildInfo := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPrefix)]
if buildInfo == "" {
buildInfo = opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPath)]
}
version := opts.GetOptions()["cds.version"]
projectKey := opts.GetOptions()["cds.project"]
workflowName := opts.GetOptions()["cds.workflow"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ func (e *artifactoryReleasePlugin) Run(_ context.Context, opts *integrationplugi
artifactoryURL := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigURL)]
token := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigToken)]
releaseToken := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigReleaseToken)]
buildInfo := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPath)]
lowMaturitySuffix := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigPromotionLowMaturity)]
highMaturitySuffix := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigPromotionHighMaturity)]

buildInfo := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPrefix)]
if buildInfo == "" {
buildInfo = opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPath)]
}

version := opts.GetOptions()["cds.version"]
projectKey := opts.GetOptions()["cds.project"]
workflowName := opts.GetOptions()["cds.workflow"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ func (e *artifactoryUploadArtifactPlugin) Run(_ context.Context, opts *integrati
pathToUpload := opts.GetOptions()["cds.integration.artifact_manager.upload.path"]
projectKey := opts.GetOptions()["cds.project"]
workflowName := opts.GetOptions()["cds.workflow"]
buildInfo := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPath)]
version := opts.GetOptions()["cds.version"]

buildInfo := opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPrefix)]
if buildInfo == "" {
buildInfo = opts.GetOptions()[fmt.Sprintf("cds.integration.artifact_manager.%s", sdk.ArtifactManagerConfigBuildInfoPath)]
}

artiClient, err := art.CreateArtifactoryClient(artifactoryURL, token)
if err != nil {
return fail("unable to create artifactory client: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions sdk/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
ArtifactManagerConfigPromotionLowMaturity = "promotion.maturity.low"
ArtifactManagerConfigPromotionHighMaturity = "promotion.maturity.high"
ArtifactManagerConfigBuildInfoPath = "build.info.path"
ArtifactManagerConfigBuildInfoPrefix = "build.info.prefix"
)

// Here are the default plateform models
Expand Down Expand Up @@ -152,6 +153,9 @@ var (
ArtifactManagerConfigPromotionHighMaturity: IntegrationConfigValue{
Type: IntegrationConfigTypeString,
},
ArtifactManagerConfigBuildInfoPrefix: IntegrationConfigValue{
Type: IntegrationConfigTypeString,
},
},
AdditionalDefaultConfig: IntegrationConfig{
ArtifactManagerConfigBuildInfoPath: IntegrationConfigValue{
Expand Down

0 comments on commit 0ab8446

Please sign in to comment.