From c59419715480e52cda9e98399efdd396ad8e5f21 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:12:34 -0700 Subject: [PATCH] [Backport 7.x] Remove labels arg for closing GH issue (#533) Signed-off-by: Sayali Gaikawad Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- build.gradle | 2 +- tests/jenkins/TestCloseGithubIssue.groovy | 3 +-- tests/jenkins/jobs/CloseGithubIssue_JenkinsFile | 3 +-- tests/jenkins/jobs/CloseGithubIssue_JenkinsFile.txt | 2 +- .../jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt | 2 +- .../jenkins/lib-testers/CloseGithubIssueLibTester.groovy | 8 ++------ vars/closeGithubIssue.groovy | 2 -- vars/updateBuildFailureIssues.groovy | 3 +-- 8 files changed, 8 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index c39bc07a5..60d798156 100644 --- a/build.gradle +++ b/build.gradle @@ -128,7 +128,7 @@ jacocoTestReport { } } -String version = '7.0.1' +String version = '7.1.0' task updateVersion { doLast { diff --git a/tests/jenkins/TestCloseGithubIssue.groovy b/tests/jenkins/TestCloseGithubIssue.groovy index dddff6c26..d589cc934 100644 --- a/tests/jenkins/TestCloseGithubIssue.groovy +++ b/tests/jenkins/TestCloseGithubIssue.groovy @@ -29,8 +29,7 @@ class TestCloseGithubIssue extends BuildPipelineTest { this.registerLibTester(new CloseGithubIssueLibTester( 'https://github.com/opensearch-project/opensearch-build', 'Test GH issue title', - 'Test GH issue close comment', - 'label101', + 'Test GH issue close comment' )) super.testPipeline("tests/jenkins/jobs/CloseGithubIssue_JenkinsFile") assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue list --repo https://github.com/opensearch-project/opensearch-build -S \"Test GH issue title in:title\" --json number --jq '.[0].number', returnStdout=true}")) diff --git a/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile b/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile index e8e313011..414141cf7 100644 --- a/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile +++ b/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile @@ -16,8 +16,7 @@ pipeline { closeGithubIssue( repoUrl: 'https://github.com/opensearch-project/opensearch-build', issueTitle: 'Test GH issue title', - closeComment: 'Test GH issue close comment', - label: 'label101' + closeComment: 'Test GH issue close comment' ) } } diff --git a/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile.txt b/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile.txt index b636bc404..192e25ddc 100644 --- a/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile.txt +++ b/tests/jenkins/jobs/CloseGithubIssue_JenkinsFile.txt @@ -3,7 +3,7 @@ CloseGithubIssue_JenkinsFile.echo(Executing on agent [label:none]) CloseGithubIssue_JenkinsFile.stage(closeGithubIssue, groovy.lang.Closure) CloseGithubIssue_JenkinsFile.script(groovy.lang.Closure) - CloseGithubIssue_JenkinsFile.closeGithubIssue({repoUrl=https://github.com/opensearch-project/opensearch-build, issueTitle=Test GH issue title, closeComment=Test GH issue close comment, label=label101}) + CloseGithubIssue_JenkinsFile.closeGithubIssue({repoUrl=https://github.com/opensearch-project/opensearch-build, issueTitle=Test GH issue title, closeComment=Test GH issue close comment}) 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-build -S "Test GH issue title in:title" --json number --jq '.[0].number', returnStdout=true}) diff --git a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt index f3b404d95..7bb4d57a9 100644 --- a/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt +++ b/tests/jenkins/jobs/UpdateBuildFailureIssue_Jenkinsfile.txt @@ -60,7 +60,7 @@ ccc --repo https://github.com/opensearch-project/asynchronous-search.git --body 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.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}) + Please see build log at www.example.com/job/build_url/32/display/redirect}) 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" --json number --jq '.[0].number', returnStdout=true}) diff --git a/tests/jenkins/lib-testers/CloseGithubIssueLibTester.groovy b/tests/jenkins/lib-testers/CloseGithubIssueLibTester.groovy index 9ef114e2c..dadd05055 100644 --- a/tests/jenkins/lib-testers/CloseGithubIssueLibTester.groovy +++ b/tests/jenkins/lib-testers/CloseGithubIssueLibTester.groovy @@ -15,13 +15,11 @@ class CloseGithubIssueLibTester extends LibFunctionTester { private String repoUrl private String issueTitle private String closeComment - private String label - public CloseGithubIssueLibTester(repoUrl, issueTitle, closeComment, label){ + public CloseGithubIssueLibTester(repoUrl, issueTitle, closeComment){ this.repoUrl = repoUrl this.issueTitle = issueTitle this.closeComment = closeComment - this.label = label } @@ -35,13 +33,11 @@ class CloseGithubIssueLibTester extends LibFunctionTester { assertThat(call.args.repoUrl.first(), notNullValue()) assertThat(call.args.issueTitle.first(), notNullValue()) assertThat(call.args.closeComment.first(), notNullValue()) - assertThat(call.args.label.first(), notNullValue()) } @Override boolean expectedParametersMatcher(Object call) { - return call.args.label.first().equals(this.label) - && call.args.repoUrl.first().equals(this.repoUrl) + return call.args.repoUrl.first().equals(this.repoUrl) && call.args.issueTitle.first().equals(this.issueTitle) && call.args.closeComment.first().equals(this.closeComment) } diff --git a/vars/closeGithubIssue.groovy b/vars/closeGithubIssue.groovy index 2cc7c4818..b6868573e 100644 --- a/vars/closeGithubIssue.groovy +++ b/vars/closeGithubIssue.groovy @@ -12,10 +12,8 @@ @param args.repoUrl - GitHub repository URL to create issue @param args.issueTitle - GitHub issue title @param args.closeComment - GitHub issue leave a closing comment - @param args.label - GitHub issue label to be attached along with 'untriaged'. Defaults to autocut. */ void call(Map args = [:]) { - label = args.label ?: 'autocut' try { withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { def issuesNumber = sh( diff --git a/vars/updateBuildFailureIssues.groovy b/vars/updateBuildFailureIssues.groovy index 050499786..6389d8670 100644 --- a/vars/updateBuildFailureIssues.groovy +++ b/vars/updateBuildFailureIssues.groovy @@ -70,8 +70,7 @@ void call(Map args = [:]) { closeGithubIssue( repoUrl: component.repository, issueTitle: "[AUTOCUT] Distribution Build Failed for ${component.name}-${currentVersion}", - closeComment: ghIssueBody, - label: "autocut,v${currentVersion}" + closeComment: ghIssueBody ) sleep(time:3, unit:'SECONDS') }