From 544b11673f1030b09792069fe0c10320abc31092 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad <61760125+gaiksaya@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:48:07 -0700 Subject: [PATCH] Switch build notification to metrics based data (#5076) Signed-off-by: Sayali Gaikawad --- docs/Releasing-the-Distribution.md | 2 +- .../distribution-build.jenkinsfile | 60 +-------------- .../opensearch/distribution-build.jenkinsfile | 77 +------------------ 3 files changed, 9 insertions(+), 130 deletions(-) diff --git a/docs/Releasing-the-Distribution.md b/docs/Releasing-the-Distribution.md index 0860485f71..50dbbdfbb3 100644 --- a/docs/Releasing-the-Distribution.md +++ b/docs/Releasing-the-Distribution.md @@ -53,7 +53,7 @@ The final output of the assemble workflow and manifest that is added to the fina #### AUTOCUT issues -These are the issues created by automation with the distribution build and integ-test workflows failure, the automation detects the component failure and raises an issue in the respective component repo. Sample [integ-test failure AUTOCUT issue](https://github.com/opensearch-project/k-NN/issues/914) and [distribution build failure AUTOCUT issue](https://github.com/opensearch-project/k-NN/issues/732). The created `AUTOCUT` issues will have the updated information with latest build failure details, the automation also detects if the component build has passed and closes the issues automatically. For more details refer the [closeBuildSuccessGithubIssue.groovy](https://github.com/opensearch-project/opensearch-build-libraries/blob/main/vars/closeBuildSuccessGithubIssue.groovy) and [createGithubIssue.groovy](https://github.com/opensearch-project/opensearch-build-libraries/blob/main/vars/createGithubIssue.groovy) libraries part of the distribution build and integ-test workflows. +These are the issues created by automation with the distribution build and integ-test workflows failure, the automation detects the component failure and raises an issue in the respective component repo. Sample [integ-test failure AUTOCUT issue](https://github.com/opensearch-project/k-NN/issues/914) and [distribution build failure AUTOCUT issue](https://github.com/opensearch-project/k-NN/issues/732). The created `AUTOCUT` issues will have the updated information with latest build failure details, the automation also detects if the component build has passed and closes the issues automatically. For more details refer the [updateBuildFailureIssues.groovy](https://github.com/opensearch-project/opensearch-build-libraries/blob/main/vars/updateBuildFailureIssues.groovy). #### Build Workflows diff --git a/jenkins/opensearch-dashboards/distribution-build.jenkinsfile b/jenkins/opensearch-dashboards/distribution-build.jenkinsfile index a0dd4c3827..d968c92383 100644 --- a/jenkins/opensearch-dashboards/distribution-build.jenkinsfile +++ b/jenkins/opensearch-dashboards/distribution-build.jenkinsfile @@ -7,7 +7,7 @@ * compatible open source license. */ -lib = library(identifier: 'jenkins@6.9.1', retriever: modernSCM([ +lib = library(identifier: 'jenkins@7.0.0', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -91,11 +91,6 @@ pipeline { description: 'Update latest url so /latest/ is pointed to this build', defaultValue: true ) - booleanParam( - name: 'PUBLISH_NOTIFICATION', - description: 'Publish the status of this build job or not.', - defaultValue: true - ) booleanParam( name: 'UPDATE_GITHUB_ISSUE', description: 'To create/close/update a github issue for all component or not.', @@ -231,7 +226,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -345,7 +339,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() postCleanup() } } @@ -456,7 +449,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() postCleanup() } } @@ -506,7 +498,6 @@ pipeline { post { always { script { - addMessageToNotificationQueue() if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -577,7 +568,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() postCleanup() } } @@ -627,7 +617,6 @@ pipeline { post { always { script { - addMessageToNotificationQueue() if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -691,7 +680,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() postCleanup() } } @@ -802,7 +790,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() postCleanup() } } @@ -875,7 +862,6 @@ pipeline { } always { script { - addMessageToNotificationQueue() if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -942,10 +928,9 @@ pipeline { componentCategory: "OpenSearch Dashboards" ) if (params.UPDATE_GITHUB_ISSUE) { - UpdateBuildFailureIssues( - failureMessages: buildMessage(search: 'Error building'), - passMessages: buildMessage(search: 'Successfully built'), - inputManifestPath: "manifests/$INPUT_MANIFEST" + updateBuildFailureIssues( + inputManifestPath: "manifests/$INPUT_MANIFEST", + distributionBuildNumber: "${BUILD_NUMBER}" ) } postCleanup() @@ -955,39 +940,6 @@ pipeline { success { node(AGENT_LINUX_X64) { script { - List stages = [] - if (params.BUILD_PLATFORM.contains('linux')) { - if (params.BUILD_DISTRIBUTION.contains('tar')) { - stages = [ - 'build-and-test-linux-x64-tar', - 'assemble-archive-and-test-linux-arm64-tar', - ] - } - if (params.BUILD_DISTRIBUTION.contains('rpm')) { - stages.add('assemble-archive-and-test-linux-x64-rpm') - stages.add('assemble-archive-and-test-linux-arm64-rpm') - } - if (params.BUILD_DISTRIBUTION.contains('deb')) { - stages.add('assemble-archive-and-test-linux-x64-deb') - stages.add('assemble-archive-and-test-linux-arm64-deb') - } - } - if (params.BUILD_PLATFORM.contains('windows')) { - if (params.BUILD_DISTRIBUTION.contains('zip')) { - stages.add('build-and-test-windows-x64-zip') - } - } - if (params.PUBLISH_NOTIFICATION) { - def stashed = lib.jenkins.Messages.new(this).get(stages) - - publishNotification( - icon: ':white_check_mark:', - message: 'Successful Build', - extra: stashed, - credentialsId: 'jenkins-build-notice-webhook', - manifest: "${INPUT_MANIFEST}" - ) - } postCleanup() } } @@ -1052,10 +1004,6 @@ def triggerBWCTests(String buildManifestUrl, String platform, String distributio } } -def addMessageToNotificationQueue() { - lib.jenkins.Messages.new(this).add("${STAGE_NAME}", lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"])) -} - def verifyParameterPlatformDistribution(String paramName, String allowedValue) { echo("Verify Parameter '$paramName'") def paramValue = env."$paramName" diff --git a/jenkins/opensearch/distribution-build.jenkinsfile b/jenkins/opensearch/distribution-build.jenkinsfile index ed1e7a032d..20b5a9096b 100644 --- a/jenkins/opensearch/distribution-build.jenkinsfile +++ b/jenkins/opensearch/distribution-build.jenkinsfile @@ -7,7 +7,7 @@ * compatible open source license. */ -lib = library(identifier: 'jenkins@6.9.1', retriever: modernSCM([ +lib = library(identifier: 'jenkins@7.0.0', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -90,11 +90,6 @@ pipeline { description: 'Update latest url so /latest/ is pointed to this build', defaultValue: true ) - booleanParam( - name: 'PUBLISH_NOTIFICATION', - description: 'Publish the status of this build job or not.', - defaultValue: true - ) booleanParam( name: 'UPDATE_GITHUB_ISSUE', description: 'To create/close/update a github issue for all component or not.', @@ -249,10 +244,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -363,10 +354,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) postCleanup() } } @@ -476,11 +463,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) - postCleanup() } } @@ -551,10 +533,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -665,10 +643,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) postCleanup() } } @@ -779,10 +753,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) postCleanup() } } @@ -854,10 +824,6 @@ pipeline { } always { script { - lib.jenkins.Messages.new(this).add( - "${STAGE_NAME}", - lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"]) - ) if (params.CONTINUE_ON_ERROR) { markStageUnstableIfPluginsFailedToBuild() } @@ -921,10 +887,9 @@ pipeline { componentCategory: "OpenSearch" ) if (params.UPDATE_GITHUB_ISSUE) { - UpdateBuildFailureIssues( - failureMessages: buildMessage(search: 'Error building'), - passMessages: buildMessage(search: 'Successfully built'), - inputManifestPath: "manifests/$INPUT_MANIFEST" + updateBuildFailureIssues( + inputManifestPath: "manifests/$INPUT_MANIFEST", + distributionBuildNumber: "${BUILD_NUMBER}" ) } postCleanup() @@ -935,32 +900,6 @@ pipeline { success { node(AGENT_LINUX_X64) { script { - List stages = [] - if (params.BUILD_PLATFORM.contains('linux')) { - stages = [ - 'build-and-test-linux-x64-tar', - 'assemble-archive-and-test-linux-x64-rpm', - 'assemble-archive-and-test-linux-x64-deb', - 'build-and-test-linux-arm64-tar', - 'assemble-archive-and-test-linux-arm64-rpm', - 'assemble-archive-and-test-linux-arm64-deb', - ] - } - if (params.BUILD_PLATFORM.contains('windows')) { - stages.add('build-and-test-windows-x64-zip') - } - - if (params.PUBLISH_NOTIFICATION) { - def stashed = lib.jenkins.Messages.new(this).get(stages) - - publishNotification( - icon: ':white_check_mark:', - message: 'Successful Build', - extra: stashed, - credentialsId: 'jenkins-build-notice-webhook', - manifest: "${INPUT_MANIFEST}" - ) - } postCleanup() } } @@ -969,14 +908,6 @@ pipeline { node(AGENT_LINUX_X64) { checkout scm script { - if (params.PUBLISH_NOTIFICATION) { - publishNotification( - icon: ':warning:', - message: buildMessage(search: 'Error building'), - credentialsId: 'jenkins-build-notice-webhook', - manifest: "${INPUT_MANIFEST}" - ) - } postCleanup() } }