Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node {
- githubCheckout()
- githubOnlyStage 'install npm deps', {
- shell 'npm install'
- }
- s3PublishOpsAssets([
- 'deploy/immunio-deploy.yaml',
- ])
- stash name: 'node_modules', includes: 'node_modules/**'
- }
- def builds = [:]
- builds['unit tests'] = {
- node {
- githubCheckout()
- unstash 'node_modules'
- githubOnlyStage 'unit tests', {
- withSauceCredentials {
- shell 'npm run test-headless'
- }
- }
- }
- }
- builds['e2e tests (debug)'] = {
- node {
- githubCheckout()
- unstash 'node_modules'
- githubOnlyStage 'e2e tests (debug)', {
- withSauceCredentials {
- shell 'bash -x test-config/jenkins.sh e2e-headless'
- }
- }
- publishWwwAssets('debug')
- }
- }
- builds['e2e tests (prod)'] = {
- node {
- githubCheckout()
- unstash 'node_modules'
- githubOnlyStage 'e2e tests (prod)', {
- withSauceCredentials {
- shell 'bash -x test-config/jenkins.sh e2e-headless:prod'
- }
- }
- publishWwwAssets('prod')
- }
- }
- stage 'build in parallel'
- parallel builds
- stage 'publish'
- node {
- githubCheckout()
- publishBuildManifest([])
- }
- def publishWwwAssets(target) {
- def buildDir = "build/${target}"
- shell """
- mkdir -p ${buildDir}
- cp -a www ${buildDir}
- """
- archive "${buildDir}/www/**/*.*"
- def deployBucket = "build.us-west-2.immun.io"
- def assetDir = "${env.JOB_NAME.tokenize('/')[1]}/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/dashboard_files/${target}"
- def s3Url = "s3://${deployBucket}/${assetDir}"
- echo "Uploading assets to ${s3Url}"
- withAwsOpsCredentials {
- shell """
- aws --region us-west-2 s3 cp www/ ${s3Url} --recursive --exclude index.html
- aws --region us-west-2 s3 cp www/index.html ${s3Url}/index.html --cache-control max-age=0
- """
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement