Skip to content

Commit

Permalink
Add more logs to help debug
Browse files Browse the repository at this point in the history
This fixes #59
  • Loading branch information
ArchangelSDY committed Jun 2, 2017
1 parent f83749d commit 09f60a9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Expand Up @@ -196,6 +196,7 @@ private static String getEndpointSuffix(String blobURL) {
*/
protected static String upload(TaskListener listener, CloudBlockBlob blob, FilePath src)
throws StorageException, IOException, InterruptedException {
listener.getLogger().println("Uploading file: " + src.getName());
MessageDigest md = DigestUtils.getMd5Digest();
long startTime = System.currentTimeMillis();
try (InputStream inputStream = src.read(); DigestInputStream digestInputStream = new DigestInputStream(inputStream, md)) {
Expand Down Expand Up @@ -232,6 +233,11 @@ public static int upload(Run<?, ?> run, Launcher launcher, TaskListener listener
String expVP, String excludeFP, UploadType uploadType,
List<AzureBlob> individualBlobs, List<AzureBlob> archiveBlobs, FilePath workspace) throws WAStorageException {

listener.getLogger().println(Messages.WAStoragePublisher_container_name(expContainerName));
listener.getLogger().println(Messages.WAStoragePublisher_filepath(expFP));
listener.getLogger().println(Messages.WAStoragePublisher_virtualpath(expVP));
listener.getLogger().println(Messages.WAStoragePublisher_excludepath(excludeFP));

int filesUploaded = 0; // Counter to track no. of files that are uploaded

try {
Expand Down
Expand Up @@ -411,6 +411,8 @@ public synchronized void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @
expContainerName, blobProperties, metadata, cntPubAccess, cleanUpContainer, expFP,
expVP, excludeFP, getArtifactUploadType(), individualBlobs, archiveBlobs, ws);

listener.getLogger().println(Messages.WAStoragePublisher_files_uploaded_count(filesUploaded));

// Mark build unstable if no files are uploaded and the user
// doesn't want the build not to fail in that case.
if (filesUploaded == 0) {
Expand All @@ -424,7 +426,6 @@ public synchronized void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @
if (getArtifactUploadType() != UploadType.INDIVIDUAL) {
zipArchiveBlob = archiveBlobs.get(0);
}
listener.getLogger().println(Messages.WAStoragePublisher_files_uploaded_count(filesUploaded));

run.getActions().add(new AzureBlobAction(run, strAcc.getStorageAccName(),
expContainerName, individualBlobs, zipArchiveBlob, allowAnonymousAccess, storageCredentialId));
Expand Down
Expand Up @@ -4,10 +4,14 @@ WAStoragePublisher_build_failed_err=MicrosoftAzureStorage - Build failed, hence
WAStoragePublisher_storage_account_err=MicrosoftAzureStorage - Storage account information not found
WAStoragePublisher_container_name_err=MicrosoftAzureStorage - Container name is missing or not valid
WAStoragePublisher_filepath_err=MicrosoftAzureStorage - List of files to upload must not be empty
WAStoragePublisher_container_name=MicrosoftAzureStorage - Container name: {0}
WAStoragePublisher_filepath=MicrosoftAzureStorage - File path: {0}
WAStoragePublisher_virtualpath=MicrosoftAzureStorage - Virtual path: {0}
WAStoragePublisher_excludepath=MicrosoftAzureStorage - Exclude path: {0}
WAStoragePublisher_uploading=MicrosoftAzureStorage - Uploading files to Microsoft Azure
WAStoragePublisher_nofiles_uploaded=MicrosoftAzureStorage - Failed to upload any build artifacts to Azure Storage \
WAStoragePublisher_nofiles_uploaded=MicrosoftAzureStorage - Failed to find any build artifacts to upload to Azure Storage \
\nVerify the list of files to upload and that the Ant glob syntax is correct
WAStoragePublisher_files_uploaded_count=MicrosoftAzureStorage - Uploaded/archived file count = {0}
WAStoragePublisher_files_uploaded_count=MicrosoftAzureStorage - Uploaded/archived file count = {0}
WAStoragePublisher_uploaded_err=MicrosoftAzureStorage - Error occurred while uploading to Azure - {0}
WAStoragePublisher_storage_name_req=Required: Enter Azure storage account name
WAStoragePublisher_storage_key_req=Required: Enter Azure storage account key
Expand All @@ -16,7 +20,7 @@ WAStoragePublisher_artifacts_req=Required: Enter names of artifacts to upload
WAStoragePublisher_container_name_invalid=Container name must be between 3 and 63 characters, start with a letter or number, \
contain only letters, numbers and dashes (-). \
(Note that consecutive dashes are not allowed and dash cannot be the last character)
WAStoragePublisher_SA_val=Validation successful
WAStoragePublisher_SA_val=Validation successful
WAStoragePublisher_uploadtype_invalid=No artifacts will be uploaded. Either check "Upload zipped archive" or uncheck "Do not upload individual files"
# Properties in WAStorageClient_java
Client_SA_val_fail=Failed to validate storage account details. Please verify storage account name and key. \
Expand All @@ -26,7 +30,7 @@ AzureStorageBuilder_displayName=Download from Azure Blob storage
AzureStorageBuilder_downloading=MicrosoftAzureStorage - Downloading files from Azure Blob storage
AzureStorageBuilder_ws_na=MicrosoftAzureStorage - Unable to get workspace location , if workspace is on slave make sure that slave is connected.
AzureStorageBuilder_nofiles_downloaded=MicrosoftAzureStorage - Failed to download files from Azure storage.\
\n Verify that files exists with specified blob name
\n Verify that files exists with specified blob name
AzureStorageBuilder_files_downloaded_count=MicrosoftAzureStorage - Downloaded file count = {0}
AzureStorageBuilder_download_err=MicrosoftAzureStorage - Error occurred while downloading from Azure - {0}
AzureStorageBuilder_blobName_req=Required: Enter Azure blob name
Expand Down

0 comments on commit 09f60a9

Please sign in to comment.