From d7ddf1e52aab239adcbb8a4233fd6784f286d373 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Fri, 27 Sep 2019 18:40:24 -0700 Subject: [PATCH 1/5] upload to s3 if branch master --- ci/Jenkinsfile_utils.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy index 9f626a6cb83e..9180d5f425c2 100644 --- a/ci/Jenkinsfile_utils.groovy +++ b/ci/Jenkinsfile_utils.groovy @@ -134,6 +134,9 @@ def collect_test_results_unix(original_file_name, new_file_name) { // Thus, we have to pick a name manually and rename the files so that they can be stored separately. sh 'cp ' + original_file_name + ' ' + new_file_name archiveArtifacts artifacts: new_file_name + if (env.BRANCH_NAME == "master") { + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + } } } @@ -143,6 +146,9 @@ def collect_test_results_windows(original_file_name, new_file_name) { if (fileExists(original_file_name)) { bat 'xcopy ' + original_file_name + ' ' + new_file_name + '*' archiveArtifacts artifacts: new_file_name + if (env.BRANCH_NAME == "master") { + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + } } } From f6a4e2de0148e4f53842fd68245dd9ea040fd47d Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Tue, 1 Oct 2019 08:56:04 -0700 Subject: [PATCH 2/5] Trigger notification From 67e45a591dc0f7c17e55a5f5c5ebcb9f3ba845ed Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Tue, 1 Oct 2019 11:21:47 -0700 Subject: [PATCH 3/5] catch exception --- ci/Jenkinsfile_utils.groovy | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy index 9180d5f425c2..ef9de7d029bb 100644 --- a/ci/Jenkinsfile_utils.groovy +++ b/ci/Jenkinsfile_utils.groovy @@ -135,7 +135,11 @@ def collect_test_results_unix(original_file_name, new_file_name) { sh 'cp ' + original_file_name + ' ' + new_file_name archiveArtifacts artifacts: new_file_name if (env.BRANCH_NAME == "master") { - s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + try { + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + } catch (Exception e) { + sh "S3 Upload failed ${e}" + } } } } @@ -147,7 +151,11 @@ def collect_test_results_windows(original_file_name, new_file_name) { bat 'xcopy ' + original_file_name + ' ' + new_file_name + '*' archiveArtifacts artifacts: new_file_name if (env.BRANCH_NAME == "master") { - s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + try { + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + } catch (Exception e) { + sh "S3 Upload failed ${e}" + } } } } From 2117cfa95dbe71940555b98d32978c21749a2628 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Tue, 1 Oct 2019 12:17:51 -0700 Subject: [PATCH 4/5] remove incorrect echo, remove check for master branch, add branchname to directory,rethrow exception --- ci/Jenkinsfile_utils.groovy | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy index ef9de7d029bb..e9caed32f87e 100644 --- a/ci/Jenkinsfile_utils.groovy +++ b/ci/Jenkinsfile_utils.groovy @@ -134,12 +134,11 @@ def collect_test_results_unix(original_file_name, new_file_name) { // Thus, we have to pick a name manually and rename the files so that they can be stored separately. sh 'cp ' + original_file_name + ' ' + new_file_name archiveArtifacts artifacts: new_file_name - if (env.BRANCH_NAME == "master") { - try { - s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) - } catch (Exception e) { - sh "S3 Upload failed ${e}" - } + try { + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:env.BRANCH_NAME+"-"+utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + } catch (Exception e) { + echo "S3 Upload failed ${e}" + throw new Exception("S3 upload failed", e) } } } @@ -150,12 +149,11 @@ def collect_test_results_windows(original_file_name, new_file_name) { if (fileExists(original_file_name)) { bat 'xcopy ' + original_file_name + ' ' + new_file_name + '*' archiveArtifacts artifacts: new_file_name - if (env.BRANCH_NAME == "master") { - try { - s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) - } catch (Exception e) { - sh "S3 Upload failed ${e}" - } + try { + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:env.BRANCH_NAME+"-"+utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + } catch (Exception e) { + echo "S3 Upload failed ${e}" + throw new Exception("S3 upload failed", e) } } } @@ -281,7 +279,7 @@ def main_wrapper(args) { update_github_commit_status('SUCCESS', 'Job succeeded') } catch (caughtError) { node(NODE_UTILITY) { - sh "echo caught ${caughtError}" + echo "caught ${caughtError}" err = caughtError currentBuild.result = "FAILURE" update_github_commit_status('FAILURE', 'Job failed') From b18b8bd4d23a71841cf2b46d4895576721a429d0 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Tue, 1 Oct 2019 14:41:45 -0700 Subject: [PATCH 5/5] update directory structure --- ci/Jenkinsfile_utils.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy index e9caed32f87e..b5aa862c1266 100644 --- a/ci/Jenkinsfile_utils.groovy +++ b/ci/Jenkinsfile_utils.groovy @@ -135,7 +135,7 @@ def collect_test_results_unix(original_file_name, new_file_name) { sh 'cp ' + original_file_name + ' ' + new_file_name archiveArtifacts artifacts: new_file_name try { - s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:env.BRANCH_NAME+"-"+utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:env.JOB_NAME+"/"+env.BRANCH_NAME+"/"+env.BUILD_NUMBER+"/"+new_file_name) } catch (Exception e) { echo "S3 Upload failed ${e}" throw new Exception("S3 upload failed", e) @@ -150,7 +150,7 @@ def collect_test_results_windows(original_file_name, new_file_name) { bat 'xcopy ' + original_file_name + ' ' + new_file_name + '*' archiveArtifacts artifacts: new_file_name try { - s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:env.BRANCH_NAME+"-"+utils.get_git_commit_hash().trim()+"-"+env.BUILD_TAG+"/"+new_file_name) + s3Upload(file:new_file_name, bucket:env.MXNET_CI_UNITTEST_ARTIFACT_BUCKET, path:env.JOB_NAME+"/"+env.BRANCH_NAME+"/"+env.BUILD_NUMBER+"/"+new_file_name) } catch (Exception e) { echo "S3 Upload failed ${e}" throw new Exception("S3 upload failed", e)