diff --git a/pkg/apis/workflow/v1alpha1/workflow_types.go b/pkg/apis/workflow/v1alpha1/workflow_types.go index 878f82dfa0c2..6d9727d06a19 100644 --- a/pkg/apis/workflow/v1alpha1/workflow_types.go +++ b/pkg/apis/workflow/v1alpha1/workflow_types.go @@ -2561,8 +2561,16 @@ type CreateS3BucketOptions struct { type S3Artifact struct { S3Bucket `json:",inline" protobuf:"bytes,1,opt,name=s3Bucket"` + // Metadata is the s3 object's metadata in the S3 artifact repository + // default={} + Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"` + + // Tags is the s3 object's tags in the S3 artifact repository + // default={} + Tags map[string]string `json:"tags,omitempty" protobuf:"bytes,3,opt,name=tags"` + // Key is the key in the bucket where the artifact resides - Key string `json:"key,omitempty" protobuf:"bytes,2,opt,name=key"` + Key string `json:"key,omitempty" protobuf:"bytes,4,opt,name=key"` } func (s *S3Artifact) GetKey() (string, error) { diff --git a/workflow/artifacts/s3/s3.go b/workflow/artifacts/s3/s3.go index 3255bd0eb874..fa65991c981d 100644 --- a/workflow/artifacts/s3/s3.go +++ b/workflow/artifacts/s3/s3.go @@ -229,12 +229,21 @@ func saveS3Artifact(s3cli argos3.S3Client, path string, outputArtifact *wfv1.Art } } + s3metadata := make(map[string]string) + if outputArtifact.S3.Metadata != nil { + s3metadata = outputArtifact.S3.Metadata + } + s3tags := make(map[string]string) + if outputArtifact.S3.Metadata != nil { + s3tags = outputArtifact.S3.Tags + } + if isDir { - if err = s3cli.PutDirectory(outputArtifact.S3.Bucket, outputArtifact.S3.Key, path); err != nil { + if err = s3cli.PutDirectoryWithMetadata(outputArtifact.S3.Bucket, outputArtifact.S3.Key, path, s3metadata, s3tags); err != nil { return !isTransientS3Err(err), fmt.Errorf("failed to put directory: %v", err) } } else { - if err = s3cli.PutFile(outputArtifact.S3.Bucket, outputArtifact.S3.Key, path); err != nil { + if err = s3cli.PutFileWithMetadata(outputArtifact.S3.Bucket, outputArtifact.S3.Key, path, s3metadata, s3tags); err != nil { return !isTransientS3Err(err), fmt.Errorf("failed to put file: %v", err) } }