From 07b17d6a7f9dd4e6c7c0c3e369088df38df38c22 Mon Sep 17 00:00:00 2001 From: Manuele Simi Date: Fri, 30 Aug 2019 16:21:31 -0400 Subject: [PATCH] Access to the workspace with readFileFromWorkspace(). --- Jenkinsfile | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aebf61b..38a7d4a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,19 +3,12 @@ import groovy.io.FileType //locate where this jenkinsfile is -def workspace = SEED_JOB.lastBuild.checkout[0].workspace -def releaseConfigDir = "${workspace}/releases" - -def files = [] -new File(releaseConfigDir).eachFileRecurse (FileType.FILES) { file -> - println file.path -} //check and parse the release file -def inputFile = new File("${releaseConfigDir}/gcube-${params.gCube_release_number}.json") -assert inputFile.exists() : "Release file not found (expected gcube-${params.gCube_release_number}.json)" -assert inputFile.canRead() : "Release file cannot be read" -def gcubeJSON = new JsonSlurper().parseText(inputFile) +def releaseFile = readFileFromWorkspace("gcube-${params.gCube_release_number}.json") +assert releaseFile.exists() : "Release file not found (expected gcube-${params.gCube_release_number}.json)" +assert releaseFile.canRead() : "Release file cannot be read" +def gcubeJSON = new JsonSlurper().parseText(releaseFile) //check that the release number parameter is the one expected assert gcubeJSON["gCube.version"] == params.gCube_release_number : "Release versions do not match!"