diff --git a/pom.xml b/pom.xml index 68519d85..084fe3ec 100644 --- a/pom.xml +++ b/pom.xml @@ -8,33 +8,33 @@ s3 hpi - 0.8-SNAPSHOT + 0.8-ALEX-SNAPSHOT Jenkins S3 publisher plugin https://wiki.jenkins-ci.org/display/JENKINS/S3+Plugin - - dougm - Doug MacEachern + + dougm + Doug MacEachern - - d6y - Richard Dallaway + + d6y + Richard Dallaway - - longlho - Long Ho + + longlho + Long Ho - - mikewatt - Michael Watt + + mikewatt + Michael Watt - - dmbeer + + dmbeer David Beer - - mattias + + mattias Mattias Appelgren diff --git a/src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java b/src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java index 624ac65f..a6170491 100644 --- a/src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java +++ b/src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java @@ -20,7 +20,10 @@ import com.amazonaws.regions.RegionUtils; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.internal.Mimetypes; +import com.amazonaws.services.s3.model.AccessControlList; +import com.amazonaws.services.s3.model.GroupGrantee; import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.Permission; import com.amazonaws.services.s3.model.PutObjectRequest; import com.amazonaws.services.s3.model.PutObjectResult; @@ -45,6 +48,7 @@ public S3UploadCallable(boolean produced, String accessKey, Secret secretKey, bo } public ObjectMetadata buildMetadata(FilePath filePath) throws IOException, InterruptedException { + ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentType(Mimetypes.getInstance().getMimetype(filePath.getName())); metadata.setContentLength(filePath.length()); @@ -103,8 +107,9 @@ public FingerprintRecord invoke(FilePath file) throws IOException, InterruptedEx } else { localFile = new File(file.getRemote()); } - - final PutObjectRequest request = new PutObjectRequest(dest.bucketName, dest.objectName, localFile) + AccessControlList acl = new AccessControlList(); + acl.grantPermission(GroupGrantee.AuthenticatedUsers, Permission.FullControl); + final PutObjectRequest request = new PutObjectRequest(dest.bucketName, dest.objectName, localFile).withAccessControlList(acl) .withMetadata(buildMetadata(file)); final PutObjectResult result = getClient().putObject(request); return new FingerprintRecord(produced, dest.bucketName, file.getName(), result.getETag());