Skip to content

Commit

Permalink
Merge pull request #58 from ndeloof/JENKINS-26297
Browse files Browse the repository at this point in the history
use the user bucketname entry that includes prefixes in fingerprint
  • Loading branch information
ndeloof committed May 29, 2015
2 parents c6308fe + eb13b93 commit ab3afa1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/s3/S3Profile.java
Expand Up @@ -190,7 +190,7 @@ public FingerprintRecord upload(AbstractBuild<?,?> build, final BuildListener li

while (true) {
try {
S3UploadCallable callable = new S3UploadCallable(produced, accessKey, secretKey, useRole, dest, userMetadata, storageClass, selregion,useServerSideEncryption);
S3UploadCallable callable = new S3UploadCallable(produced, accessKey, secretKey, useRole, bucketName, dest, userMetadata, storageClass, selregion,useServerSideEncryption);
if (uploadFromSlave) {
return filePath.act(callable);
} else {
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java
Expand Up @@ -26,16 +26,24 @@

public class S3UploadCallable extends AbstractS3Callable implements FileCallable<FingerprintRecord> {
private static final long serialVersionUID = 1L;
private final String bucketName;
private final Destination dest;
private final String storageClass;
private final List<MetadataPair> userMetadata;
private final String selregion;
private final boolean produced;
private final boolean useServerSideEncryption;

@Deprecated
public S3UploadCallable(boolean produced, String accessKey, Secret secretKey, boolean useRole, Destination dest, List<MetadataPair> userMetadata, String storageClass,
String selregion, boolean useServerSideEncryption) {
this(produced, accessKey, secretKey, useRole, dest.bucketName, dest, userMetadata, storageClass, selregion, useServerSideEncryption);
}

public S3UploadCallable(boolean produced, String accessKey, Secret secretKey, boolean useRole, String bucketName, Destination dest, List<MetadataPair> userMetadata, String storageClass,
String selregion, boolean useServerSideEncryption) {
super(accessKey, secretKey, useRole);
this.bucketName = bucketName;
this.dest = dest;
this.storageClass = storageClass;
this.userMetadata = userMetadata;
Expand Down Expand Up @@ -107,7 +115,7 @@ public FingerprintRecord invoke(FilePath file) throws IOException, InterruptedEx
final PutObjectRequest request = new PutObjectRequest(dest.bucketName, dest.objectName, localFile)
.withMetadata(buildMetadata(file));
final PutObjectResult result = getClient().putObject(request);
return new FingerprintRecord(produced, dest.bucketName, file.getName(), result.getETag());
return new FingerprintRecord(produced, bucketName, file.getName(), result.getETag());
} finally {
if (os != null) {
os.close();
Expand Down

0 comments on commit ab3afa1

Please sign in to comment.