Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(artifacts): support metadata for s3 artifacts #13598

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 11 additions & 2 deletions workflow/artifacts/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,21 @@
}
}

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 {

Check failure on line 242 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Unit Tests

s3cli.PutDirectoryWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutDirectoryWithMetadata)

Check failure on line 242 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Windows Unit Tests

s3cli.PutDirectoryWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutDirectoryWithMetadata)

Check failure on line 242 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

s3cli.PutDirectoryWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutDirectoryWithMetadata)

Check failure on line 242 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

s3cli.PutDirectoryWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutDirectoryWithMetadata)

Check failure on line 242 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Codegen

s3cli.PutDirectoryWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutDirectoryWithMetadata)
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 {

Check failure on line 246 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Unit Tests

s3cli.PutFileWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutFileWithMetadata)

Check failure on line 246 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Windows Unit Tests

s3cli.PutFileWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutFileWithMetadata)

Check failure on line 246 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

s3cli.PutFileWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutFileWithMetadata)) (typecheck)

Check failure on line 246 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

s3cli.PutFileWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutFileWithMetadata) (typecheck)

Check failure on line 246 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Codegen

s3cli.PutFileWithMetadata undefined (type "github.com/argoproj/pkg/s3".S3Client has no field or method PutFileWithMetadata)
return !isTransientS3Err(err), fmt.Errorf("failed to put file: %v", err)
}
}
Expand Down
Loading