Skip to content

Commit

Permalink
Switch build notification to metrics based data (#5076)
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya authored Oct 8, 2024
1 parent 655cec2 commit 544b116
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 130 deletions.
2 changes: 1 addition & 1 deletion docs/Releasing-the-Distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 4 additions & 56 deletions jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]))
Expand Down Expand Up @@ -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.',
Expand Down Expand Up @@ -231,7 +226,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
Expand Down Expand Up @@ -345,7 +339,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
postCleanup()
}
}
Expand Down Expand Up @@ -456,7 +449,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
postCleanup()
}
}
Expand Down Expand Up @@ -506,7 +498,6 @@ pipeline {
post {
always {
script {
addMessageToNotificationQueue()
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
Expand Down Expand Up @@ -577,7 +568,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
postCleanup()
}
}
Expand Down Expand Up @@ -627,7 +617,6 @@ pipeline {
post {
always {
script {
addMessageToNotificationQueue()
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
Expand Down Expand Up @@ -691,7 +680,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
postCleanup()
}
}
Expand Down Expand Up @@ -802,7 +790,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
postCleanup()
}
}
Expand Down Expand Up @@ -875,7 +862,6 @@ pipeline {
}
always {
script {
addMessageToNotificationQueue()
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
Expand Down Expand Up @@ -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()
Expand All @@ -955,39 +940,6 @@ pipeline {
success {
node(AGENT_LINUX_X64) {
script {
List<String> 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()
}
}
Expand Down Expand Up @@ -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"
Expand Down
77 changes: 4 additions & 73 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]))
Expand Down Expand Up @@ -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.',
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -363,10 +354,6 @@ pipeline {
}
always {
script {
lib.jenkins.Messages.new(this).add(
"${STAGE_NAME}",
lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"])
)
postCleanup()
}
}
Expand Down Expand Up @@ -476,11 +463,6 @@ pipeline {
}
always {
script {
lib.jenkins.Messages.new(this).add(
"${STAGE_NAME}",
lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"])
)

postCleanup()
}
}
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -665,10 +643,6 @@ pipeline {
}
always {
script {
lib.jenkins.Messages.new(this).add(
"${STAGE_NAME}",
lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"])
)
postCleanup()
}
}
Expand Down Expand Up @@ -779,10 +753,6 @@ pipeline {
}
always {
script {
lib.jenkins.Messages.new(this).add(
"${STAGE_NAME}",
lib.jenkins.Messages.new(this).get(["${STAGE_NAME}"])
)
postCleanup()
}
}
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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()
Expand All @@ -935,32 +900,6 @@ pipeline {
success {
node(AGENT_LINUX_X64) {
script {
List<String> 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()
}
}
Expand All @@ -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()
}
}
Expand Down

0 comments on commit 544b116

Please sign in to comment.