1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-11-24 08:32:32 +02:00

Prepare consumer tests for being tested in Actions (#1369)

This commit is contained in:
Daniel Kurzynski 2020-04-09 13:04:10 +02:00 committed by GitHub
parent b32214ee78
commit 6d5b634278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ START_TIME_MS = System.currentTimeMillis()
WORKSPACES_ROOT = 'workspaces'
TEST_CASES_DIR = 'testCases'
LIBRARY_VERSION_UNDER_TEST = "git log --format=%H -n 1".execute().text.trim()
REPOSITORY_UNDER_TEST = System.getenv('REPOSITORY_UNDER_TEST') ?: System.getenv('TRAVIS_REPO_SLUG') ?: 'SAP/jenkins-library'
EXCLUDED_FROM_CONSUMER_TESTING_REGEXES = [
/^documentation\/.*$/,
@ -20,7 +21,7 @@ EXCLUDED_FROM_CONSUMER_TESTING_REGEXES = [
newEmptyDir(WORKSPACES_ROOT)
TestRunnerThread.workspacesRootDir = WORKSPACES_ROOT
TestRunnerThread.libraryVersionUnderTest = LIBRARY_VERSION_UNDER_TEST
TestRunnerThread.repositoryUnderTest = System.getenv('TRAVIS_REPO_SLUG') ?: 'SAP/jenkins-library'
TestRunnerThread.repositoryUnderTest = REPOSITORY_UNDER_TEST
def testCaseThreads
def cli = new CliBuilder(
@ -57,7 +58,7 @@ if (!RUNNING_LOCALLY) {
The commit which we need for notifying about a build status is in this case simply
TRAVIS_COMMIT itself.
*/
COMMIT_HASH = System.getenv('TRAVIS_PULL_REQUEST_SHA') ?: System.getenv('TRAVIS_COMMIT')
COMMIT_HASH = System.getenv('TRAVIS_PULL_REQUEST_SHA') ?: System.getenv('TRAVIS_COMMIT') ?: LIBRARY_VERSION_UNDER_TEST
if (changeDoesNotNeedConsumerTesting()) {
println 'No consumer tests necessary.'
@ -171,7 +172,7 @@ def notifyGithub(state, description) {
def postBody = [
state : state,
target_url : System.getenv('TRAVIS_BUILD_WEB_URL'),
target_url : System.getenv('TRAVIS_BUILD_WEB_URL') ?: System.getenv('BUILD_WEB_URL'),
description: description,
context : "integration-tests"
]
@ -191,7 +192,8 @@ def notifyGithub(state, description) {
}
def changeDoesNotNeedConsumerTesting() {
if (System.getenv('TRAVIS_BRANCH') == 'master') {
def branchName = System.getenv('TRAVIS_BRANCH') ?: System.getenv('BRANCH_NAME')
if (branchName == 'master') {
return false
}