我有以下内容Jenkinsfile:
#!groovy
def projectPath = "${projectPath}"
def specPath = "${specPath}"
int numberOfRetries = "${NUM_OF_RETRIES}".toInteger()
def failure = true
def retryAmount = 0
def start = System.currentTimeMillis()
def getSpecName() {
specPath.split("/")[-1].split(".")[0]
}
def getProjectPath() {
projectPath.split("/")[-1]
}
def rmDocker() {
def remove = sh script: "docker rm -f cypress_${getSpecName()}", returnStatus: true
}
stage("Cypress Setup") {
node("Cypress") {
rmDocker()
}
}
stage("Cypress Run") {
node("Cypress") {
currentBuild.setDisplayName("${projectPath} - ${getSpecName()}")
while (failure && retryAmount < numberOfRetries) {
sh "docker pull dockreg.bluestembrands.com/cypresswithtests:latest" …Run Code Online (Sandbox Code Playgroud)