From 362eca844044a549a682760fd0f13767587254e1 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Thu, 26 Sep 2024 13:12:33 -0700 Subject: [PATCH] Refactor metrics query class to use any index and refactor UpdateBuildFailureIssues library with new logic Signed-off-by: Sayali Gaikawad --- build.gradle | 6 +- src/jenkins/ComponentBuildStatus.groovy | 91 ++++++++++ src/utils/OpenSearchMetricsQuery.groovy | 3 +- .../TestCloseBuildSuccessGithubIssue.groovy | 46 ----- tests/jenkins/TestComponentBuildStatus.groovy | 124 ++++++++++++++ .../TestCreateBuildFailureGithubIssue.groovy | 56 ------ ...TestPublishDistributionBuildResults.groovy | 3 + .../TestUpdateBuildFailuresIssues.groovy | 101 +++++++++-- .../CloseBuildSuccessGithubIssue_JenkinsFile | 25 --- ...oseBuildSuccessGithubIssue_JenkinsFile.txt | 18 -- ...reGithubExistingIssueCheck_Jenkinsfile.txt | 60 ------- .../CreateBuildFailureGithubIssue_Jenkinsfile | 24 --- ...ateBuildFailureGithubIssue_Jenkinsfile.txt | 60 ------- .../jobs/UpdateBuildFailureIssue_Jenkinsfile | 7 +- .../UpdateBuildFailureIssue_Jenkinsfile.txt | 160 +++++++----------- ...oseBuildSuccessGithubIssueLibTester.groovy | 49 ------ ...ateBuildFailureGithubIssueLibTester.groovy | 41 ----- .../UpdateBuildFailureIssuesLibTester.groovy | 32 ++-- vars/UpdateBuildFailureIssues.groovy | 74 -------- vars/closeBuildSuccessGithubIssue.groovy | 44 ----- vars/createBuildFailureGithubIssue.groovy | 58 ------- vars/publishDistributionBuildResults.groovy | 3 + vars/updateBuildFailureIssues.groovy | 77 +++++++++ 23 files changed, 478 insertions(+), 684 deletions(-) create mode 100644 src/jenkins/ComponentBuildStatus.groovy delete mode 100644 tests/jenkins/TestCloseBuildSuccessGithubIssue.groovy create mode 100644 tests/jenkins/TestComponentBuildStatus.groovy delete mode 100644 tests/jenkins/TestCreateBuildFailureGithubIssue.groovy delete mode 100644 tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile delete mode 100644 tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile.txt delete mode 100644 tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt delete mode 100644 tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile delete mode 100644 tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt delete mode 100644 tests/jenkins/lib-testers/CloseBuildSuccessGithubIssueLibTester.groovy delete mode 100644 tests/jenkins/lib-testers/CreateBuildFailureGithubIssueLibTester.groovy delete mode 100644 vars/UpdateBuildFailureIssues.groovy delete mode 100644 vars/closeBuildSuccessGithubIssue.groovy delete mode 100644 vars/createBuildFailureGithubIssue.groovy create mode 100644 vars/updateBuildFailureIssues.groovy diff --git a/build.gradle b/build.gradle index e1486e982..1cab4622f 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ configurations.all { resolutionStrategy { force group: 'com.google.code.gson', name: 'gson', version: '2.8.9' force group: 'commons-codec', name: 'commons-codec', version: '1.15' - force group: 'com.google.protobuf', name: 'protobuf-java', version: '3.21.7' + force group: 'com.google.protobuf', name: 'protobuf-java', version: '3.25.5' force group: 'com.google.errorprone', name: 'error_prone_annotations', version: '2.18.0' force group: 'org.checkerframework', name: 'checker-qual', version: '3.33.0' force group: 'com.google.j2objc', name: 'j2objc-annotations', version: '2.8' @@ -51,7 +51,7 @@ sourceSets { test { groovy { - srcDirs = ['tests/jenkins', 'tests/gradlecheck', 'tests/utils'] + srcDirs = ['tests/jenkins', 'tests/gradlecheck'] } } @@ -128,7 +128,7 @@ jacocoTestReport { } } -String version = '6.9.2' +String version = '7.0.0' task updateVersion { doLast { diff --git a/src/jenkins/ComponentBuildStatus.groovy b/src/jenkins/ComponentBuildStatus.groovy new file mode 100644 index 000000000..8a2f6c3a8 --- /dev/null +++ b/src/jenkins/ComponentBuildStatus.groovy @@ -0,0 +1,91 @@ +/* + * 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. + */ + +package jenkins + +import groovy.json.JsonOutput +import utils.OpenSearchMetricsQuery + +class ComponentBuildStatus { + String metricsUrl + String awsAccessKey + String awsSecretKey + String awsSessionToken + String indexName + String product + String version + String distributionBuildNumber + String buildStartTimeFrom + String buildStartTimeTo + def script + + ComponentBuildStatus(String metricsUrl, String awsAccessKey, String awsSecretKey, String awsSessionToken, String indexName, String product, String version, String distributionBuildNumber, String buildStartTimeFrom, String buildStartTimeTo, def script) { + this.metricsUrl = metricsUrl + this.awsAccessKey = awsAccessKey + this.awsSecretKey = awsSecretKey + this.awsSessionToken = awsSessionToken + this.indexName = indexName + this.product = product + this.version = version + this.distributionBuildNumber = distributionBuildNumber + this.buildStartTimeFrom = buildStartTimeFrom + this.buildStartTimeTo = buildStartTimeTo + this.script = script + } + + def getQuery(String componentBuildResult) { + def queryMap = [ + _source: [ + "component", + ], + query: [ + bool: [ + filter: [ + [ + match_phrase: [ + component_category: "${this.product}" + ] + ], + [ + match_phrase: [ + component_build_result: "${componentBuildResult}" + ] + ], + [ + match_phrase: [ + version: "${this.version}" + ] + ], + [ + match_phrase : [ + distribution_build_number : "${this.distributionBuildNumber}" + ] + ], + [ + range: [ + build_start_time: [ + from: "${this.buildStartTimeFrom}", + to: "${this.buildStartTimeTo}" + ] + ] + ] + ] + ] + ] + ] + def query = JsonOutput.toJson(queryMap) + return query.replace('"', '\\"') + } + + def getComponents(String componentBuildResult) { + def jsonResponse = new OpenSearchMetricsQuery(metricsUrl,awsAccessKey, awsSecretKey, awsSessionToken, indexName, script).fetchMetrics(getQuery(componentBuildResult)) + def components = jsonResponse.hits.hits.collect { it._source.component } + return components + } +} diff --git a/src/utils/OpenSearchMetricsQuery.groovy b/src/utils/OpenSearchMetricsQuery.groovy index 5f8869448..dde4bc548 100644 --- a/src/utils/OpenSearchMetricsQuery.groovy +++ b/src/utils/OpenSearchMetricsQuery.groovy @@ -28,7 +28,6 @@ class OpenSearchMetricsQuery { this.script = script } - // Ensure the alias `gradle-check` is created targeting all the gradle-check-* indices. def fetchMetrics(String query) { def response = script.sh( script: """ @@ -36,7 +35,7 @@ class OpenSearchMetricsQuery { set +x curl -s -XGET "${metricsUrl}/${indexName}/_search" --aws-sigv4 "aws:amz:us-east-1:es" --user "${awsAccessKey}:${awsSecretKey}" -H "x-amz-security-token:${awsSessionToken}" -H 'Content-Type: application/json' -d "${query}" | jq '.' """, - returnStdout: true + returnStdout: true ).trim() return new JsonSlurper().parseText(response) } diff --git a/tests/jenkins/TestCloseBuildSuccessGithubIssue.groovy b/tests/jenkins/TestCloseBuildSuccessGithubIssue.groovy deleted file mode 100644 index 20ee51b86..000000000 --- a/tests/jenkins/TestCloseBuildSuccessGithubIssue.groovy +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ -package jenkins.tests - -import jenkins.tests.BuildPipelineTest -import org.junit.Before -import org.junit.Test -import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString -import static org.hamcrest.CoreMatchers.hasItem -import static org.hamcrest.MatcherAssert.assertThat - -class TestCloseBuildSuccessGithubIssue extends BuildPipelineTest { - - @Override - @Before - void setUp() { - this.registerLibTester(new CloseBuildSuccessGithubIssueLibTester(['Successfully built OpenSearch'], "Successfully built", "tests/data/opensearch-2.0.0.yml")) - super.setUp() - } - - - @Test - public void testExistingGithubIssue() { - super.testPipeline('tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile') - assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S \"[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title\" --json number --jq '.[0].number', returnStdout=true}")) - assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue close bbb\nccc -R opensearch-project/OpenSearch --comment \"Closing the issue as the distribution build for OpenSearch has passed for version: **2.0.0**.\n Please see build log at www.example.com/jobs/test/123/consoleFull\", returnStdout=true}")) - } - - def getCommands(method, text) { - def shCommands = helper.callStack.findAll { call -> - call.methodName == method - }.collect { call -> - callArgsToString(call) - }.findAll { command -> - command.contains(text) - } - return shCommands - } - -} diff --git a/tests/jenkins/TestComponentBuildStatus.groovy b/tests/jenkins/TestComponentBuildStatus.groovy new file mode 100644 index 000000000..a7d29462b --- /dev/null +++ b/tests/jenkins/TestComponentBuildStatus.groovy @@ -0,0 +1,124 @@ +/* + * 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. + */ + +package jenkins + +import org.junit.* +import groovy.json.JsonOutput +import groovy.mock.interceptor.MockFor + +class TestComponentBuildStatus { + + private ComponentBuildStatus componentBuildStatus + private final String metricsUrl = 'http://example.com' + private final String awsAccessKey = 'testAccessKey' + private final String awsSecretKey = 'testSecretKey' + private final String awsSessionToken = 'testSessionToken' + private final String indexName = 'opensearch-distribution-build-results-*' + private final String product = "OpenSearch" + private final String version = "2.18.0" + private final String distributionBuildNumber = "4891" + private final String buildStartTimeFrom = "now-6h" + private final String buildStartTimeTo = "now" + private def script + + @Before + void setUp() { + script = new Expando() + script.sh = { Map args -> + if (args.containsKey("script")) { + return """ + { + "hits": { + "total": { + "value": 2, + "relation": "eq" + }, + "max_score": 0, + "hits": [ + { + "_index": "opensearch-distribution-build-results-09-2024", + "_id": "QTVbQZIBOi-lzDIlekCk", + "_score": 0, + "_source": { + "component": "performance-analyzer" + } + }, + { + "_index": "opensearch-distribution-build-results-09-2024", + "_id": "PzVbQZIBOi-lzDIlekCk", + "_score": 0, + "_source": { + "component": "security-analytics" + } + } + ] + } + } + """ + } + return "" + } + componentBuildStatus = new ComponentBuildStatus(metricsUrl, awsAccessKey, awsSecretKey, awsSessionToken, indexName, product, version, distributionBuildNumber, buildStartTimeFrom, buildStartTimeTo, script) + } + + @Test + void testGetQueryReturnsExpectedQuery() { + def expectedOutput = JsonOutput.toJson([ + _source: [ + "component", + ], + query: [ + bool: [ + filter: [ + [ + match_phrase: [ + component_category: "OpenSearch" + ] + ], + [ + match_phrase: [ + component_build_result: "failed" + ] + ], + [ + match_phrase: [ + version: "2.18.0" + ] + ], + [ + match_phrase : [ + distribution_build_number : "4891" + ] + ], + [ + range: [ + build_start_time: [ + from: "now-6h", + to: "now" + ] + ] + ] + ] + ] + ] + ]).replace('"', '\\"') + + def result = componentBuildStatus.getQuery('failed') + assert result == expectedOutput + } + + @Test + void testComponentBuildStatusReturns() { + def expectedOutput = ['performance-analyzer', 'security-analytics'] + def result = componentBuildStatus.getComponents('failed') + + assert result == expectedOutput + } +} diff --git a/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy b/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy deleted file mode 100644 index 99f4b2123..000000000 --- a/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -package jenkins.tests - -import jenkins.tests.BuildPipelineTest -import org.junit.Before -import org.junit.Test -import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString -import static org.hamcrest.CoreMatchers.hasItem -import static org.hamcrest.MatcherAssert.assertThat - -class TestCreateBuildFailureGithubIssue extends BuildPipelineTest { - - @Override - @Before - void setUp() { - this.registerLibTester(new CreateBuildFailureGithubIssueLibTester(["Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer", "Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search", "Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer"])) - super.setUp() - } - - @Test - public void testCreateGithubIssue() { - super.testPipeline('tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile') - assertThat(getCommands('sh', 'script'), hasItem('{script=gh issue comment bbb\n' + - 'ccc --repo https://github.com/opensearch-project/performance-analyzer.git --body "***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**.\n' + - ' The distribution build for performance-analyzer has failed for version: 2.0.0.\n' + - ' Please see build log at www.example.com/job/build_url/32/display/redirect.\n' + - ' The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}')) - } - - @Test - public void testExistingGithubIssue_TestCreateBuildFailureGithubIssue() { - super.testPipeline('tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile', 'tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile') - assertThat(getCommands('println', ''), hasItem('Issue already exists, adding a comment')) - assertThat(getCommands('sh', 'script'), hasItem("""{script=gh issue comment bbb\nccc --repo https://github.com/opensearch-project/OpenSearch.git --body \"***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**.\n The distribution build for OpenSearch has failed for version: 2.0.0.\n Please see build log at www.example.com/job/build_url/32/display/redirect.\n The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details\", returnStdout=true}""")) - } - - def getCommands(method, text) { - def shCommands = helper.callStack.findAll { call -> - call.methodName == method - }.collect { call -> - callArgsToString(call) - }.findAll { command -> - command.contains(text) - } - return shCommands - } - -} diff --git a/tests/jenkins/TestPublishDistributionBuildResults.groovy b/tests/jenkins/TestPublishDistributionBuildResults.groovy index 41831ab7b..dc8ace9ba 100644 --- a/tests/jenkins/TestPublishDistributionBuildResults.groovy +++ b/tests/jenkins/TestPublishDistributionBuildResults.groovy @@ -106,6 +106,9 @@ class TestPublishDistributionBuildResults extends BuildPipelineTest { "type": "keyword" } } + }, + "aliases": { + "opensearch-distribution-build-results": {} } }' curl -I "METRICS_HOST_URL/test-index" --aws-sigv4 "aws:amz:us-east-1:es" --user "null:null" -H "x-amz-security-token:null" | grep -E "HTTP\\/[0-9]+(\\.[0-9]+)? 200" diff --git a/tests/jenkins/TestUpdateBuildFailuresIssues.groovy b/tests/jenkins/TestUpdateBuildFailuresIssues.groovy index 5e7fba5ae..4f0b2427c 100644 --- a/tests/jenkins/TestUpdateBuildFailuresIssues.groovy +++ b/tests/jenkins/TestUpdateBuildFailuresIssues.groovy @@ -15,30 +15,109 @@ import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString import static org.hamcrest.CoreMatchers.hasItem import static org.hamcrest.CoreMatchers.not import static org.hamcrest.MatcherAssert.assertThat +import groovy.json.JsonSlurper +import utils.OpenSearchMetricsQuery class TestUpdateBuildFailuresIssues extends BuildPipelineTest { @Override @Before void setUp() { - this.registerLibTester(new UpdateBuildFailureIssuesLibTester(["Error building common-utils, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component common-utils", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer", "Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search", "Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search", "Error building anomaly-detection, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component anomaly-detection", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer", "Error building notifications, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component notifications"], ["Successfully built sql", "Successfully built notifications", "Successfully built notifications", "Successfully built sql", "Successfully built anomaly-detection", "Successfully built index-management", "Successfully built sql", "Successfully built anomaly-detection"], 'tests/data/opensearch-2.2.0.yml')) + this.registerLibTester(new UpdateBuildFailureIssuesLibTester('tests/data/opensearch-2.2.0.yml', '32')) super.setUp() + def unformattedResponseForPass = ''' + { + "took": 5, + "timed_out": false, + "_shards": { + "total": 15, + "successful": 15, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": { + "value": 2, + "relation": "eq" + }, + "max_score": 0, + "hits": [ + { + "_index": "opensearch-distribution-build-results-09-2024", + "_id": "OsNSLJIBhoDV_8nijeJt", + "_score": 0, + "_source": { + "component": "sql" + } + }, + { + "_index": "opensearch-distribution-build-results-09-2024", + "_id": "LsNSLJIBhoDV_8nijeJt", + "_score": 0, + "_source": { + "component": "notifications" + } + } + ] + } + } + ''' + def unformattedResponseForFail = ''' + { + "took": 5, + "timed_out": false, + "_shards": { + "total": 15, + "successful": 15, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": { + "value": 2, + "relation": "eq" + }, + "max_score": 0, + "hits": [ + { + "_index": "opensearch-distribution-build-results-09-2024", + "_id": "OsNSLJIBhoDV_8nijeJt", + "_score": 0, + "_source": { + "component": "asynchronous-search" + } + }, + { + "_index": "opensearch-distribution-build-results-09-2024", + "_id": "LsNSLJIBhoDV_8nijeJt", + "_score": 0, + "_source": { + "component": "notifications" + } + } + ] + } + } + ''' + helper.addShMock("""\n set -e\n set +x\n curl -s -XGET \"sample.url/opensearch-distribution-build-results/_search\" --aws-sigv4 \"aws:amz:us-east-1:es\" --user \"abc:xyz\" -H \"x-amz-security-token:sampleToken\" -H 'Content-Type: application/json' -d \"{\\"_source\\":[\\"component\\"],\\"query\\":{\\"bool\\":{\\"filter\\":[{\\"match_phrase\\":{\\"component_category\\":\\"OpenSearch\\"}},{\\"match_phrase\\":{\\"component_build_result\\":\\"passed\\"}},{\\"match_phrase\\":{\\"version\\":\\"2.2.0\\"}},{\\"match_phrase\\":{\\"distribution_build_number\\":\\"32\\"}},{\\"range\\":{\\"build_start_time\\":{\\"from\\":\\"now-6h\\",\\"to\\":\\"now\\"}}}]}}}\" | jq '.'\n """) { script -> + return [stdout: unformattedResponseForPass, exitValue: 0] + } + helper.addShMock("""\n set -e\n set +x\n curl -s -XGET \"sample.url/opensearch-distribution-build-results/_search\" --aws-sigv4 \"aws:amz:us-east-1:es\" --user \"abc:xyz\" -H \"x-amz-security-token:sampleToken\" -H 'Content-Type: application/json' -d \"{\\"_source\\":[\\"component\\"],\\"query\\":{\\"bool\\":{\\"filter\\":[{\\"match_phrase\\":{\\"component_category\\":\\"OpenSearch\\"}},{\\"match_phrase\\":{\\"component_build_result\\":\\"failed\\"}},{\\"match_phrase\\":{\\"version\\":\\"2.2.0\\"}},{\\"match_phrase\\":{\\"distribution_build_number\\":\\"32\\"}},{\\"range\\":{\\"build_start_time\\":{\\"from\\":\\"now-6h\\",\\"to\\":\\"now\\"}}}]}}}\" | jq '.'\n """) { script -> + return [stdout: unformattedResponseForFail, exitValue: 0] + } } @Test - public void testCommentOnExistingGithubIssue() { - helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script -> - return [stdout: "2023-10-24", exitValue: 0] - } + public void testGithubIssueEdit() { helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/asynchronous-search.git -S "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0 in:title" --label autocut,v2.2.0 --json number --jq '.[0].number'""") { script -> return [stdout: "22", exitValue: 0] } helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/asynchronous-search.git -S "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.2.0 --json number --jq '.[0].number'""") { script -> return [stdout: "", exitValue: 0] } - runScript('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') - assertThat(getCommands('println', ''), hasItem('Issue already exists, adding a comment')) - assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue comment bbb\nccc --repo https://github.com/opensearch-project/asynchronous-search.git --body \"***Received Error***: **Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search**.\n asynchronous-search failed during the distribution build for version: 2.2.0.\n Please see build log at www.example.com/job/build_url/32/display/redirect.\n The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details\", returnStdout=true}")) + super.testPipeline('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') + assertThat(getCommands('println', ''), hasItem('Issue already exists, editing the issue body')) + assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue edit bbb\nccc --repo https://github.com/opensearch-project/asynchronous-search.git --body \"***Build Failed Error***: **asynchronous-search failed during the distribution build for version: 2.2.0.**\n Please see build log at www.example.com/job/build_url/32/display/redirect.\n The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details.\n Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally.\", returnStdout=true}")) } @Test @@ -49,7 +128,7 @@ class TestUpdateBuildFailuresIssues extends BuildPipelineTest { helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/sql.git -S "[AUTOCUT] Distribution Build Failed for sql-2.2.0 in:title" --label autocut,v2.2.0 --json number --jq '.[0].number'""") { script -> return [stdout: "30", exitValue: 0] } - runScript('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') + super.testPipeline('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') assertThat(getCommands('sh', 'sql'), hasItem("{script=gh issue list --repo https://github.com/opensearch-project/sql.git -S \"[AUTOCUT] Distribution Build Failed for sql-2.2.0 in:title\" --json number --jq '.[0].number', returnStdout=true}")) assertThat(getCommands('sh', 'sql'), hasItem("{script=gh issue close bbb\nccc -R opensearch-project/sql --comment \"Closing the issue as the distribution build for sql has passed for version: **2.2.0**.\n Please see build log at www.example.com/job/build_url/32/display/redirect\", returnStdout=true}")) } @@ -62,9 +141,9 @@ class TestUpdateBuildFailuresIssues extends BuildPipelineTest { helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/notifications.git -S "[AUTOCUT] Distribution Build Failed for notifications-2.2.0 in:title" --label autocut,v2.2.0 --json number --jq '.[0].number'""") { script -> return [stdout: "20", exitValue: 0] } - runScript('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') + super.testPipeline('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') assertThat(getCommands('sh', 'notifications'), not(hasItem("{script=gh issue close bbb\nccc -R opensearch-project/notifications --comment \"Closing the issue as the distribution build for notifications has passed for version: **2.2.0**.\n Please see build log at www.example.com/job/build_url/32/display/redirect\", returnStdout=true}"))) - assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue comment bbb\nccc --repo https://github.com/opensearch-project/notifications.git --body \"***Received Error***: **Error building notifications, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component notifications**.\n notifications failed during the distribution build for version: 2.2.0.\n Please see build log at www.example.com/job/build_url/32/display/redirect.\n The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details\", returnStdout=true}")) + assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue edit bbb\nccc --repo https://github.com/opensearch-project/notifications.git --body \"***Build Failed Error***: **notifications failed during the distribution build for version: 2.2.0.**\n Please see build log at www.example.com/job/build_url/32/display/redirect.\n The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details.\n Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally.\", returnStdout=true}")) } def getCommands(method, text) { diff --git a/tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile b/tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile deleted file mode 100644 index d647a584d..000000000 --- a/tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ - -pipeline { - agent none - stages { - stage('notify') { - steps { - script { - closeBuildSuccessGithubIssue( - message: ["Successfully built OpenSearch"], - search: "Successfully built", - inputManifestPath: 'tests/data/opensearch-2.0.0.yml' - ) - } - } - } - } -} diff --git a/tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile.txt b/tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile.txt deleted file mode 100644 index 5e9fbebb1..000000000 --- a/tests/jenkins/jobs/CloseBuildSuccessGithubIssue_JenkinsFile.txt +++ /dev/null @@ -1,18 +0,0 @@ - CloseBuildSuccessGithubIssue_JenkinsFile.run() - CloseBuildSuccessGithubIssue_JenkinsFile.pipeline(groovy.lang.Closure) - CloseBuildSuccessGithubIssue_JenkinsFile.echo(Executing on agent [label:none]) - CloseBuildSuccessGithubIssue_JenkinsFile.stage(notify, groovy.lang.Closure) - CloseBuildSuccessGithubIssue_JenkinsFile.script(groovy.lang.Closure) - CloseBuildSuccessGithubIssue_JenkinsFile.closeBuildSuccessGithubIssue({message=[Successfully built OpenSearch], search=Successfully built, inputManifestPath=tests/data/opensearch-2.0.0.yml}) - closeBuildSuccessGithubIssue.legacySCM(groovy.lang.Closure) - closeBuildSuccessGithubIssue.library({identifier=jenkins@main, retriever=null}) - closeBuildSuccessGithubIssue.readYaml({file=tests/data/opensearch-2.0.0.yml}) - closeBuildSuccessGithubIssue.closeGithubIssue({repoUrl=https://github.com/opensearch-project/OpenSearch.git, issueTitle=[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0, closeComment=Closing the issue as the distribution build for OpenSearch has passed for version: **2.0.0**. - Please see build log at www.example.com/jobs/test/123/consoleFull, label=autocut,v2.0.0}) - closeGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - closeGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - closeGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - closeGithubIssue.sh({script=gh issue close bbb -ccc -R opensearch-project/OpenSearch --comment "Closing the issue as the distribution build for OpenSearch has passed for version: **2.0.0**. - Please see build log at www.example.com/jobs/test/123/consoleFull", returnStdout=true}) - closeBuildSuccessGithubIssue.sleep({time=3, unit=SECONDS}) diff --git a/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt b/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt deleted file mode 100644 index d1a79bd41..000000000 --- a/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt +++ /dev/null @@ -1,60 +0,0 @@ - CreateBuildFailureGithubIssue_Jenkinsfile.run() - CreateBuildFailureGithubIssue_Jenkinsfile.pipeline(groovy.lang.Closure) - CreateBuildFailureGithubIssue_Jenkinsfile.echo(Executing on agent [label:none]) - CreateBuildFailureGithubIssue_Jenkinsfile.stage(notify, groovy.lang.Closure) - CreateBuildFailureGithubIssue_Jenkinsfile.script(groovy.lang.Closure) - CreateBuildFailureGithubIssue_Jenkinsfile.createBuildFailureGithubIssue({message=[Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot, Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer, Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search, Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial, Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer], inputManifestPath=tests/data/opensearch-2.0.0.yml}) - createBuildFailureGithubIssue.legacySCM(groovy.lang.Closure) - createBuildFailureGithubIssue.library({identifier=jenkins@main, retriever=null}) - createBuildFailureGithubIssue.readYaml({file=tests/data/opensearch-2.0.0.yml}) - createBuildFailureGithubIssue.createGithubIssue({repoUrl=https://github.com/opensearch-project/OpenSearch.git, issueTitle=[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0, issueBody=***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. - The distribution build for OpenSearch has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.0.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title is:closed closed:>=bbb -ccc" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/OpenSearch.git --body "***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. - The distribution build for OpenSearch has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - createBuildFailureGithubIssue.sleep({time=3, unit=SECONDS}) - createBuildFailureGithubIssue.createGithubIssue({repoUrl=https://github.com/opensearch-project/geospatial.git, issueTitle=[AUTOCUT] Distribution Build Failed for geospatial-2.0.0, issueBody=***Received Error***: **Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial**. - The distribution build for geospatial has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.0.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/geospatial.git -S "[AUTOCUT] Distribution Build Failed for geospatial-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/geospatial.git -S "[AUTOCUT] Distribution Build Failed for geospatial-2.0.0 in:title is:closed closed:>=bbb -ccc" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/geospatial.git --body "***Received Error***: **Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial**. - The distribution build for geospatial has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - createBuildFailureGithubIssue.sleep({time=3, unit=SECONDS}) - createBuildFailureGithubIssue.createGithubIssue({repoUrl=https://github.com/opensearch-project/performance-analyzer.git, issueTitle=[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0, issueBody=***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**. - The distribution build for performance-analyzer has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.0.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title is:closed closed:>=bbb -ccc" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/performance-analyzer.git --body "***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**. - The distribution build for performance-analyzer has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - createBuildFailureGithubIssue.sleep({time=3, unit=SECONDS}) diff --git a/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile b/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile deleted file mode 100644 index affeb2766..000000000 --- a/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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. - */ - -pipeline { - agent none - stages { - stage('notify') { - steps { - script { - createBuildFailureGithubIssue( - message: ["Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer", "Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search", "Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer"], - inputManifestPath: 'tests/data/opensearch-2.0.0.yml' - ) - } - } - } - } -} diff --git a/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt b/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt deleted file mode 100644 index d1a79bd41..000000000 --- a/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt +++ /dev/null @@ -1,60 +0,0 @@ - CreateBuildFailureGithubIssue_Jenkinsfile.run() - CreateBuildFailureGithubIssue_Jenkinsfile.pipeline(groovy.lang.Closure) - CreateBuildFailureGithubIssue_Jenkinsfile.echo(Executing on agent [label:none]) - CreateBuildFailureGithubIssue_Jenkinsfile.stage(notify, groovy.lang.Closure) - CreateBuildFailureGithubIssue_Jenkinsfile.script(groovy.lang.Closure) - CreateBuildFailureGithubIssue_Jenkinsfile.createBuildFailureGithubIssue({message=[Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot, Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer, Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search, Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial, Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer], inputManifestPath=tests/data/opensearch-2.0.0.yml}) - createBuildFailureGithubIssue.legacySCM(groovy.lang.Closure) - createBuildFailureGithubIssue.library({identifier=jenkins@main, retriever=null}) - createBuildFailureGithubIssue.readYaml({file=tests/data/opensearch-2.0.0.yml}) - createBuildFailureGithubIssue.createGithubIssue({repoUrl=https://github.com/opensearch-project/OpenSearch.git, issueTitle=[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0, issueBody=***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. - The distribution build for OpenSearch has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.0.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title is:closed closed:>=bbb -ccc" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/OpenSearch.git --body "***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. - The distribution build for OpenSearch has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - createBuildFailureGithubIssue.sleep({time=3, unit=SECONDS}) - createBuildFailureGithubIssue.createGithubIssue({repoUrl=https://github.com/opensearch-project/geospatial.git, issueTitle=[AUTOCUT] Distribution Build Failed for geospatial-2.0.0, issueBody=***Received Error***: **Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial**. - The distribution build for geospatial has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.0.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/geospatial.git -S "[AUTOCUT] Distribution Build Failed for geospatial-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/geospatial.git -S "[AUTOCUT] Distribution Build Failed for geospatial-2.0.0 in:title is:closed closed:>=bbb -ccc" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/geospatial.git --body "***Received Error***: **Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial**. - The distribution build for geospatial has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - createBuildFailureGithubIssue.sleep({time=3, unit=SECONDS}) - createBuildFailureGithubIssue.createGithubIssue({repoUrl=https://github.com/opensearch-project/performance-analyzer.git, issueTitle=[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0, issueBody=***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**. - The distribution build for performance-analyzer has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.0.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title is:closed closed:>=bbb -ccc" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/performance-analyzer.git --body "***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**. - The distribution build for performance-analyzer has failed for version: 2.0.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - createBuildFailureGithubIssue.sleep({time=3, unit=SECONDS}) diff --git a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile index 44afd89da..b855c62fa 100644 --- a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile +++ b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile @@ -13,10 +13,9 @@ pipeline { stage('updateBuildFailureIssue') { steps { script { - UpdateBuildFailureIssues( - failureMessages: ["Error building common-utils, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component common-utils", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer", "Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search", "Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search", "Error building anomaly-detection, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component anomaly-detection", "Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer", "Error building notifications, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component notifications"], - passMessages: ["Successfully built sql", "Successfully built notifications", "Successfully built notifications", "Successfully built sql", "Successfully built anomaly-detection", "Successfully built index-management", "Successfully built sql", "Successfully built anomaly-detection"], - inputManifestPath: 'tests/data/opensearch-2.2.0.yml' + updateBuildFailureIssues( + inputManifestPath: 'tests/data/opensearch-2.2.0.yml', + distributionBuildNumber: '32' ) } } diff --git a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt index 0231533b8..ab2ec7552 100644 --- a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt +++ b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt @@ -3,117 +3,81 @@ UpdateBuildFailureIssue_Jenkinsfile.echo(Executing on agent [label:none]) UpdateBuildFailureIssue_Jenkinsfile.stage(updateBuildFailureIssue, groovy.lang.Closure) UpdateBuildFailureIssue_Jenkinsfile.script(groovy.lang.Closure) - UpdateBuildFailureIssue_Jenkinsfile.UpdateBuildFailureIssues({failureMessages=[Error building common-utils, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component common-utils, Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer, Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search, Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search, Error building anomaly-detection, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component anomaly-detection, Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component performance-analyzer, Error building notifications, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component notifications], passMessages=[Successfully built sql, Successfully built notifications, Successfully built notifications, Successfully built sql, Successfully built anomaly-detection, Successfully built index-management, Successfully built sql, Successfully built anomaly-detection], inputManifestPath=tests/data/opensearch-2.2.0.yml}) - UpdateBuildFailureIssues.legacySCM(groovy.lang.Closure) - UpdateBuildFailureIssues.library({identifier=jenkins@main, retriever=null}) - UpdateBuildFailureIssues.readYaml({file=tests/data/opensearch-2.2.0.yml}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/common-utils.git, issueTitle=[AUTOCUT] Distribution Build Failed for common-utils-2.2.0, issueBody=***Received Error***: **Error building common-utils, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component common-utils**. - common-utils failed during the distribution build for version: 2.2.0. + UpdateBuildFailureIssue_Jenkinsfile.updateBuildFailureIssues({inputManifestPath=tests/data/opensearch-2.2.0.yml, distributionBuildNumber=32}) + updateBuildFailureIssues.readYaml({file=tests/data/opensearch-2.2.0.yml}) + updateBuildFailureIssues.string({credentialsId=jenkins-health-metrics-account-number, variable=METRICS_HOST_ACCOUNT}) + updateBuildFailureIssues.string({credentialsId=jenkins-health-metrics-cluster-endpoint, variable=METRICS_HOST_URL}) + updateBuildFailureIssues.withCredentials([METRICS_HOST_ACCOUNT, METRICS_HOST_URL], groovy.lang.Closure) + updateBuildFailureIssues.withAWS({role=OpenSearchJenkinsAccessRole, roleAccount=METRICS_HOST_ACCOUNT, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) + ComponentBuildStatus.getComponents(passed) + OpenSearchMetricsQuery.fetchMetrics({\"_source\":[\"component\"],\"query\":{\"bool\":{\"filter\":[{\"match_phrase\":{\"component_category\":\"OpenSearch\"}},{\"match_phrase\":{\"component_build_result\":\"passed\"}},{\"match_phrase\":{\"version\":\"2.2.0\"}},{\"match_phrase\":{\"distribution_build_number\":\"32\"}},{\"range\":{\"build_start_time\":{\"from\":\"now-6h\",\"to\":\"now\"}}}]}}}) + updateBuildFailureIssues.sh({script= + set -e + set +x + curl -s -XGET "sample.url/opensearch-distribution-build-results/_search" --aws-sigv4 "aws:amz:us-east-1:es" --user "abc:xyz" -H "x-amz-security-token:sampleToken" -H 'Content-Type: application/json' -d "{\"_source\":[\"component\"],\"query\":{\"bool\":{\"filter\":[{\"match_phrase\":{\"component_category\":\"OpenSearch\"}},{\"match_phrase\":{\"component_build_result\":\"passed\"}},{\"match_phrase\":{\"version\":\"2.2.0\"}},{\"match_phrase\":{\"distribution_build_number\":\"32\"}},{\"range\":{\"build_start_time\":{\"from\":\"now-6h\",\"to\":\"now\"}}}]}}}" | jq '.' + , returnStdout=true}) + ComponentBuildStatus.getComponents(failed) + OpenSearchMetricsQuery.fetchMetrics({\"_source\":[\"component\"],\"query\":{\"bool\":{\"filter\":[{\"match_phrase\":{\"component_category\":\"OpenSearch\"}},{\"match_phrase\":{\"component_build_result\":\"failed\"}},{\"match_phrase\":{\"version\":\"2.2.0\"}},{\"match_phrase\":{\"distribution_build_number\":\"32\"}},{\"range\":{\"build_start_time\":{\"from\":\"now-6h\",\"to\":\"now\"}}}]}}}) + updateBuildFailureIssues.sh({script= + set -e + set +x + curl -s -XGET "sample.url/opensearch-distribution-build-results/_search" --aws-sigv4 "aws:amz:us-east-1:es" --user "abc:xyz" -H "x-amz-security-token:sampleToken" -H 'Content-Type: application/json' -d "{\"_source\":[\"component\"],\"query\":{\"bool\":{\"filter\":[{\"match_phrase\":{\"component_category\":\"OpenSearch\"}},{\"match_phrase\":{\"component_build_result\":\"failed\"}},{\"match_phrase\":{\"version\":\"2.2.0\"}},{\"match_phrase\":{\"distribution_build_number\":\"32\"}},{\"range\":{\"build_start_time\":{\"from\":\"now-6h\",\"to\":\"now\"}}}]}}}" | jq '.' + , returnStdout=true}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/notifications.git, issueTitle=[AUTOCUT] Distribution Build Failed for notifications-2.2.0, issueBody=***Build Failed Error***: **notifications failed during the distribution build for version: 2.2.0.** Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.2.0}) + The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details. + Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally., label=autocut,v2.2.0, issueEdit=true}) createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/common-utils.git -S "[AUTOCUT] Distribution Build Failed for common-utils-2.2.0 in:title" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) + createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/notifications.git -S "[AUTOCUT] Distribution Build Failed for notifications-2.2.0 in:title" --json number --jq '.[0].number', returnStdout=true}) createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/common-utils.git -S "[AUTOCUT] Distribution Build Failed for common-utils-2.2.0 in:title is:closed closed:>=2023-10-24" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/common-utils.git --body "***Received Error***: **Error building common-utils, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component common-utils**. - common-utils failed during the distribution build for version: 2.2.0. + createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/notifications.git -S "[AUTOCUT] Distribution Build Failed for notifications-2.2.0 in:title is:closed closed:>=bbb +ccc" --json number --jq '.[0].number', returnStdout=true}) + createGithubIssue.println(Issue already exists, editing the issue body) + createGithubIssue.sh({script=gh issue edit bbb +ccc --repo https://github.com/opensearch-project/notifications.git --body "***Build Failed Error***: **notifications failed during the distribution build for version: 2.2.0.** Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/performance-analyzer.git, issueTitle=[AUTOCUT] Distribution Build Failed for performance-analyzer-2.2.0, issueBody=***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**. - performance-analyzer failed during the distribution build for version: 2.2.0. + The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details. + Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally.", returnStdout=true}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/asynchronous-search.git, issueTitle=[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0, issueBody=***Build Failed Error***: **asynchronous-search failed during the distribution build for version: 2.2.0.** Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.2.0}) + The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details. + Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally., label=autocut,v2.2.0, issueEdit=true}) createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.2.0 in:title" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) + createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/asynchronous-search.git -S "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0 in:title" --json number --jq '.[0].number', returnStdout=true}) createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.2.0 in:title is:closed closed:>=2023-10-24" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/performance-analyzer.git --body "***Received Error***: **Error building performance-analyzer, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0ed in the next build. This might have performance impact if it keeps failing. Run the javaToolchains task for more det.yml --component performance-analyzer**. - performance-analyzer failed during the distribution build for version: 2.2.0. + createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/asynchronous-search.git -S "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0 in:title is:closed closed:>=bbb +ccc" --json number --jq '.[0].number', returnStdout=true}) + createGithubIssue.println(Issue already exists, editing the issue body) + createGithubIssue.sh({script=gh issue edit bbb +ccc --repo https://github.com/opensearch-project/asynchronous-search.git --body "***Build Failed Error***: **asynchronous-search failed during the distribution build for version: 2.2.0.** Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/notifications.git, issueTitle=[AUTOCUT] Distribution Build Failed for notifications-2.2.0, issueBody=***Received Error***: **Error building notifications, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component notifications**. - notifications failed during the distribution build for version: 2.2.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.2.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/notifications.git -S "[AUTOCUT] Distribution Build Failed for notifications-2.2.0 in:title" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/notifications.git -S "[AUTOCUT] Distribution Build Failed for notifications-2.2.0 in:title is:closed closed:>=2023-10-24" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/notifications.git --body "***Received Error***: **Error building notifications, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component notifications**. - notifications failed during the distribution build for version: 2.2.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/anomaly-detection.git, issueTitle=[AUTOCUT] Distribution Build Failed for anomaly-detection-2.2.0, issueBody=***Received Error***: **Error building anomaly-detection, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component anomaly-detection**. - anomaly-detection failed during the distribution build for version: 2.2.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.2.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/anomaly-detection.git -S "[AUTOCUT] Distribution Build Failed for anomaly-detection-2.2.0 in:title" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/anomaly-detection.git -S "[AUTOCUT] Distribution Build Failed for anomaly-detection-2.2.0 in:title is:closed closed:>=2023-10-24" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/anomaly-detection.git --body "***Received Error***: **Error building anomaly-detection, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component anomaly-detection**. - anomaly-detection failed during the distribution build for version: 2.2.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.createGithubIssue({repoUrl=https://github.com/opensearch-project/asynchronous-search.git, issueTitle=[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0, issueBody=***Received Error***: **Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search**. - asynchronous-search failed during the distribution build for version: 2.2.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details, label=autocut,v2.2.0}) - createGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - createGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/asynchronous-search.git -S "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0 in:title" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.sh({script=date -d "3 days ago" +'%Y-%m-%d', returnStdout=true}) - createGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/asynchronous-search.git -S "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0 in:title is:closed closed:>=2023-10-24" --label "autocut,v2.2.0" --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Issue already exists, adding a comment) - createGithubIssue.sh({script=gh issue comment bbb -ccc --repo https://github.com/opensearch-project/asynchronous-search.git --body "***Received Error***: **Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search**. - asynchronous-search failed during the distribution build for version: 2.2.0. - Please see build log at www.example.com/job/build_url/32/display/redirect. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.closeGithubIssue({repoUrl=https://github.com/opensearch-project/index-management.git, issueTitle=[AUTOCUT] Distribution Build Failed for index-management-2.2.0, closeComment=Closing the issue as the distribution build for index-management has passed for version: **2.2.0**. - Please see build log at www.example.com/job/build_url/32/display/redirect, label=autocut,v2.2.0}) - closeGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) - closeGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - closeGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/index-management.git -S "[AUTOCUT] Distribution Build Failed for index-management-2.2.0 in:title" --label autocut,v2.2.0 --json number --jq '.[0].number', returnStdout=true}) - closeGithubIssue.sh({script=gh issue close bbb -ccc -R opensearch-project/index-management --comment "Closing the issue as the distribution build for index-management has passed for version: **2.2.0**. - Please see build log at www.example.com/job/build_url/32/display/redirect", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.closeGithubIssue({repoUrl=https://github.com/opensearch-project/sql.git, issueTitle=[AUTOCUT] Distribution Build Failed for sql-2.2.0, closeComment=Closing the issue as the distribution build for sql has passed for version: **2.2.0**. + The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details. + Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally.", returnStdout=true}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.closeGithubIssue({repoUrl=https://github.com/opensearch-project/sql.git, issueTitle=[AUTOCUT] Distribution Build Failed for sql-2.2.0, closeComment=Closing the issue as the distribution build for sql has passed for version: **2.2.0**. Please see build log at www.example.com/job/build_url/32/display/redirect, label=autocut,v2.2.0}) closeGithubIssue.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) closeGithubIssue.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) - closeGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/sql.git -S "[AUTOCUT] Distribution Build Failed for sql-2.2.0 in:title" --label autocut,v2.2.0 --json number --jq '.[0].number', returnStdout=true}) + closeGithubIssue.sh({script=gh issue list --repo https://github.com/opensearch-project/sql.git -S "[AUTOCUT] Distribution Build Failed for sql-2.2.0 in:title" --json number --jq '.[0].number', returnStdout=true}) closeGithubIssue.sh({script=gh issue close bbb ccc -R opensearch-project/sql --comment "Closing the issue as the distribution build for sql has passed for version: **2.2.0**. Please see build log at www.example.com/job/build_url/32/display/redirect", returnStdout=true}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) - + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + updateBuildFailureIssues.sleep({time=3, unit=SECONDS}) diff --git a/tests/jenkins/lib-testers/CloseBuildSuccessGithubIssueLibTester.groovy b/tests/jenkins/lib-testers/CloseBuildSuccessGithubIssueLibTester.groovy deleted file mode 100644 index acef202e3..000000000 --- a/tests/jenkins/lib-testers/CloseBuildSuccessGithubIssueLibTester.groovy +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ -import static org.hamcrest.CoreMatchers.notNullValue -import static org.hamcrest.CoreMatchers.nullValue -import static org.hamcrest.MatcherAssert.assertThat - -class CloseBuildSuccessGithubIssueLibTester extends LibFunctionTester{ - private List message - private String search - private String inputManifestPath - - public CloseBuildSuccessGithubIssueLibTester(message, search, inputManifestPath){ - this.message = message - this.search = search - this.inputManifestPath = inputManifestPath - } - - @Override - String libFunctionName() { - return 'closeBuildSuccessGithubIssue' - } - - @Override - void parameterInvariantsAssertions(Object call) { - assertThat(call.args.message.first(), notNullValue()) - assertThat(call.args.search.first(), notNullValue()) - assertThat(call.args.inputManifestPath.first(), notNullValue()) - } - - @Override - boolean expectedParametersMatcher(Object call) { - return call.args.message.first().equals(this.message) - return call.args.search.first().equals(this.search) - return call.args.inputManifestPath.first().equals(this.inputManifestPath) - } - - @Override - void configure(Object helper, Object binding) { - helper.registerAllowedMethod('withCredentials', [Map]) - helper.registerAllowedMethod('sleep', [Map]) - binding.setVariable('BUILD_URL', 'www.example.com/jobs/test/123/') - } -} diff --git a/tests/jenkins/lib-testers/CreateBuildFailureGithubIssueLibTester.groovy b/tests/jenkins/lib-testers/CreateBuildFailureGithubIssueLibTester.groovy deleted file mode 100644 index 96d9e9b3f..000000000 --- a/tests/jenkins/lib-testers/CreateBuildFailureGithubIssueLibTester.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -import static org.hamcrest.CoreMatchers.notNullValue -import static org.hamcrest.CoreMatchers.nullValue -import static org.hamcrest.MatcherAssert.assertThat - -class CreateBuildFailureGithubIssueLibTester extends LibFunctionTester{ - private List message - - public CreateBuildFailureGithubIssueLibTester(message){ - this.message = message - } - - @Override - String libFunctionName() { - return 'createBuildFailureGithubIssue' - } - - @Override - void parameterInvariantsAssertions(Object call) { - assertThat(call.args.message.first(), notNullValue()) - } - - @Override - boolean expectedParametersMatcher(Object call) { - return call.args.message.first().equals(this.message) - } - - @Override - void configure(Object helper, Object binding) { - helper.registerAllowedMethod('withCredentials', [Map]) - helper.registerAllowedMethod('sleep', [Map]) - binding.setVariable('env', ['RUN_DISPLAY_URL': 'www.example.com/job/build_url/32/display/redirect']) - } -} diff --git a/tests/jenkins/lib-testers/UpdateBuildFailureIssuesLibTester.groovy b/tests/jenkins/lib-testers/UpdateBuildFailureIssuesLibTester.groovy index 41b5782aa..7597c6928 100644 --- a/tests/jenkins/lib-testers/UpdateBuildFailureIssuesLibTester.groovy +++ b/tests/jenkins/lib-testers/UpdateBuildFailureIssuesLibTester.groovy @@ -11,32 +11,28 @@ import static org.hamcrest.CoreMatchers.nullValue import static org.hamcrest.MatcherAssert.assertThat class UpdateBuildFailureIssuesLibTester extends LibFunctionTester{ - private List failureMessages - private List passMessages private String inputManifestPath + private String distributionBuildNumber - public UpdateBuildFailureIssuesLibTester(failureMessages, passMessages, inputManifestPath){ - this.failureMessages = failureMessages - this.passMessages = passMessages + public UpdateBuildFailureIssuesLibTester(inputManifestPath, distributionBuildNumber){ this.inputManifestPath = inputManifestPath + this.distributionBuildNumber = distributionBuildNumber } @Override String libFunctionName() { - return 'UpdateBuildFailureIssues' + return 'updateBuildFailureIssues' } @Override void parameterInvariantsAssertions(Object call) { - assertThat(call.args.failureMessages.first(), notNullValue()) - assertThat(call.args.passMessages.first(), notNullValue()) assertThat(call.args.inputManifestPath.first(), notNullValue()) + assertThat(call.args.distributionBuildNumber.first(), notNullValue()) } @Override boolean expectedParametersMatcher(Object call) { - return call.args.failureMessages.first().equals(this.failureMessages) - && call.args.passMessages.first().equals(this.passMessages) + return call.args.distributionBuildNumber.first().equals(this.distributionBuildNumber) && call.args.inputManifestPath.first().equals(this.inputManifestPath) } @@ -44,6 +40,20 @@ class UpdateBuildFailureIssuesLibTester extends LibFunctionTester{ void configure(Object helper, Object binding) { helper.registerAllowedMethod('withCredentials', [Map]) helper.registerAllowedMethod('sleep', [Map]) - binding.setVariable('env', ['RUN_DISPLAY_URL': 'www.example.com/job/build_url/32/display/redirect']) + binding.setVariable('env', [ + 'RUN_DISPLAY_URL': 'www.example.com/job/build_url/32/display/redirect', + 'METRICS_HOST_URL': 'sample.url', + 'AWS_ACCESS_KEY_ID': 'abc', + 'AWS_SECRET_ACCESS_KEY':'xyz', + 'AWS_SESSION_TOKEN': 'sampleToken' + ]) + helper.registerAllowedMethod('withCredentials', [Map, Closure], { args, closure -> + closure.delegate = delegate + return helper.callClosure(closure) + }) + helper.registerAllowedMethod('withAWS', [Map, Closure], { args, closure -> + closure.delegate = delegate + return helper.callClosure(closure) + }) } } diff --git a/vars/UpdateBuildFailureIssues.groovy b/vars/UpdateBuildFailureIssues.groovy deleted file mode 100644 index ab7848fc3..000000000 --- a/vars/UpdateBuildFailureIssues.groovy +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - /** Library to create, update an close GitHub issue across opensearch-project repositories for distribution build failures. - @param Map args = [:] args A map of the following parameters - @param args.failureMessages - Failure message retrieved from buildFailureMessage() method. - @param args.passMessages - Passing message retrieved from buildFailureMessage() method. - @param args.inputManifestPath - Path to input manifest. - */ -void call(Map args = [:]) { - lib = library(identifier: 'jenkins@main', retriever: legacySCM(scm)) - def failureMessages = args.failureMessages - def passMessages = args.passMessages - def inputManifest = readYaml(file: args.inputManifestPath) - def currentVersion = inputManifest.build.version - - List failedComponents = [] - List passedComponents = [] - - for (message in failureMessages) { - java.util.regex.Matcher match = (message =~ /(?<=\bError building\s).*/) - String matched = match[0] - failedComponents.add(matched.split(' ')[0].split(',')[0].trim()) - } - failedComponents = failedComponents.unique() - for (message in passMessages) { - java.util.regex.Matcher match = (message =~ /(?<=\bSuccessfully built\s).*/) - String matched = match[0] - passedComponents.add(matched.split(' ')[0].trim()) - } - passedComponents = passedComponents.unique() - - for (component in inputManifest.components) { - if (failedComponents.contains(component.name)) { - println("Component ${component.name} failed, creating github issue") - exactComponentFailureMessage = getExactErrorMessage(failureMessages, component.name) - ghIssueBody = """***Received Error***: **${exactComponentFailureMessage}**. - ${component.name} failed during the distribution build for version: ${currentVersion}. - Please see build log at ${env.RUN_DISPLAY_URL}. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details""".stripIndent() - createGithubIssue( - repoUrl: component.repository, - issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", - issueBody: ghIssueBody, - label: "autocut,v${currentVersion}" - ) - } - if (passedComponents.contains(component.name) && !failedComponents.contains(component.name)) { - println("Component ${component.name} passed, closing github issue") - ghIssueBody = """Closing the issue as the distribution build for ${component.name} has passed for version: **${currentVersion}**. - Please see build log at ${env.RUN_DISPLAY_URL}""".stripIndent() - closeGithubIssue( - repoUrl: component.repository, - issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", - closeComment: ghIssueBody, - label: "autocut,v${currentVersion}" - ) - } - sleep(time:3, unit:'SECONDS') - } -} - -def getExactErrorMessage(FailureMessage, componentName) { - for (message in FailureMessage) { - if (message.contains(componentName)) { - return(message) - } - } -} diff --git a/vars/closeBuildSuccessGithubIssue.groovy b/vars/closeBuildSuccessGithubIssue.groovy deleted file mode 100644 index 3adc0fe10..000000000 --- a/vars/closeBuildSuccessGithubIssue.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ - /** Library to close GitHub issue across opensearch-project repositories. - @param Map args = [:] args A map of the following parameters - @param args.message - message retrieved from buildMessage() method. - @param args.search - Filter the logs based on the passed args.search. - @param args.inputManifestPath - Path to input manifest. - */ -void call(Map args = [:]) { - lib = library(identifier: 'jenkins@main', retriever: legacySCM(scm)) - def passMessages = args.message - def queryString = args.search - List passedComponents = [] - for (message in passMessages.unique()) { - java.util.regex.Matcher match = (message =~ /(?<=\b${queryString}\s).*/) - String matched = match[0] - println(matched.split(" ")[0].trim()) - passedComponents.add(matched.split(" ")[0].trim()) - } - - def yamlFile = readYaml(file: args.inputManifestPath) - def currentVersion = yamlFile.build.version - - for (component in yamlFile.components) { - if (passedComponents.contains(component.name)) { - println("Component ${component.name} passed, closing github issue") - ghIssueBody = """Closing the issue as the distribution build for ${component.name} has passed for version: **${currentVersion}**. - Please see build log at ${BUILD_URL}consoleFull""".stripIndent() - closeGithubIssue( - repoUrl: component.repository, - issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", - closeComment: ghIssueBody, - label: "autocut,v${currentVersion}" - ) - sleep(time:3, unit:'SECONDS') - } - } -} diff --git a/vars/createBuildFailureGithubIssue.groovy b/vars/createBuildFailureGithubIssue.groovy deleted file mode 100644 index ead0df916..000000000 --- a/vars/createBuildFailureGithubIssue.groovy +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - /** Library to create GitHub issue across opensearch-project repositories for distribution build failures. - @param Map args = [:] args A map of the following parameters - @param args.message - Failure message retrieved from buildFailureMessage() method. - @param args.inputManifestPath - Path to input manifest. - */ -void call(Map args = [:]) { - lib = library(identifier: 'jenkins@main', retriever: legacySCM(scm)) - def failureMessages = args.message - List failedComponents = [] - - if (failureMessages == null) { - println('No component failed, skip creating github issue.') - } - else { - for (message in failureMessages.unique()) { - java.util.regex.Matcher match = (message =~ /(?<=\bError building\s).*/) - String matched = match[0] - failedComponents.add(matched.split(" ")[0].split(",")[0].trim()) - } - failedComponents = failedComponents.unique() - /* Due to an existing issue with queryWorkbench plugin breaking OSD during bootstrapping, there are false positive - issues getting created against OSD repo. Adding a temp check to ignore issue creation against OSD repo in-case - there are more than 1 failures reported for OSD build. - */ - if (failedComponents.contains('OpenSearch-Dashboards') && failedComponents.size() > 1) { - failedComponents.removeElement('OpenSearch-Dashboards') - } - - def yamlFile = readYaml(file: args.inputManifestPath) - def currentVersion = yamlFile.build.version - - for (component in yamlFile.components) { - if (failedComponents.contains(component.name)) { - println("Component ${component.name} failed, creating github issue") - compIndex = failedComponents.indexOf(component.name) - ghIssueBody = """***Received Error***: **${failureMessages[compIndex]}**. - The distribution build for ${component.name} has failed for version: ${currentVersion}. - Please see build log at ${env.RUN_DISPLAY_URL}. - The failed build stage will be marked as unstable(!). Please see ./build.sh step for more details""".stripIndent() - createGithubIssue( - repoUrl: component.repository, - issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", - issueBody: ghIssueBody, - label: "autocut,v${currentVersion}" - ) - sleep(time:3, unit:'SECONDS') - } - } - } -} diff --git a/vars/publishDistributionBuildResults.groovy b/vars/publishDistributionBuildResults.groovy index a762e2a97..abe833034 100644 --- a/vars/publishDistributionBuildResults.groovy +++ b/vars/publishDistributionBuildResults.groovy @@ -114,6 +114,9 @@ void indexFailedTestData(indexName, testRecordsFile) { "type": "keyword" } } + }, + "aliases": { + "opensearch-distribution-build-results": {} } }' curl -I "${METRICS_HOST_URL}/${indexName}" --aws-sigv4 \"aws:amz:us-east-1:es\" --user \"${awsAccessKey}:${awsSecretKey}\" -H \"x-amz-security-token:${awsSessionToken}\" | grep -E "HTTP\\/[0-9]+(\\.[0-9]+)? 200" diff --git a/vars/updateBuildFailureIssues.groovy b/vars/updateBuildFailureIssues.groovy new file mode 100644 index 000000000..f619ca655 --- /dev/null +++ b/vars/updateBuildFailureIssues.groovy @@ -0,0 +1,77 @@ +/* + * 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. + */ + /** Library to create, update an close GitHub issue across opensearch-project repositories for distribution build failures. + @param Map args = [:] args A map of the following parameters + @param args.inputManifestPath - Path to input manifest. + @param args.distributionBuildNumber - Distribution build number + @param args.buildStartTimeFrom - Start time range to retrieve the documents. Defaults to 'now-6h' + @param ags.buildStartTimeTo - End time range to retrieve the documents. Defaults to 'now' + */ + +import jenkins.ComponentBuildStatus +import jenkins.InputManifest + +void call(Map args = [:]) { + def inputManifest = readYaml(file: args.inputManifestPath) + def currentVersion = inputManifest.build.version + def product = inputManifest.build.name + def buildStartTimeFrom = args.buildStartTimeFrom ?: 'now-6h' + def buildStartTimeTo = args.buildStartTimeTo ?: 'now' + + List failedComponents = [] + List passedComponents = [] + withCredentials([ + string(credentialsId: 'jenkins-health-metrics-account-number', variable: 'METRICS_HOST_ACCOUNT'), + string(credentialsId: 'jenkins-health-metrics-cluster-endpoint', variable: 'METRICS_HOST_URL')]) { + withAWS(role: 'OpenSearchJenkinsAccessRole', roleAccount: "${METRICS_HOST_ACCOUNT}", duration: 900, roleSessionName: 'jenkins-session') { + def metricsUrl = env.METRICS_HOST_URL + def awsAccessKey = env.AWS_ACCESS_KEY_ID + def awsSecretKey = env.AWS_SECRET_ACCESS_KEY + def awsSessionToken = env.AWS_SESSION_TOKEN + def indexName = 'opensearch-distribution-build-results' + + ComponentBuildStatus componentBuildStatus = new ComponentBuildStatus(metricsUrl, awsAccessKey, awsSecretKey, awsSessionToken, indexName, product, currentVersion, args.distributionBuildNumber, buildStartTimeFrom, buildStartTimeTo, this) + + passedComponents = componentBuildStatus.getComponents('passed') + failedComponents = componentBuildStatus.getComponents('failed') + } + } + + failedComponents = failedComponents.unique() + passedComponents = passedComponents.unique() + + for (component in inputManifest.components) { + if (failedComponents.contains(component.name)) { + println("Component ${component.name} failed, creating github issue") + ghIssueBody = """***Build Failed Error***: **${component.name} failed during the distribution build for version: ${currentVersion}.** + Please see build log at ${env.RUN_DISPLAY_URL}. + The failed build stage will be marked as unstable :warning: . Please see ./build.sh step for more details. + Checkout the [wiki](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution) to reproduce the failure locally.""".stripIndent() + createGithubIssue( + repoUrl: component.repository, + issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", + issueBody: ghIssueBody, + label: "autocut,v${currentVersion}", + issueEdit: true + ) + } + if (passedComponents.contains(component.name) && !failedComponents.contains(component.name)) { + println("Component ${component.name} passed, closing github issue") + ghIssueBody = """Closing the issue as the distribution build for ${component.name} has passed for version: **${currentVersion}**. + Please see build log at ${env.RUN_DISPLAY_URL}""".stripIndent() + closeGithubIssue( + repoUrl: component.repository, + issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", + closeComment: ghIssueBody, + label: "autocut,v${currentVersion}" + ) + } + sleep(time:3, unit:'SECONDS') + } +}