diff --git a/INSTALL.md b/INSTALL.md index 49688ffa2..56edee45a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -192,3 +192,7 @@ it is recommended to run all test suites on all versions of K8s by using the tag ``` [test full] ``` + +### [test] + +If specified, the `[test]` flag will instruct the CI to run all storage providers integration tests. diff --git a/Jenkinsfile b/Jenkinsfile index a1ce4d4fd..bfcb3e6bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,8 +18,7 @@ pipeline { when { branch "PR-*" } steps { script { - pr_number = sh (script: "echo ${env.BRANCH_NAME} | grep -o -E '[0-9]+' ",returnStdout: true) - def json = sh (script: "curl -s https://api.github.com/repos/rook/rook/pulls/${pr_number}", returnStdout: true).trim() + def json = sh (script: "curl -s https://api.github.com/repos/rook/rook/pulls/${env.CHANGE_ID}", returnStdout: true).trim() def draft = evaluateJson(json,'${json.draft}') if (draft.contains("true")) { echo ("This is a draft PR. Aborting") @@ -27,14 +26,14 @@ pipeline { } def body = evaluateJson(json,'${json.body}') if (body.contains("[skip ci]")) { - echo ("'[skip ci]' spotted in PR body text. Aborting.") - env.shouldBuild = "false" + echo ("'[skip ci]' spotted in PR body text. Aborting.") + env.shouldBuild = "false" } if (body.contains("[skip tests]")) { - env.shouldTest = "false" + env.shouldTest = "false" } if (body.contains("[all logs]")) { - env.getLogs = "all" + env.getLogs = "all" } // When running in a PR we assuming it's not an official build @@ -46,6 +45,12 @@ pipeline { env.testArgs = "min-test-matrix" } + // Get changed files + def json_changed_files = sh (script: "curl -s https://api.github.com/repos/rook/rook/pulls/${env.CHANGE_ID}/files", returnStdout: true).trim() + def list = new groovy.json.JsonSlurper().parseText(json_changed_files) + def changed_files = list.filename + echo ("changed files are: ${changed_files}") + // extract which specific storage provider to test if (body.contains("[test cassandra]")) { env.testProvider = "cassandra" @@ -59,7 +64,16 @@ pipeline { env.testProvider = "nfs" } else if (body.contains("[test yugabytedb]")) { env.testProvider = "yugabytedb" + } else if (body.contains("[test]")) { + env.shouldBuild = "true" + } else if (!changed_files.contains(".go") && (changed_files.contains(".md") || changed_files.contains(".yaml") || changed_files.contains(".txt"))) { + echo ("Doc, yaml or text changes detected! Aborting.") + env.shouldBuild = "false" + } else if (!changed_files.contains(".go")) { + echo ("No code changes detected! Just building.") + env.shouldTest = "false" } + echo ("integration test provider: ${env.testProvider}") } }