Skip to content

Commit 7b4d8bb

Browse files
authored
Merge pull request #276 from sandraantunes-cicd/FixS3UploadTags
Issue 275: Fix upload tags if file directory
2 parents 8de9415 + 6840d00 commit 7b4d8bb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ ebWaitOnEnvironmentHealth(
11001100
## current master
11011101
* Fix global configuration naming for JCasC. Please note that this is a breaking change if JCasC is defined. This can be fixed by renaming pluginImpl --> pipelineStepsAWS.
11021102
* Fix Elastic Beanstalk client creation bug that ignored provided configurations in the withAWSStep
1103+
* Fix upload tags if file is a directory
11031104
* Add CNAME parameters to Elastic Beanstalk `ebSwapEnvironmentCNAMEs` command that lookup the required id and name params
11041105

11051106
## 1.43

src/main/java/de/taimos/pipeline/aws/S3UploadStep.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,21 @@ public Void invoke(File localFile, VirtualChannel channel) throws IOException, I
620620
}
621621
};
622622

623+
ObjectTaggingProvider objectTaggingProvider =(uploadContext) -> {
624+
List<Tag> tagList = new ArrayList<Tag>();
625+
626+
//add tags
627+
if(tags != null){
628+
for (Map.Entry<String, String> entry : tags.entrySet()) {
629+
Tag tag = new Tag(entry.getKey(), entry.getValue());
630+
tagList.add(tag);
631+
}
632+
}
633+
return new ObjectTagging(tagList);
634+
};
635+
623636
try {
624-
fileUpload = mgr.uploadDirectory(this.bucket, this.path, localFile, true, metadatasProvider);
637+
fileUpload = mgr.uploadDirectory(this.bucket, this.path, localFile, true, metadatasProvider, objectTaggingProvider);
625638
for (final Upload upload : fileUpload.getSubTransfers()) {
626639
upload.addProgressListener((ProgressListener) progressEvent -> {
627640
if (progressEvent.getEventType() == ProgressEventType.TRANSFER_COMPLETED_EVENT) {

0 commit comments

Comments
 (0)