diff --git a/jenkins/opensearch/integ-test.jenkinsfile b/jenkins/opensearch/integ-test.jenkinsfile
index f6c90bf5e6..885807c7e5 100644
--- a/jenkins/opensearch/integ-test.jenkinsfile
+++ b/jenkins/opensearch/integ-test.jenkinsfile
@@ -100,7 +100,7 @@ pipeline {
env.artifactPath = buildManifestObj.getArtifactRoot(BUILD_JOB_NAME, buildId)
env.AGENT_LABEL = agent_nodes["${env.platform}_${architecture}"]
env.updateGithubIssues = (params.UPDATE_GITHUB_ISSUES && (env.distribution == 'tar'))
- echo "GitHub issue update is set to : ${env.updateGithubIssues}"
+ echo "GitHub issue update is set to : ${env.updateGithubIssues.toBoolean()}"
}
}
post {
@@ -211,7 +211,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.updateGithubIssues) {
+ if (env.updateGithubIssues.toBoolean()) {
closeGithubIssue(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution",
@@ -223,7 +223,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.updateGithubIssues) {
+ if (env.updateGithubIssues.toBoolean()) {
createGithubIssue(
repoUrl: buildManifestObj.getRepo("${local_component}"),
issueTitle: "[AUTOCUT] Integration Test failed for ${local_component}: ${version} ${distribution} distribution",
diff --git a/tests/jenkins/TestOpenSearchIntegTest.groovy b/tests/jenkins/TestOpenSearchIntegTest.groovy
index ebefb80ff1..f2c8c5d3df 100644
--- a/tests/jenkins/TestOpenSearchIntegTest.groovy
+++ b/tests/jenkins/TestOpenSearchIntegTest.groovy
@@ -12,6 +12,7 @@ import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource
import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString
import static org.hamcrest.CoreMatchers.hasItem
+import static org.hamcrest.CoreMatchers.equalTo
import static org.hamcrest.MatcherAssert.assertThat
import static org.junit.jupiter.api.Assertions.assertThrows
@@ -60,7 +61,6 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
binding.setVariable('RUN_DISPLAY_URL', 'https://some/url/redirect')
binding.setVariable('distribution', 'tar' )
binding.setVariable('COMPONENT_NAME', '' )
- addParam('UPDATE_GITHUB_ISSUES', true)
binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]]
helper.registerAllowedMethod("s3Download", [Map])
helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure ->
@@ -86,6 +86,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
@Test
void integTests_runs_consistently() {
+ addParam('UPDATE_GITHUB_ISSUES', true)
super.testPipeline('jenkins/opensearch/integ-test.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test.jenkinsfile')
assertThat(getCommandExecutions('sh', 'test.sh'), hasItem('env PATH=$PATH JAVA_HOME=/opt/java/openjdk-17 ./test.sh integ-test manifests/tests/jenkins/data/opensearch-3.0.0-test.yml --component k-NN --test-run-id 234 --paths opensearch=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/9010/linux/x64/tar '))
@@ -116,6 +117,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
@Test
void checkGHissueCreation() {
+ addParam('UPDATE_GITHUB_ISSUES', true)
helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script ->
return [stdout: "2023-10-24", exitValue: 0]
}
@@ -136,6 +138,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
@Test
void CheckCloseGHissue() {
+ addParam('UPDATE_GITHUB_ISSUES', true)
helper.addShMock("date -d \"5 days ago\" +'%Y-%m-%d'") { script ->
return [stdout: "2023-10-24", exitValue: 0]
}
@@ -149,6 +152,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
@Test
void checkGHexistingIssue() {
+ addParam('UPDATE_GITHUB_ISSUES', true)
helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script ->
return [stdout: "2023-10-24", exitValue: 0]
}
@@ -162,6 +166,21 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
assertThat(getCommandExecutions('sh', 'script'), hasItem("{script=gh issue comment bbb\nccc --repo https://github.com/opensearch-project/k-NN.git --body \"The integration test failed at distribution level for component k-NN
Version: 3.0.0
Distribution: tar
Architecture: x64
Platform: linux
Please check the logs: https://some/url/redirect
* Test-report manifest:*
- https://ci.opensearch.org/ci/dbc/dummy_job/3.0.0/9010/linux/x64/tar/test-results/234/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)._\", returnStdout=true}"))
}
+ @Test
+ void checkGHIssueDisable() {
+ addParam('COMPONENT_NAME', 'k-NN')
+ helper.addShMock("date -d \"3 days ago\" +'%Y-%m-%d'") { script ->
+ return [stdout: "2023-10-24", exitValue: 0]
+ }
+ helper.addShMock("""env PATH=\$PATH JAVA_HOME=/opt/java/openjdk-17 ./test.sh integ-test manifests/tests/jenkins/data/opensearch-3.0.0-test.yml --component k-NN --test-run-id 234 --paths opensearch=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/9010/linux/x64/tar """) { script ->
+ return [stdout: "Error running integtest for component k-NN, creating Github issue", exitValue: 1]}
+ assertThrows(Exception) {
+ runScript('jenkins/opensearch/integ-test.jenkinsfile')
+ }
+ assertJobStatusFailure()
+ assertThat(getCommandExecutions('sh', 'gh issue').size(), equalTo(0))
+ }
+
def getCommandExecutions(methodName, command) {
def shCommands = helper.callStack.findAll {
call ->