Skip to content

Commit

Permalink
feat: Support keyFormat for Artifactory
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Tang <[email protected]>
  • Loading branch information
terrytangyuan committed Sep 12, 2023
1 parent ee939bb commit d65cf98
Show file tree
Hide file tree
Showing 25 changed files with 717 additions and 642 deletions.
10 changes: 7 additions & 3 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3910,6 +3910,10 @@
"io.argoproj.workflow.v1alpha1.ArtifactoryArtifactRepository": {
"description": "ArtifactoryArtifactRepository defines the controller configuration for an artifactory artifact repository",
"properties": {
"keyFormat": {
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"passwordSecret": {
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector",
"description": "PasswordSecret is the secret selector to the repository password"
Expand Down Expand Up @@ -4766,7 +4770,7 @@
"type": "string"
},
"keyFormat": {
"description": "KeyFormat is defines the format of how to store keys. Can reference workflow variables",
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"serviceAccountKeySecret": {
Expand Down Expand Up @@ -5702,7 +5706,7 @@
"type": "string"
},
"keyFormat": {
"description": "KeyFormat is defines the format of how to store keys. Can reference workflow variables",
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"lifecycleRule": {
Expand Down Expand Up @@ -6092,7 +6096,7 @@
"type": "boolean"
},
"keyFormat": {
"description": "KeyFormat is defines the format of how to store keys. Can reference workflow variables",
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"keyPrefix": {
Expand Down
10 changes: 7 additions & 3 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7859,6 +7859,10 @@
"description": "ArtifactoryArtifactRepository defines the controller configuration for an artifactory artifact repository",
"type": "object",
"properties": {
"keyFormat": {
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"passwordSecret": {
"description": "PasswordSecret is the secret selector to the repository password",
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector"
Expand Down Expand Up @@ -8697,7 +8701,7 @@
"type": "string"
},
"keyFormat": {
"description": "KeyFormat is defines the format of how to store keys. Can reference workflow variables",
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"serviceAccountKeySecret": {
Expand Down Expand Up @@ -9633,7 +9637,7 @@
"type": "string"
},
"keyFormat": {
"description": "KeyFormat is defines the format of how to store keys. Can reference workflow variables",
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"lifecycleRule": {
Expand Down Expand Up @@ -10023,7 +10027,7 @@
"type": "boolean"
},
"keyFormat": {
"description": "KeyFormat is defines the format of how to store keys. Can reference workflow variables",
"description": "KeyFormat defines the format of how to store keys and can reference workflow variables.",
"type": "string"
},
"keyPrefix": {
Expand Down
7 changes: 4 additions & 3 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -4084,6 +4084,7 @@ ArtifactoryArtifactRepository defines the controller configuration for an artifa
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`keyFormat`|`string`|KeyFormat defines the format of how to store keys and can reference workflow variables.|
|`passwordSecret`|[`SecretKeySelector`](#secretkeyselector)|PasswordSecret is the secret selector to the repository password|
|`repoURL`|`string`|RepoURL is the url for artifactory repo.|
|`usernameSecret`|[`SecretKeySelector`](#secretkeyselector)|UsernameSecret is the secret selector to the repository username|
Expand Down Expand Up @@ -4127,7 +4128,7 @@ GCSArtifactRepository defines the controller configuration for a GCS artifact re
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`bucket`|`string`|Bucket is the name of the bucket|
|`keyFormat`|`string`|KeyFormat is defines the format of how to store keys. Can reference workflow variables|
|`keyFormat`|`string`|KeyFormat defines the format of how to store keys and can reference workflow variables.|
|`serviceAccountKeySecret`|[`SecretKeySelector`](#secretkeyselector)|ServiceAccountKeySecret is the secret selector to the bucket's service account key|

## HDFSArtifactRepository
Expand Down Expand Up @@ -4173,7 +4174,7 @@ OSSArtifactRepository defines the controller configuration for an OSS artifact r
|`bucket`|`string`|Bucket is the name of the bucket|
|`createBucketIfNotPresent`|`boolean`|CreateBucketIfNotPresent tells the driver to attempt to create the OSS bucket for output artifacts, if it doesn't exist|
|`endpoint`|`string`|Endpoint is the hostname of the bucket endpoint|
|`keyFormat`|`string`|KeyFormat is defines the format of how to store keys. Can reference workflow variables|
|`keyFormat`|`string`|KeyFormat defines the format of how to store keys and can reference workflow variables.|
|`lifecycleRule`|[`OSSLifecycleRule`](#osslifecyclerule)|LifecycleRule specifies how to manage bucket's lifecycle|
|`secretKeySecret`|[`SecretKeySelector`](#secretkeyselector)|SecretKeySecret is the secret selector to the bucket's secret key|
|`securityToken`|`string`|SecurityToken is the user's temporary security token. For more details, check out: https://www.alibabacloud.com/help/doc-detail/100624.htm|
Expand All @@ -4191,7 +4192,7 @@ S3ArtifactRepository defines the controller configuration for an S3 artifact rep
|`encryptionOptions`|[`S3EncryptionOptions`](#s3encryptionoptions)|_No description available_|
|`endpoint`|`string`|Endpoint is the hostname of the bucket endpoint|
|`insecure`|`boolean`|Insecure will connect to the service with TLS|
|`keyFormat`|`string`|KeyFormat is defines the format of how to store keys. Can reference workflow variables|
|`keyFormat`|`string`|KeyFormat defines the format of how to store keys and can reference workflow variables.|
|~`keyPrefix`~|~`string`~|~KeyPrefix is prefix used as part of the bucket key in which the controller will store artifacts.~ DEPRECATED. Use KeyFormat instead|
|`region`|`string`|Region contains the optional bucket region|
|`roleARN`|`string`|RoleARN is the Amazon Resource Name (ARN) of the role to assume.|
Expand Down
2 changes: 2 additions & 0 deletions manifests/base/crds/full/argoproj.io_workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18949,6 +18949,8 @@ spec:
type: boolean
artifactory:
properties:
keyFormat:
type: string
passwordSecret:
properties:
key:
Expand Down
19 changes: 12 additions & 7 deletions pkg/apis/workflow/v1alpha1/artifact_repository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (a *ArtifactRepository) ToArtifactLocation() *ArtifactLocation {
type S3ArtifactRepository struct {
S3Bucket `json:",inline" protobuf:"bytes,1,opt,name=s3Bucket"`

// KeyFormat is defines the format of how to store keys. Can reference workflow variables
// KeyFormat defines the format of how to store keys and can reference workflow variables.
KeyFormat string `json:"keyFormat,omitempty" protobuf:"bytes,2,opt,name=keyFormat"`

// KeyPrefix is prefix used as part of the bucket key in which the controller will store artifacts.
Expand All @@ -93,7 +93,7 @@ func (r *S3ArtifactRepository) IntoArtifactLocation(l *ArtifactLocation) {
type OSSArtifactRepository struct {
OSSBucket `json:",inline" protobuf:"bytes,1,opt,name=oSSBucket"`

// KeyFormat is defines the format of how to store keys. Can reference workflow variables
// KeyFormat defines the format of how to store keys and can reference workflow variables.
KeyFormat string `json:"keyFormat,omitempty" protobuf:"bytes,2,opt,name=keyFormat"`
}

Expand All @@ -109,7 +109,7 @@ func (r *OSSArtifactRepository) IntoArtifactLocation(l *ArtifactLocation) {
type GCSArtifactRepository struct {
GCSBucket `json:",inline" protobuf:"bytes,1,opt,name=gCSBucket"`

// KeyFormat is defines the format of how to store keys. Can reference workflow variables
// KeyFormat defines the format of how to store keys and can reference workflow variables.
KeyFormat string `json:"keyFormat,omitempty" protobuf:"bytes,2,opt,name=keyFormat"`
}

Expand All @@ -126,15 +126,20 @@ type ArtifactoryArtifactRepository struct {
ArtifactoryAuth `json:",inline" protobuf:"bytes,1,opt,name=artifactoryAuth"`
// RepoURL is the url for artifactory repo.
RepoURL string `json:"repoURL,omitempty" protobuf:"bytes,2,opt,name=repoURL"`
// KeyFormat defines the format of how to store keys and can reference workflow variables.
KeyFormat string `json:"keyFormat,omitempty" protobuf:"bytes,3,opt,name=keyFormat"`
}

func (r *ArtifactoryArtifactRepository) IntoArtifactLocation(l *ArtifactLocation) {
u := ""
url := ""
if r.RepoURL != "" {
u = r.RepoURL + "/"
url = r.RepoURL + "/"
}
u = fmt.Sprintf("%s%s", u, DefaultArchivePattern)
l.Artifactory = &ArtifactoryArtifact{ArtifactoryAuth: r.ArtifactoryAuth, URL: u}
k := r.KeyFormat
if k == "" {
k = DefaultArchivePattern
}
l.Artifactory = &ArtifactoryArtifact{ArtifactoryAuth: r.ArtifactoryAuth, URL: fmt.Sprintf("%s%s", url, k)}
}

// AzureArtifactRepository defines the controller configuration for an Azure Blob Storage artifact repository
Expand Down
Loading

0 comments on commit d65cf98

Please sign in to comment.