Skip to content

Commit

Permalink
Add missing priorityResolution and cdnRedirect to repository template…
Browse files Browse the repository at this point in the history
… creation (#1243)
  • Loading branch information
sverdlov93 authored and RobiNino committed Aug 29, 2024
1 parent 1729e8e commit 5af5855
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
2 changes: 2 additions & 0 deletions artifactory/commands/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var writersMap = map[string]ioutils.AnswerWriter{
SuppressPomConsistencyChecks: ioutils.WriteBoolAnswer,
BlackedOut: ioutils.WriteBoolAnswer,
DownloadRedirect: ioutils.WriteBoolAnswer,
PriorityResolution: ioutils.WriteBoolAnswer,
CdnRedirect: ioutils.WriteBoolAnswer,
BlockPushingSchema1: ioutils.WriteBoolAnswer,
DebianTrivialLayout: ioutils.WriteBoolAnswer,
ExternalDependenciesEnabled: ioutils.WriteBoolAnswer,
Expand Down
10 changes: 8 additions & 2 deletions artifactory/commands/repository/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const (
XrayIndex = "xrayIndex"
PropertySets = "propertySets"
DownloadRedirect = "downloadRedirect"
PriorityResolution = "priorityResolution"
CdnRedirect = "cdnRedirect"
BlockPushingSchema1 = "blockPushingSchema1"

// Mutual local and virtual repository configuration JSON keys
Expand Down Expand Up @@ -235,6 +237,8 @@ var optionalSuggestsMap = map[string]prompt.Suggest{
SuppressPomConsistencyChecks: {Text: SuppressPomConsistencyChecks},
BlackedOut: {Text: BlackedOut},
DownloadRedirect: {Text: DownloadRedirect},
PriorityResolution: {Text: PriorityResolution},
CdnRedirect: {Text: CdnRedirect},
BlockPushingSchema1: {Text: BlockPushingSchema1},
DebianTrivialLayout: {Text: DebianTrivialLayout},
ExternalDependenciesEnabled: {Text: ExternalDependenciesEnabled},
Expand Down Expand Up @@ -302,7 +306,7 @@ var optionalSuggestsMap = map[string]prompt.Suggest{

var baseLocalRepoConfKeys = []string{
Description, Notes, IncludePatterns, ExcludePatterns, RepoLayoutRef, ProjectKey, Environment, BlackedOut, XrayIndex,
PropertySets, ArchiveBrowsingEnabled, OptionalIndexCompressionFormats, DownloadRedirect, BlockPushingSchema1,
PropertySets, ArchiveBrowsingEnabled, OptionalIndexCompressionFormats, DownloadRedirect, PriorityResolution, CdnRedirect, BlockPushingSchema1,
}

var mavenGradleLocalRepoConfKeys = []string{
Expand Down Expand Up @@ -330,7 +334,7 @@ var baseRemoteRepoConfKeys = []string{
BlackedOut, XrayIndex, StoreArtifactsLocally, SocketTimeoutMillis, LocalAddress, RetrievalCachePeriodSecs, FailedRetrievalCachePeriodSecs,
MissedRetrievalCachePeriodSecs, UnusedArtifactsCleanupEnabled, UnusedArtifactsCleanupPeriodHours, AssumedOfflinePeriodSecs,
ShareConfiguration, SynchronizeProperties, BlockMismatchingMimeTypes, PropertySets, AllowAnyHostAuth, EnableCookieManagement,
BypassHeadRequests, ClientTlsCertificate, DownloadRedirect, BlockPushingSchema1, ContentSynchronisation,
BypassHeadRequests, ClientTlsCertificate, DownloadRedirect, PriorityResolution, CdnRedirect, BlockPushingSchema1, ContentSynchronisation,
}

var mavenGradleRemoteRepoConfKeys = []string{
Expand Down Expand Up @@ -815,6 +819,8 @@ var questionMap = map[string]ioutils.QuestionInfo{
SuppressPomConsistencyChecks: BoolToStringQuestionInfo,
BlackedOut: BoolToStringQuestionInfo,
DownloadRedirect: BoolToStringQuestionInfo,
PriorityResolution: BoolToStringQuestionInfo,
CdnRedirect: BoolToStringQuestionInfo,
BlockPushingSchema1: BoolToStringQuestionInfo,
DebianTrivialLayout: BoolToStringQuestionInfo,
ExternalDependenciesEnabled: BoolToStringQuestionInfo,
Expand Down
2 changes: 1 addition & 1 deletion artifactory/commands/transferfiles/localgeneratedfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type locallyGeneratedFilter struct {
func NewLocallyGenerated(context context.Context, serviceManager artifactory.ArtifactoryServicesManager, artifactoryVersion string) *locallyGeneratedFilter {
serviceDetails := serviceManager.GetConfig().GetServiceDetails()
httpDetails := serviceDetails.CreateHttpClientDetails()
utils.SetContentType("application/json", &httpDetails.Headers)
httpDetails.SetContentTypeApplicationJson()

enabled := version.NewVersion(artifactoryVersion).AtLeast(minArtifactoryVersionForLocallyGenerated)
log.Debug("Locally generated filter enabled:", enabled)
Expand Down
9 changes: 4 additions & 5 deletions artifactory/commands/transferfiles/srcpluginservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/transferfiles/api"
commandsUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils"
"github.com/jfrog/jfrog-client-go/artifactory/services/utils"
"github.com/jfrog/jfrog-client-go/auth"
"github.com/jfrog/jfrog-client-go/http/jfroghttpclient"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
Expand Down Expand Up @@ -49,7 +48,7 @@ func (sup *srcUserPluginService) syncChunks(ucStatus api.UploadChunksStatusBody)
}

httpDetails := sup.GetArtifactoryDetails().CreateHttpClientDetails()
utils.SetContentType("application/json", &httpDetails.Headers)
httpDetails.SetContentTypeApplicationJson()
resp, body, err := sup.client.SendPost(sup.GetArtifactoryDetails().GetUrl()+commandsUtils.PluginsExecuteRestApi+syncChunks, content, &httpDetails)
if err != nil {
return api.UploadChunksStatusResponse{}, err
Expand All @@ -76,7 +75,7 @@ func (sup *srcUserPluginService) uploadChunk(chunk api.UploadChunk) (uploadChunk
}

httpDetails := sup.GetArtifactoryDetails().CreateHttpClientDetails()
utils.SetContentType("application/json", &httpDetails.Headers)
httpDetails.SetContentTypeApplicationJson()
resp, body, err := sup.client.SendPost(sup.GetArtifactoryDetails().GetUrl()+commandsUtils.PluginsExecuteRestApi+uploadChunk, content, &httpDetails)
if err != nil {
return api.UploadChunkResponse{}, err
Expand Down Expand Up @@ -108,7 +107,7 @@ func (sup *srcUserPluginService) version() (string, error) {

func (sup *srcUserPluginService) verifyCompatibilityRequest() (*VerifyCompatibilityResponse, error) {
httpDetails := sup.GetArtifactoryDetails().CreateHttpClientDetails()
utils.SetContentType("application/json", &httpDetails.Headers)
httpDetails.SetContentTypeApplicationJson()
resp, body, err := sup.client.SendPost(sup.GetArtifactoryDetails().GetUrl()+commandsUtils.PluginsExecuteRestApi+"verifyCompatibility", []byte("{}"), &httpDetails)
if err != nil {
return nil, err
Expand All @@ -130,7 +129,7 @@ func (sup *srcUserPluginService) verifyCompatibilityRequest() (*VerifyCompatibil

func (sup *srcUserPluginService) verifyConnectivityRequest(targetAuth api.TargetAuth) error {
httpDetails := sup.GetArtifactoryDetails().CreateHttpClientDetails()
utils.SetContentType("application/json", &httpDetails.Headers)
httpDetails.SetContentTypeApplicationJson()
content, err := json.Marshal(targetAuth)
if err != nil {
return errorutils.CheckError(err)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/urfave/cli v1.22.15
github.com/vbauerster/mpb/v8 v8.7.5
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
github.com/vbauerster/mpb/v8 v8.8.3
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948
golang.org/x/mod v0.20.0
golang.org/x/sync v0.8.0
golang.org/x/term v0.23.0
Expand Down Expand Up @@ -90,7 +90,7 @@ require (
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.22.15 h1:nuqt+pdC/KqswQKhETJjo7pvn/k4xMUxgW6liI7XpnM=
github.com/urfave/cli v1.22.15/go.mod h1:wSan1hmo5zeyLGBjRJbzRTNk8gwoYa2B9n4q9dmRIc0=
github.com/vbauerster/mpb/v8 v8.7.5 h1:hUF3zaNsuaBBwzEFoCvfuX3cpesQXZC0Phm/JcHZQ+c=
github.com/vbauerster/mpb/v8 v8.7.5/go.mod h1:bRCnR7K+mj5WXKsy0NWB6Or+wctYGvVwKn6huwvxKa0=
github.com/vbauerster/mpb/v8 v8.8.3 h1:dTOByGoqwaTJYPubhVz3lO5O6MK553XVgUo33LdnNsQ=
github.com/vbauerster/mpb/v8 v8.8.3/go.mod h1:JfCCrtcMsJwP6ZwMn9e5LMnNyp3TVNpUWWkN+nd4EWk=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
Expand All @@ -231,8 +231,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
Expand Down Expand Up @@ -277,8 +277,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
Expand Down

0 comments on commit 5af5855

Please sign in to comment.