From 634fb5146e4f77a70a6a1cf24769f8e425000648 Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
Date: Thu, 12 Jul 2018 23:28:12 +0000
Subject: [PATCH] Move s3 commands back into build script

---
 Jenkinsfile                   | 8 +-------
 scripts/hab-build-and-push.sh | 3 +++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 4259b9a52..2d58fbd74 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -34,15 +34,9 @@ pipeline {
           def baseAssetsPath = "https://assets-dev.reticium.io/"
           def assetBundleServer = "https://assets-bundles-dev.reticium.io/"
           def s3Destination = "s3://assets.reticulum-dev-7f8d39c45878ee2e/hubs"
-          def s3AssetsDestination = "${s3Destination}/assets"
-          def s3PagesDestination = "${s3Destination}/pages"
-
-          def habCommand = "sudo /usr/bin/hab-docker-studio -k mozillareality run /bin/bash scripts/hab-build-and-push.sh ${baseAssetsPath} ${assetBundleServer}"
+          def habCommand = "sudo /usr/bin/hab-docker-studio -k mozillareality run /bin/bash scripts/hab-build-and-push.sh ${baseAssetsPath} ${assetBundleServer} ${s3Destination}"
 
           sh "/usr/bin/script --return -c ${shellString(habCommand)} /dev/null"
-
-          sh "aws s3 sync --acl public-read --cache-control max-age=31556926 build/assets ${shellString(s3AssetsDestination)}"
-          sh "aws s3 sync --acl public-read --cache-control no-cache --delete build/pages ${shellString(s3PagesDestination)}"
         }
       }
     }
diff --git a/scripts/hab-build-and-push.sh b/scripts/hab-build-and-push.sh
index 672d70a43..fd3a4e9a6 100755
--- a/scripts/hab-build-and-push.sh
+++ b/scripts/hab-build-and-push.sh
@@ -29,3 +29,6 @@ yarn install --cache-folder .yarn
 GENERATE_SMOKE_TESTS=true yarn build --output-path build
 mkdir build/pages
 mv build/*.html build/pages
+
+aws s3 sync --acl public-read --cache-control "max-age=31556926" build/assets "$TARGET_S3_PATH/assets"
+aws s3 sync --acl public-read --cache-control "no-cache" --delete build/pages "$TARGET_S3_PATH/pages"
-- 
GitLab