Skip to content

Commit

Permalink
ci: use testCurl
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelchanrion committed Sep 25, 2019
1 parent e5ed567 commit e7404f0
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions Jenkinsfile
@@ -1,9 +1,6 @@
#!groovy
@Library('Utilities') _

DEPLOY_APP_STAGING = "staging"
DEPLOY_APP_PRODUCTION = "production"

pipeline {
agent { label 'clevercloud-node-builder' }

Expand Down Expand Up @@ -61,18 +58,7 @@ pipeline {
timeout(5) {
waitUntil {
script {
def status = sh script: "curl -I -s localhost:${PORT}", returnStatus: true
// If status == 0, it has deployed. If status == 7, connection refused. If status <> 0 && <> 7, error
if(status == 0) {
echo "Curl succeeded"
return true;
} else if(status == 7) {
echo "Curl got a connection refused, waiting.."
return false;
} else {
error "Curl exit code: " + status
return null;
}
testCurl("localhost:${PORT}")
}
}
}
Expand Down Expand Up @@ -136,10 +122,10 @@ def isProduction() {

def getDeployApp() {
if (isStaging()) {
return DEPLOY_APP_STAGING
return 'staging'
}
if (isProduction()) {
return DEPLOY_APP_PRODUCTION
return 'production'
}
return null
}

0 comments on commit e7404f0

Please sign in to comment.