Created
May 26, 2016 16:51
-
-
Save intel352/2c6136f6b997fb9c6a1ef31b8836745e to your computer and use it in GitHub Desktop.
Demandware Jenkinsfile build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
stage 'Checkout' | |
checkout scm | |
env.BUILD_TAG_CLEANED = "${env.BUILD_TAG}".replaceAll(/\%\d[a-zA-Z]/, "-").replaceAll(/[^\w-]+/, "") | |
env.ENABLE_TWO_FACTOR = 'false' | |
env.ENVIRONMENT_INSTANCE = 'dev03' // test build sandbox for branches != develop | |
if (env.BRANCH_NAME == 'develop') { | |
env.ENVIRONMENT_INSTANCE = 'staging' | |
} | |
sh 'printenv' | |
stage 'Node env' | |
sh 'node -v' | |
// since grunt is global install, it's installed on the jenkins server directly | |
//sh 'npm install -g grunt-cli' | |
stage 'Bootstrap Cartridges' | |
dir ('cartridges/') { | |
sh 'npm prune' | |
sh 'npm install' | |
} | |
/*stage 'Lint Cartridges' | |
dir ('cartridges/') { | |
sh 'grunt lint' | |
}*/ | |
/*stage 'Bootstrap Test' | |
dir ('cartridges/') { | |
// since phantom and selenium are global installs, they're installed on the jenkins server directly | |
//sh 'npm install -g phantomjs' | |
//sh 'npm install --production -g selenium-standalone@latest' | |
//sh 'selenium-standalone install' | |
}*/ | |
/*stage 'Execute Tests' | |
dir ('cartridges/') { | |
sh 'selenium-standalone start' | |
sh 'grunt test:unit' | |
//sh 'grunt test:application' | |
}*/ | |
stage 'Bootstrap Buildsuite' | |
dir ('buildsuite/') { | |
sh 'npm prune' | |
sh 'npm install' | |
} | |
stage 'Build' | |
dir ('buildsuite/') { | |
sh 'grunt --no-color build' | |
} | |
stage 'Deploy' | |
dir ('buildsuite/') { | |
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'DWRE_DEPLOY', | |
usernameVariable: 'ENVIRONMENT_USER_NAME', passwordVariable: 'ENVIRONMENT_PASSWORD']]) { | |
sh 'grunt --no-color upload' | |
sh 'grunt --no-color activate' | |
sh 'grunt --no-color http:deleteUpload' | |
} | |
} | |
stage 'Metadata' | |
dir ('buildsuite/') { | |
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'DWRE_DEPLOY', | |
usernameVariable: 'ENVIRONMENT_USER_NAME', passwordVariable: 'ENVIRONMENT_PASSWORD']]) { | |
// Site initialization/configuration import (default source folder: sites/site_template) | |
sh 'grunt --no-color initSite' | |
// Demo site import (default source folder: sites/site_demo) | |
//sh 'grunt initDemoSite' | |
// Complete site import, including demo site (if given) | |
//sh 'grunt importSite' | |
// Metadata import. Metadata is always read from configuration data (default: sites/site_template/meta) | |
//sh 'grunt importMeta' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment