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

Issue #274 fix verbose param in the s3UploadStep #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 17 additions & 7 deletions src/main/java/de/taimos/pipeline/aws/S3UploadStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public String run() throws Exception {
throw new FileNotFoundException(child.toURI().toString());
}

child.act(new RemoteUploader(Execution.this.step.createS3ClientOptions(), Execution.this.getContext().get(EnvVars.class), listener, bucket, path, metadatas, tags, acl, cacheControl, contentEncoding, contentType, contentDisposition, kmsId, sseAlgorithm, redirectLocation));
child.act(new RemoteUploader(Execution.this.step.createS3ClientOptions(), Execution.this.getContext().get(EnvVars.class), listener, bucket, path, metadatas, tags, acl, cacheControl, contentEncoding, contentType, contentDisposition, kmsId, sseAlgorithm, redirectLocation, verbose));

listener.getLogger().println("Upload complete");
return String.format("s3://%s/%s", bucket, path);
Expand All @@ -467,7 +467,7 @@ public String run() throws Exception {
for (FilePath child : children) {
fileList.add(child.act(FIND_FILE_ON_SLAVE));
}
dir.act(new RemoteListUploader(Execution.this.step.createS3ClientOptions(), Execution.this.getContext().get(EnvVars.class), listener, fileList, bucket, path, metadatas, tags, acl, cacheControl, contentEncoding, contentType, contentDisposition, kmsId, sseAlgorithm));
dir.act(new RemoteListUploader(Execution.this.step.createS3ClientOptions(), Execution.this.getContext().get(EnvVars.class), listener, fileList, bucket, path, metadatas, tags, acl, cacheControl, contentEncoding, contentType, contentDisposition, kmsId, sseAlgorithm, verbose));
listener.getLogger().println("Upload complete");
return String.format("s3://%s/%s", bucket, path);
}
Expand All @@ -493,8 +493,9 @@ private static class RemoteUploader extends MasterToSlaveFileCallable<Void> {
private final String kmsId;
private final String sseAlgorithm;
private final String redirectLocation;
private final boolean verbose;

RemoteUploader(S3ClientOptions amazonS3ClientOptions, EnvVars envVars, TaskListener taskListener, String bucket, String path, Map<String, String> metadatas, Map<String, String> tags, CannedAccessControlList acl, String cacheControl, String contentEncoding, String contentType, String contentDisposition, String kmsId, String sseAlgorithm, String redirectLocation) {
RemoteUploader(S3ClientOptions amazonS3ClientOptions, EnvVars envVars, TaskListener taskListener, String bucket, String path, Map<String, String> metadatas, Map<String, String> tags, CannedAccessControlList acl, String cacheControl, String contentEncoding, String contentType, String contentDisposition, String kmsId, String sseAlgorithm, String redirectLocation, boolean verbose) {
this.amazonS3ClientOptions = amazonS3ClientOptions;
this.envVars = envVars;
this.taskListener = taskListener;
Expand All @@ -510,6 +511,7 @@ private static class RemoteUploader extends MasterToSlaveFileCallable<Void> {
this.kmsId = kmsId;
this.sseAlgorithm = sseAlgorithm;
this.redirectLocation = redirectLocation;
this.verbose = verbose;
}

@Override
Expand Down Expand Up @@ -573,7 +575,9 @@ public Void invoke(File localFile, VirtualChannel channel) throws IOException, I
final Upload upload = mgr.upload(request);
upload.addProgressListener((ProgressListener) progressEvent -> {
if (progressEvent.getEventType() == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
RemoteUploader.this.taskListener.getLogger().println("Finished: " + upload.getDescription());
if (this.verbose) {
RemoteUploader.this.taskListener.getLogger().println("Finished: " + upload.getDescription());
}
}
});
upload.waitForCompletion();
Expand Down Expand Up @@ -634,7 +638,9 @@ public Void invoke(File localFile, VirtualChannel channel) throws IOException, I
for (final Upload upload : fileUpload.getSubTransfers()) {
upload.addProgressListener((ProgressListener) progressEvent -> {
if (progressEvent.getEventType() == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
RemoteUploader.this.taskListener.getLogger().println("Finished: " + upload.getDescription());
if (this.verbose) {
RemoteUploader.this.taskListener.getLogger().println("Finished: " + upload.getDescription());
}
}
});
}
Expand Down Expand Up @@ -668,8 +674,9 @@ private static class RemoteListUploader extends MasterToSlaveFileCallable<Void>
private final String contentDisposition;
private final String kmsId;
private final String sseAlgorithm;
private final boolean verbose;

RemoteListUploader(S3ClientOptions amazonS3ClientOptions, EnvVars envVars, TaskListener taskListener, List<File> fileList, String bucket, String path, Map<String, String> metadatas, Map<String, String> tags, CannedAccessControlList acl, final String cacheControl, final String contentEncoding, final String contentType, final String contentDisposition, String kmsId, String sseAlgorithm) {
RemoteListUploader(S3ClientOptions amazonS3ClientOptions, EnvVars envVars, TaskListener taskListener, List<File> fileList, String bucket, String path, Map<String, String> metadatas, Map<String, String> tags, CannedAccessControlList acl, final String cacheControl, final String contentEncoding, final String contentType, final String contentDisposition, String kmsId, String sseAlgorithm, boolean verbose) {
this.amazonS3ClientOptions = amazonS3ClientOptions;
this.envVars = envVars;
this.taskListener = taskListener;
Expand All @@ -685,6 +692,7 @@ private static class RemoteListUploader extends MasterToSlaveFileCallable<Void>
this.contentDisposition = contentDisposition;
this.kmsId = kmsId;
this.sseAlgorithm = sseAlgorithm;
this.verbose = verbose;
}

@Override
Expand Down Expand Up @@ -745,7 +753,9 @@ public Void invoke(File localFile, VirtualChannel channel) throws IOException, I
for (final Upload upload : fileUpload.getSubTransfers()) {
upload.addProgressListener((ProgressListener) progressEvent -> {
if (progressEvent.getEventType() == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
RemoteListUploader.this.taskListener.getLogger().println("Finished: " + upload.getDescription());
if (this.verbose) {
RemoteListUploader.this.taskListener.getLogger().println("Finished: " + upload.getDescription());
}
}
});
}
Expand Down