Access to the workspace with readFileFromWorkspace().

This commit is contained in:
Manuele Simi 2019-08-30 16:21:31 -04:00
parent 3b9ac54814
commit 07b17d6a7f
1 changed files with 4 additions and 11 deletions

15
Jenkinsfile vendored
View File

@ -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!"