From a0ff7fbda1382bd75beb09197b84b40075ee797b Mon Sep 17 00:00:00 2001 From: Joe Henshaw <55037157+joeh90@users.noreply.github.com> Date: Thu, 2 Apr 2020 19:11:52 +0100 Subject: [PATCH] feat(repo): add new fields for docker repositories (#52) --- artifactory/artifactory-accessors.go | 24 +++++++++++++++++++ .../repositories/local_repository.json | 1 + .../repositories/remote_repository.json | 3 ++- .../repositories/virtual_repository.json | 3 ++- artifactory/repositories.go | 3 +++ artifactory/repositories_test.go | 3 +++ 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/artifactory/artifactory-accessors.go b/artifactory/artifactory-accessors.go index d3248f0..fcd4f46 100644 --- a/artifactory/artifactory-accessors.go +++ b/artifactory/artifactory-accessors.go @@ -1063,6 +1063,14 @@ func (l *LocalRepository) GetArchiveBrowsingEnabled() bool { return *l.ArchiveBrowsingEnabled } +// GetBlockPushingSchema1 returns the BlockPushingSchema1 field if it's non-nil, zero value otherwise. +func (l *LocalRepository) GetBlockPushingSchema1() bool { + if l == nil || l.BlockPushingSchema1 == nil { + return false + } + return *l.BlockPushingSchema1 +} + // GetCalculateYumMetadata returns the CalculateYumMetadata field if it's non-nil, zero value otherwise. func (l *LocalRepository) GetCalculateYumMetadata() bool { if l == nil || l.CalculateYumMetadata == nil { @@ -1279,6 +1287,14 @@ func (r *RemoteRepository) GetBlockMismatchingMimeTypes() bool { return *r.BlockMismatchingMimeTypes } +// GetBlockPushingSchema1 returns the BlockPushingSchema1 field if it's non-nil, zero value otherwise. +func (r *RemoteRepository) GetBlockPushingSchema1() bool { + if r == nil || r.BlockPushingSchema1 == nil { + return false + } + return *r.BlockPushingSchema1 +} + // GetBowerRegistryURL returns the BowerRegistryURL field if it's non-nil, zero value otherwise. func (r *RemoteRepository) GetBowerRegistryURL() string { if r == nil || r.BowerRegistryURL == nil { @@ -2198,3 +2214,11 @@ func (v *VirtualRepository) GetRepositories() []string { } return *v.Repositories } + +// GetResolveDockerTagsByTimestamp returns the ResolveDockerTagsByTimestamp field if it's non-nil, zero value otherwise. +func (v *VirtualRepository) GetResolveDockerTagsByTimestamp() bool { + if v == nil || v.ResolveDockerTagsByTimestamp == nil { + return false + } + return *v.ResolveDockerTagsByTimestamp +} diff --git a/artifactory/fixtures/repositories/local_repository.json b/artifactory/fixtures/repositories/local_repository.json index 3c811b5..581456c 100644 --- a/artifactory/fixtures/repositories/local_repository.json +++ b/artifactory/fixtures/repositories/local_repository.json @@ -21,6 +21,7 @@ "calculateYumMetadata" : false, "yumRootDepth" : 0, "dockerApiVersion" : "V2", + "blockPushingSchema1" : true, "enableFileListsIndexing" : "false", "optionalIndexCompressionFormats" : ["bz2", "lzma", "xz"], "xrayIndex" : false, diff --git a/artifactory/fixtures/repositories/remote_repository.json b/artifactory/fixtures/repositories/remote_repository.json index e5e5165..0f22a38 100644 --- a/artifactory/fixtures/repositories/remote_repository.json +++ b/artifactory/fixtures/repositories/remote_repository.json @@ -64,5 +64,6 @@ "source" : { "originAbsenceDetection" : true } - } + }, + "blockPushingSchema1" : true } diff --git a/artifactory/fixtures/repositories/virtual_repository.json b/artifactory/fixtures/repositories/virtual_repository.json index 91a8e63..d13e462 100644 --- a/artifactory/fixtures/repositories/virtual_repository.json +++ b/artifactory/fixtures/repositories/virtual_repository.json @@ -15,5 +15,6 @@ "forceMavenAuthentication" : false, "externalDependenciesEnabled": false, "externalDependenciesPatterns": ["**/*microsoft*/**", "**/*github*/**"], - "externalDependenciesRemoteRepo": "" + "externalDependenciesRemoteRepo": "", + "resolveDockerTagsByTimestamp": false } diff --git a/artifactory/repositories.go b/artifactory/repositories.go index 420a1dc..b9d923a 100644 --- a/artifactory/repositories.go +++ b/artifactory/repositories.go @@ -79,6 +79,7 @@ type LocalRepository struct { CalculateYumMetadata *bool `json:"calculateYumMetadata,omitempty"` YumRootDepth *int `json:"yumRootDepth,omitempty"` DockerAPIVersion *string `json:"dockerApiVersion,omitempty"` + BlockPushingSchema1 *bool `json:"blockPushingSchema1,omitempty"` EnableFileListsIndexing *bool `json:"enableFileListsIndexing,omitempty"` OptionalIndexCompressionFormats *[]string `json:"optionalIndexCompressionFormats,omitempty"` XrayIndex *bool `json:"xrayIndex,omitempty"` @@ -136,6 +137,7 @@ type RemoteRepository struct { ListRemoteFolderItems *bool `json:"listRemoteFolderItems,omitempty"` EnableTokenAuthentication *bool `json:"enableTokenAuthentication,omitempty"` ContentSynchronisation *ContentSynchronisation `json:"contentSynchronisation,omitempty"` + BlockPushingSchema1 *bool `json:"blockPushingSchema1,omitempty"` } // ContentSynchronisation represents smart remote repository configuration @@ -172,6 +174,7 @@ type VirtualRepository struct { ExternalDependenciesEnabled *bool `json:"externalDependenciesEnabled,omitempty"` ExternalDependenciesPatterns *[]string `json:"externalDependenciesPatterns,omitempty"` ExternalDependenciesRemoteRepo *string `json:"externalDependenciesRemoteRepo,omitempty"` + ResolveDockerTagsByTimestamp *bool `json:"resolveDockerTagsByTimestamp,omitempty"` } func (v VirtualRepository) String() string { diff --git a/artifactory/repositories_test.go b/artifactory/repositories_test.go index 6f3f55e..199f67c 100644 --- a/artifactory/repositories_test.go +++ b/artifactory/repositories_test.go @@ -120,6 +120,7 @@ func Test_Repositories(t *testing.T) { CalculateYumMetadata: Bool(false), YumRootDepth: Int(0), DockerAPIVersion: String("V2"), + BlockPushingSchema1: Bool(true), EnableFileListsIndexing: Bool(false), OptionalIndexCompressionFormats: &[]string{"bz2", "lzma", "xz"}, XrayIndex: Bool(false), @@ -204,6 +205,7 @@ func Test_Repositories(t *testing.T) { OriginAbsenceDetection *bool `json:"originAbsenceDetection,omitempty"` }{OriginAbsenceDetection: Bool(true)}, }, + BlockPushingSchema1: Bool(true), } data, _ := ioutil.ReadFile("fixtures/repositories/remote_repository.json") @@ -235,6 +237,7 @@ func Test_Repositories(t *testing.T) { ExternalDependenciesEnabled: Bool(false), ExternalDependenciesPatterns: &[]string{"**/*microsoft*/**", "**/*github*/**"}, ExternalDependenciesRemoteRepo: String(""), + ResolveDockerTagsByTimestamp: Bool(false), } data, _ := ioutil.ReadFile("fixtures/repositories/virtual_repository.json")