Skip to content
Open
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
34 changes: 17 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@

<artifactId>s3</artifactId>
<packaging>hpi</packaging>
<version>0.8-SNAPSHOT</version>
<version>0.8-ALEX-SNAPSHOT</version>
<name>Jenkins S3 publisher plugin</name>
<url>https://wiki.jenkins-ci.org/display/JENKINS/S3+Plugin</url>

<developers>
<developer>
<id>dougm</id>
<name>Doug MacEachern</name>
<developer>
<id>dougm</id>
<name>Doug MacEachern</name>
</developer>
<developer>
<id>d6y</id>
<name>Richard Dallaway</name>
<developer>
<id>d6y</id>
<name>Richard Dallaway</name>
</developer>
<developer>
<id>longlho</id>
<name>Long Ho</name>
<developer>
<id>longlho</id>
<name>Long Ho</name>
</developer>
<developer>
<id>mikewatt</id>
<name>Michael Watt</name>
<developer>
<id>mikewatt</id>
<name>Michael Watt</name>
</developer>
<developer>
<id>dmbeer</id>
<developer>
<id>dmbeer</id>
<name>David Beer</name>
</developer>
<developer>
<id>mattias</id>
<developer>
<id>mattias</id>
<name>Mattias Appelgren</name>
</developer>
</developers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down