diff --git a/build.gradle b/build.gradle index 47b2bcb7..fde8659f 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,10 @@ configurations.all { 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.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' + force group: 'org.jenkins-ci.plugins', name: 'durable-task', version: '547.vd1ea_007d100c' } } @@ -63,7 +67,7 @@ sourceSets { } sharedLibrary { - coreVersion = '2.387.1' // https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-core/ + coreVersion = '2.426.3' // https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-core/ testHarnessVersion = '2085.va_c531db_287b_d' // https://mvnrepository.com/artifact/org.jenkins-ci.main/jenkins-test-harness?repo=jenkins-releases pluginDependencies { workflowCpsGlobalLibraryPluginVersion = '570.v21311f4951f8' // https://repo.jenkins-ci.org/public/org/jenkins-ci/plugins/workflow/workflow-cps-global-lib/ diff --git a/src/gradlecheck/FetchPostMergeFailedTestName.groovy b/src/gradlecheck/FetchPostMergeFailedTestName.groovy index 25d3856d..1a4d6714 100644 --- a/src/gradlecheck/FetchPostMergeFailedTestName.groovy +++ b/src/gradlecheck/FetchPostMergeFailedTestName.groovy @@ -125,6 +125,6 @@ class FetchPostMergeFailedTestName { } def getPostMergeFailedTestName(testName, gitReference) { - return new OpenSearchMetricsQuery(metricsUrl,awsAccessKey, awsSecretKey, awsSessionToken, script).fetchMetrics(getQuery(testName, gitReference)) + return new OpenSearchMetricsQuery(metricsUrl, awsAccessKey, awsSecretKey, awsSessionToken, script).fetchMetrics(getQuery(testName, gitReference)) } } diff --git a/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy b/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy index 8a2bb011..99f4b212 100644 --- a/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy +++ b/tests/jenkins/TestCreateBuildFailureGithubIssue.groovy @@ -6,6 +6,7 @@ * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ + package jenkins.tests import jenkins.tests.BuildPipelineTest @@ -26,35 +27,19 @@ class TestCreateBuildFailureGithubIssue extends BuildPipelineTest { @Test public void testCreateGithubIssue() { - - helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script -> - return [stdout: "2023-10-24", exitValue: 0] - } - - helper.addShMock("""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" --label autocut,v2.0.0 --json number --jq '.[0].number'""") { script -> - return [stdout: "", exitValue: 0] - } - helper.addShMock("""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:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number'""") { script -> - return [stdout: "", exitValue: 0] - } super.testPipeline('tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile') - assertThat(getCommands('sh', 'create'), hasItem('{script=gh issue create --title \"[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0\" --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\" --label autocut,v2.0.0 --label \"untriaged\" --repo https://github.com/opensearch-project/performance-analyzer.git, returnStdout=true}')) + 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() { - helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script -> - return [stdout: "2023-10-24", exitValue: 0] - } - helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title" --label autocut,v2.0.0 --json number --jq '.[0].number'""") { script -> - return [stdout: "22", exitValue: 0] - } - helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number'""") { script -> - return [stdout: "", exitValue: 0] - } + 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}")) + 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) { diff --git a/tests/jenkins/TestCreateGithubIssue.groovy b/tests/jenkins/TestCreateGithubIssue.groovy index 537c8d0c..d36e9301 100644 --- a/tests/jenkins/TestCreateGithubIssue.groovy +++ b/tests/jenkins/TestCreateGithubIssue.groovy @@ -45,7 +45,7 @@ class TestCreateGithubIssue extends BuildPipelineTest { } super.testPipeline('tests/jenkins/jobs/CreateGithubIssue_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-build --body \"Test GH issue body\", returnStdout=true}")) + assertThat(getCommands('sh', 'script'), hasItem("""{script=gh issue comment bbb\nccc --repo https://github.com/opensearch-project/opensearch-build --body \"Test GH issue body\", returnStdout=true}""")) } void testCreateGithubIssueCreate() { @@ -116,10 +116,9 @@ class TestCreateGithubIssue extends BuildPipelineTest { } super.testPipeline('tests/jenkins/jobs/EditGithubIssue_Jenkinsfile', 'tests/jenkins/jobs/EditGithubIssue_Jenkinsfile_IssueBody') 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/opensearch-build --body-file issueBody.md, returnStdout=true}")) + assertThat(getCommands('sh', 'script'), hasItem("""{script=gh issue edit bbb\nccc --repo https://github.com/opensearch-project/opensearch-build --body-file issueBody.md, returnStdout=true}""")) } - def getCommands(method, text) { def shCommands = helper.callStack.findAll { call -> call.methodName == method diff --git a/tests/jenkins/TestUpdateBuildFailuresIssues.groovy b/tests/jenkins/TestUpdateBuildFailuresIssues.groovy index f49880c9..681dea8d 100644 --- a/tests/jenkins/TestUpdateBuildFailuresIssues.groovy +++ b/tests/jenkins/TestUpdateBuildFailuresIssues.groovy @@ -25,22 +25,6 @@ class TestUpdateBuildFailuresIssues extends BuildPipelineTest { super.setUp() } - @Test - public void testCreateGithubIssue() { - helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script -> - return [stdout: "2023-10-24", 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" --label autocut,v2.2.0 --json number --jq '.[0].number'""") { script -> - return [stdout: "", 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] - } - super.testPipeline('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') - assertThat(getCommands('sh', 'create'), hasItem('{script=gh issue create --title \"[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0\" --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\" --label autocut,v2.2.0 --label \"untriaged\" --repo https://github.com/opensearch-project/asynchronous-search.git, returnStdout=true}')) - } - @Test public void testCommentOnExistingGithubIssue() { helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script -> @@ -54,7 +38,7 @@ class TestUpdateBuildFailuresIssues extends BuildPipelineTest { } 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 22 --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}")) + 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}")) } @Test @@ -79,8 +63,8 @@ class TestUpdateBuildFailuresIssues extends BuildPipelineTest { return [stdout: "20", exitValue: 0] } runScript('tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile') - assertThat(getCommands('sh', 'notifications'), not(hasItem("{script=gh issue close 20 -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 20 --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', '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}")) } def getCommands(method, text) { diff --git a/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt b/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt index 9db1dd05..6b24ea38 100644 --- a/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt +++ b/tests/jenkins/jobs/CreateBuildFailureGithubExistingIssueCheck_Jenkinsfile.txt @@ -13,9 +13,10 @@ 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" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/OpenSearch.git --body "***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. @@ -29,9 +30,10 @@ ccc --repo https://github.com/opensearch-project/OpenSearch.git --body "***Recei 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" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/geospatial.git -S "[AUTOCUT] Distribution Build Failed for geospatial-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/geospatial.git --body "***Received Error***: **Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial**. @@ -45,9 +47,10 @@ ccc --repo https://github.com/opensearch-project/geospatial.git --body "***Recei 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" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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**. diff --git a/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt b/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt index 105a928e..6b24ea38 100644 --- a/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt +++ b/tests/jenkins/jobs/CreateBuildFailureGithubIssue_Jenkinsfile.txt @@ -13,9 +13,10 @@ 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" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/OpenSearch.git -S "[AUTOCUT] Distribution Build Failed for OpenSearch-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/OpenSearch.git --body "***Received Error***: **Error building OpenSearch, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component OpenSearch --snapshot**. @@ -29,9 +30,10 @@ ccc --repo https://github.com/opensearch-project/OpenSearch.git --body "***Recei 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" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/geospatial.git -S "[AUTOCUT] Distribution Build Failed for geospatial-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/geospatial.git --body "***Received Error***: **Error building geospatial, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component geospatial**. @@ -45,12 +47,14 @@ ccc --repo https://github.com/opensearch-project/geospatial.git --body "***Recei 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" --label autocut,v2.0.0 --json number --jq '.[0].number', 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" --label "autocut,v2.0.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/performance-analyzer.git -S "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0 in:title is:closed closed:>=2023-10-24" --label autocut,v2.0.0 --json number --jq '.[0].number', returnStdout=true}) - createGithubIssue.println(Creating new issue) - createGithubIssue.sh({script=gh issue create --title "[AUTOCUT] Distribution Build Failed for performance-analyzer-2.0.0" --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**. + 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" --label "autocut,v2.0.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**. 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 --label "untriaged" --repo https://github.com/opensearch-project/performance-analyzer.git, returnStdout=true}) + 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/CreateGithubIssue_Jenkinsfile.txt b/tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile.txt index 48c7d914..e0a317c0 100644 --- a/tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile.txt +++ b/tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile.txt @@ -12,4 +12,3 @@ createGithubIssue.println(Issue already exists, adding a comment) createGithubIssue.sh({script=gh issue comment bbb ccc --repo https://github.com/opensearch-project/opensearch-build --body "Test GH issue body", returnStdout=true}) - diff --git a/tests/jenkins/jobs/EditGithubIssue_Jenkinsfile_IssueBody.txt b/tests/jenkins/jobs/EditGithubIssue_Jenkinsfile_IssueBody.txt index c0a1df78..f8632b7a 100644 --- a/tests/jenkins/jobs/EditGithubIssue_Jenkinsfile_IssueBody.txt +++ b/tests/jenkins/jobs/EditGithubIssue_Jenkinsfile_IssueBody.txt @@ -13,4 +13,3 @@ ccc" --label "label101" --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/opensearch-build --body-file issueBody.md, returnStdout=true}) - diff --git a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt index 94af1229..0231533b 100644 --- a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt +++ b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt @@ -14,9 +14,9 @@ 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/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/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=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.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**. @@ -32,9 +32,9 @@ ccc --repo https://github.com/opensearch-project/common-utils.git --body "***Rec 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/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/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=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.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**. @@ -53,9 +53,9 @@ ccc --repo https://github.com/opensearch-project/performance-analyzer.git --body 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=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.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**. @@ -69,9 +69,9 @@ ccc --repo https://github.com/opensearch-project/notifications.git --body "***Re 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=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.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**. @@ -85,14 +85,15 @@ ccc --repo https://github.com/opensearch-project/anomaly-detection.git --body "* 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=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(Creating new issue) - createGithubIssue.sh({script=gh issue create --title "[AUTOCUT] Distribution Build Failed for asynchronous-search-2.2.0" --body "***Received Error***: **Error building asynchronous-search, retry with: ./build.sh manifests/2.2.0/opensearch-2.2.0.yml --component asynchronous-search**. + 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" --label autocut,v2.2.0 --label "untriaged" --repo https://github.com/opensearch-project/asynchronous-search.git, returnStdout=true}) + 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**. @@ -115,3 +116,4 @@ ccc -R opensearch-project/sql --comment "Closing the issue as the distribution b UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) UpdateBuildFailureIssues.sleep({time=3, unit=SECONDS}) + diff --git a/vars/createGithubIssue.groovy b/vars/createGithubIssue.groovy index 70af3557..1fec0013 100644 --- a/vars/createGithubIssue.groovy +++ b/vars/createGithubIssue.groovy @@ -24,7 +24,7 @@ void call(Map args = [:]) { try { withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { def openIssue = sh( - script: "gh issue list --repo ${args.repoUrl} -S \"${args.issueTitle} in:title\" --label \"${label}\" --json number --jq '.[0].number'", + script: "gh issue list --repo ${args.repoUrl} -S \"${args.issueTitle} in:title\" --json number --jq '.[0].number'", returnStdout: true ).trim() @@ -34,7 +34,7 @@ void call(Map args = [:]) { ).trim() def closedIssue = sh( - script: "gh issue list --repo ${args.repoUrl} -S \"${args.issueTitle} in:title is:closed closed:>=${currentDayMinusDaysToReOpen}\" --label \"${label}\" --json number --jq '.[0].number'", + script: "gh issue list --repo ${args.repoUrl} -S \"${args.issueTitle} in:title is:closed closed:>=${currentDayMinusDaysToReOpen}\" --json number --jq '.[0].number'", returnStdout: true ).trim() diff --git a/vars/gradleCheckFlakyTestIssueCreate.groovy b/vars/gradleCheckFlakyTestChecker.groovy similarity index 100% rename from vars/gradleCheckFlakyTestIssueCreate.groovy rename to vars/gradleCheckFlakyTestChecker.groovy