Skip to content

Commit

Permalink
Refactor integ-test notification
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Oct 9, 2024
1 parent 544b116 commit aa5f956
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 424 deletions.
54 changes: 54 additions & 0 deletions jenkins/integ-test-notification.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))


pipeline {
agent { label 'Jenkins-Agent-Ubuntu2004-X64-M58xlarge-Single-Host' }
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(daysToKeepStr: '90'))
}
triggers {
parameterizedCron('''
H */6 * * * %INPUT_MANIFEST=2.17.2/opensearch-2.17.2.yml
H */6 * * * %INPUT_MANIFEST=2.18.0/opensearch-2.18.0.yml
H */6 * * * %INPUT_MANIFEST=3.0.0/opensearch-3.0.0.yml
''')
}
parameters {
string(
name: 'INPUT_MANIFEST',
description: 'Input manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0.yml.',
trim: true
)
}
stages {
stage('Update integ tests failure issues') {
steps {
script {
updateIntegTestFailureIssues(
inputManifestPath: "manifests/${INPUT_MANIFEST}"
)
}
}
}
}
post() {
always {
script {
postCleanup()
}
}
}
}
57 changes: 1 addition & 56 deletions jenkins/opensearch-dashboards/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ pipeline {
description: 'The build manifest URL OpenSearch, e.g. "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.9.0/8172/linux/x64/tar/builds/opensearch/manifest.yml".',
trim: true
)
booleanParam(
name: 'UPDATE_GITHUB_ISSUES',
description: 'If true results will create / update / close github issues',
defaultValue: false
)
string(
name: 'RC_NUMBER',
description: 'The RC build count. Default is 0 which means its not an RC build.',
Expand Down Expand Up @@ -292,32 +287,8 @@ pipeline {
localPath: "${WORKSPACE}/${distribution}",
switchUserNonRoot: "${switch_user_non_root}"
)
if (params.UPDATE_GITHUB_ISSUES) {
updateGitHubIssueLabels(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version}",
label: "${platform}:${distribution}:${architecture}",
action: "remove"
)
}
}
} catch (e) {
echo "Error running integtest for component ${local_component}, creating Github issue"
String issueBodyMessage = "The integration test failed at distribution level for component ${local_component}<br>Version: ${version}<br>Distribution: ${distribution}<br>Architecture: ${architecture}<br>Platform: ${platform}<br><br>Please check the logs: ${RUN_DISPLAY_URL}<br><br> * Test-report manifest:*<br> - https://ci.opensearch.org/ci/dbc/${JOB_NAME}/${version}/${buildId}/${platform}/${architecture}/${distribution}/test-results/${BUILD_NUMBER}/integ-test/test-report.yml <br><br> _Note: Steps to reproduce, additional logs and other files can be found within the above test-report manifest. <br>Instructions of this test-report manifest can be found [here](https://github.com/opensearch-project/opensearch-build/tree/main/src/report_workflow#guide-on-test-report-manifest-from-ci)._"
if (params.UPDATE_GITHUB_ISSUES) {
createGithubIssue(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version}",
issueBody: issueBodyMessage,
label: "autocut,v${version}"
)
updateGitHubIssueLabels(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version}",
label: "integ-test-failure,${platform}:${distribution}:${architecture}",
action: "add"
)
}
throw new Exception("Error running integtest for component ${local_component}", e)
} finally {
echo "Completed running integtest for component ${local_component}"
Expand Down Expand Up @@ -388,36 +359,10 @@ pipeline {
}
}
}

post {
success {
always {
node(AGENT_LABEL) {
script {
def stashed = lib.jenkins.Messages.new(this).get(['integ-test'])
publishNotification(
icon: ':white_check_mark:',
message: 'Integration Tests Successful',
extra: stashed,
credentialsId: 'jenkins-integ-test-webhook',
manifest: TEST_MANIFEST,
)

postCleanup()
}
}
}
failure {
node(AGENT_LABEL) {
script {
def stashed = lib.jenkins.Messages.new(this).get(['integ-test'])
publishNotification(
icon: ':warning:',
message: 'Failed Integration Tests',
extra: stashed,
credentialsId: 'jenkins-integ-test-webhook',
manifest: TEST_MANIFEST,
)

postCleanup()
}
}
Expand Down
57 changes: 1 addition & 56 deletions jenkins/opensearch/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ pipeline {
description: 'The build manifest URL for OpenSearch, e.g. "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.9.0/8172/linux/x64/tar/builds/opensearch/manifest.yml".',
trim: true
)
booleanParam(
name: 'UPDATE_GITHUB_ISSUES',
description: 'If true results will create / update / close github issues',
defaultValue: false
)
string(
name: 'RC_NUMBER',
description: 'The RC build count. Default is 0 which means its not an RC build.',
Expand Down Expand Up @@ -254,32 +249,8 @@ pipeline {
localPath: "${WORKSPACE}/${distribution}",
switchUserNonRoot: "${switch_user_non_root}"
)
if (params.UPDATE_GITHUB_ISSUES) {
updateGitHubIssueLabels(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version}",
label: "${platform}:${distribution}:${architecture}",
action: "remove"
)
}
}
} catch (e) {
echo "Error running integtest for component ${local_component}, creating Github issue"
String issueBodyMessage = "The integration test failed at distribution level for component ${local_component}<br>Version: ${version}<br>Distribution: ${distribution}<br>Architecture: ${architecture}<br>Platform: ${platform}<br><br>Please check the logs: ${RUN_DISPLAY_URL}<br><br> * Test-report manifest:*<br> - https://ci.opensearch.org/ci/dbc/${JOB_NAME}/${version}/${buildId}/${platform}/${architecture}/${distribution}/test-results/${BUILD_NUMBER}/integ-test/test-report.yml <br><br> _Note: Steps to reproduce, additional logs and other files can be found within the above test-report manifest. <br>Instructions of this test-report manifest can be found [here](https://github.com/opensearch-project/opensearch-build/tree/main/src/report_workflow#guide-on-test-report-manifest-from-ci)._"
if (params.UPDATE_GITHUB_ISSUES) {
createGithubIssue(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version}",
issueBody: issueBodyMessage,
label: "autocut,v${version}"
)
updateGitHubIssueLabels(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version}",
label: "integ-test-failure,${platform}:${distribution}:${architecture}",
action: "add"
)
}
throw new Exception("Error running integtest for component ${local_component}", e)
} finally {
echo "Completed running integtest for component ${local_component}"
Expand Down Expand Up @@ -346,36 +317,10 @@ pipeline {
}
}
}

post {
success {
always {
node(AGENT_LABEL) {
script {
def stashed = lib.jenkins.Messages.new(this).get(['integ-test'])
publishNotification(
icon: ':white_check_mark:',
message: 'Integration Tests Successful',
extra: stashed,
credentialsId: 'jenkins-integ-test-webhook',
manifest: TEST_MANIFEST,
)

postCleanup()
}
}
}
failure {
node(AGENT_LABEL) {
script {
def stashed = lib.jenkins.Messages.new(this).get(['integ-test'])
publishNotification(
icon: ':warning:',
message: 'Failed Integration Tests',
extra: stashed,
credentialsId: 'jenkins-integ-test-webhook',
manifest: TEST_MANIFEST,
)

postCleanup()
}
}
Expand Down
Loading

0 comments on commit aa5f956

Please sign in to comment.