From c70ce17d73cbfc7bbf6b7829569d58eea4cce198 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Thu, 4 Jan 2024 15:30:00 -0600 Subject: [PATCH] Default not to create/update issues during integration test runs (#4323) Signed-off-by: Peter Nied --- .../distribution-build.jenkinsfile | 6 ++++-- jenkins/opensearch-dashboards/integ-test.jenkinsfile | 10 ++++++++-- jenkins/opensearch/distribution-build.jenkinsfile | 6 ++++-- jenkins/opensearch/integ-test.jenkinsfile | 10 ++++++++-- tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy | 1 + tests/jenkins/TestOpenSearchIntegTest.groovy | 1 + 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/jenkins/opensearch-dashboards/distribution-build.jenkinsfile b/jenkins/opensearch-dashboards/distribution-build.jenkinsfile index a0e84156ef..02d2f72f06 100644 --- a/jenkins/opensearch-dashboards/distribution-build.jenkinsfile +++ b/jenkins/opensearch-dashboards/distribution-build.jenkinsfile @@ -201,7 +201,8 @@ pipeline { parameters: [ string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), - string(name: 'BUILD_MANIFEST_URL_OPENSEARCH', value: buildManifestUrlOpenSearch) + string(name: 'BUILD_MANIFEST_URL_OPENSEARCH', value: buildManifestUrlOpenSearch), + booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true) ] } }, @@ -527,7 +528,8 @@ pipeline { parameters: [ string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), - string(name: 'BUILD_MANIFEST_URL_OPENSEARCH', value: buildManifestUrlOpenSearch) + string(name: 'BUILD_MANIFEST_URL_OPENSEARCH', value: buildManifestUrlOpenSearch), + booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true) ] } }, diff --git a/jenkins/opensearch-dashboards/integ-test.jenkinsfile b/jenkins/opensearch-dashboards/integ-test.jenkinsfile index 1843ddc8c5..2fb9317899 100644 --- a/jenkins/opensearch-dashboards/integ-test.jenkinsfile +++ b/jenkins/opensearch-dashboards/integ-test.jenkinsfile @@ -67,6 +67,11 @@ pipeline { description: 'The build manifest URL OpenSearch, e.g. "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.9.0/8172/linux/x64/tar/builds/opensearch/manifest.yml".', trim: true ) + booleanParam( + name: 'UPDATE_GITHUB_ISSUES', + description: 'If true results will create / update / close github issues', + defaultValue: false + ) } stages { stage('verify-parameters') { @@ -111,6 +116,7 @@ pipeline { env.artifactPath = buildManifestObj.getArtifactRoot(BUILD_JOB_NAME, buildId) env.artifactPathOpenSearch = buildManifestObjOpenSearch.getArtifactRoot(BUILD_JOB_NAME_OPENSEARCH, buildIdOpenSearch) env.AGENT_LABEL = agent_nodes["${env.platform}_${architecture}"] + env.updateGithubIssues = UPDATE_GITHUB_ISSUES && env.distribution == 'tar' echo "Version: ${version}, VersionOpenSearch: ${versionOpenSearch}, Agent: ${AGENT_LABEL}, OSD_BuildId: ${buildId}, OS_BuildId: ${buildIdOpenSearch}, Distribution: ${distribution}" currentBuild.description = "$architecture, $platform, osd-$version-$buildId, os-$versionOpenSearch-$buildIdOpenSearch, $distribution" @@ -250,7 +256,7 @@ pipeline { switchUserNonRoot: "${switch_user_non_root}" ) String closeCommentMessage = "Closing the issue as the Integration Test passed for ${local_component}
Version: ${version}
Distribution: ${distribution}
Architecture: ${architecture}
Platform: ${platform}

Please check the logs: ${RUN_DISPLAY_URL}

*" - if (env.distribution == 'tar') { + if (env.updateGithubIssues) { closeGithubIssue( repoUrl: buildManifestObj.getRepo("${local_component}"), issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution", @@ -262,7 +268,7 @@ pipeline { } catch (e) { echo "Error running integtest for component ${local_component}, creating Github issue" String issueBodyMessage = "The integration test failed at distribution level for component ${local_component}
Version: ${version}
Distribution: ${distribution}
Architecture: ${architecture}
Platform: ${platform}

Please check the logs: ${RUN_DISPLAY_URL}

* Test-report manifest:*
- https://ci.opensearch.org/ci/dbc/${JOB_NAME}/${version}/${buildId}/${platform}/${architecture}/${distribution}/test-results/${BUILD_NUMBER}/integ-test/test-report.yml

_Note: Steps to reproduce, additional logs and other files can be found within the above test-report manifest.
Instructions of this test-report manifest can be found [here](https://github.com/opensearch-project/opensearch-build/tree/main/src/report_workflow#guide-on-test-report-manifest-from-ci)._" - if (env.distribution == 'tar') { + if (env.updateGithubIssues) { createGithubIssue( repoUrl: buildManifestObj.getRepo("${local_component}"), issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution", diff --git a/jenkins/opensearch/distribution-build.jenkinsfile b/jenkins/opensearch/distribution-build.jenkinsfile index eae0e9ed0c..8832c9d520 100644 --- a/jenkins/opensearch/distribution-build.jenkinsfile +++ b/jenkins/opensearch/distribution-build.jenkinsfile @@ -190,7 +190,8 @@ pipeline { wait: false, parameters: [ string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), - string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl) + string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), + booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true) ] } }, @@ -456,7 +457,8 @@ pipeline { wait: false, parameters: [ string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), - string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl) + string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), + booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true) ] } } diff --git a/jenkins/opensearch/integ-test.jenkinsfile b/jenkins/opensearch/integ-test.jenkinsfile index 6cf8dae499..72426644d4 100644 --- a/jenkins/opensearch/integ-test.jenkinsfile +++ b/jenkins/opensearch/integ-test.jenkinsfile @@ -66,6 +66,11 @@ pipeline { description: 'The build manifest URL for OpenSearch, e.g. "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.9.0/8172/linux/x64/tar/builds/opensearch/manifest.yml".', trim: true ) + booleanParam( + name: 'UPDATE_GITHUB_ISSUES', + description: 'If true results will create / update / close github issues', + defaultValue: false + ) } stages { stage('verify-parameters') { @@ -97,6 +102,7 @@ pipeline { env.platform = buildManifestObj.build.platform env.artifactPath = buildManifestObj.getArtifactRoot(BUILD_JOB_NAME, buildId) env.AGENT_LABEL = agent_nodes["${env.platform}_${architecture}"] + env.updateGithubIssues = UPDATE_GITHUB_ISSUES && env.distribution == 'tar' echo "Version: ${version}, Agent: ${AGENT_LABEL}, BuildId: ${buildId}, Distribution: ${distribution}, Components: ${componentList}" currentBuild.description = "$TEST_MANIFEST, $version, $architecture, $platform, $buildId, $distribution, $componentList" @@ -206,7 +212,7 @@ pipeline { switchUserNonRoot: "${switch_user_non_root}" ) String closeCommentMessage = "Closing the issue as the Integration Test passed for ${local_component}
Version: ${version}
Distribution: ${distribution}
Architecture: ${architecture}
Platform: ${platform}

Please check the logs: ${RUN_DISPLAY_URL}

*" - if (env.distribution == 'tar') { + if (env.updateGithubIssues) { closeGithubIssue( repoUrl: buildManifestObj.getRepo("${local_component}"), issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution", @@ -218,7 +224,7 @@ pipeline { } catch (e) { echo "Error running integtest for component ${local_component}, creating Github issue" String issueBodyMessage = "The integration test failed at distribution level for component ${local_component}
Version: ${version}
Distribution: ${distribution}
Architecture: ${architecture}
Platform: ${platform}

Please check the logs: ${RUN_DISPLAY_URL}

* Test-report manifest:*
- https://ci.opensearch.org/ci/dbc/${JOB_NAME}/${version}/${buildId}/${platform}/${architecture}/${distribution}/test-results/${BUILD_NUMBER}/integ-test/test-report.yml

_Note: Steps to reproduce, additional logs and other files can be found within the above test-report manifest.
Instructions of this test-report manifest can be found [here](https://github.com/opensearch-project/opensearch-build/tree/main/src/report_workflow#guide-on-test-report-manifest-from-ci)._" - if (env.distribution == 'tar') { + if (env.updateGithubIssues) { createGithubIssue( repoUrl: buildManifestObj.getRepo("${local_component}"), issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution", diff --git a/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy b/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy index 78472f9913..54acd0ff2a 100644 --- a/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy +++ b/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy @@ -68,6 +68,7 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest { binding.setVariable('distribution', 'tar' ) binding.setVariable('COMPONENT_NAME', '' ) binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]] + binding.setVariable('UPDATE_GITHUB_ISSUES', true) def env = binding.getVariable('env') env['DOCKER_AGENT'] = [image:'opensearchstaging/opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2', args:'-e JAVA_HOME=/opt/java/openjdk-11'] env['PUBLIC_ARTIFACT_URL'] = 'DUMMY_PUBLIC_ARTIFACT_URL' diff --git a/tests/jenkins/TestOpenSearchIntegTest.groovy b/tests/jenkins/TestOpenSearchIntegTest.groovy index 11d3b6bc54..fef0be2f89 100644 --- a/tests/jenkins/TestOpenSearchIntegTest.groovy +++ b/tests/jenkins/TestOpenSearchIntegTest.groovy @@ -61,6 +61,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest { binding.setVariable('RUN_DISPLAY_URL', 'https://some/url/redirect') binding.setVariable('distribution', 'tar' ) binding.setVariable('COMPONENT_NAME', '' ) + binding.setVariable('UPDATE_GITHUB_ISSUES', true) binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]] helper.registerAllowedMethod("s3Download", [Map]) helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure ->