From f54b26d9b58fb90cf738c0c00e9a0530ea0a4365 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 15 Jun 2017 16:27:09 +0200 Subject: [PATCH] build: faster artifacts deploy script * Improves the artifacts deploy script by not cloning the whole history of the build repository (all tags, commits). * Less aggressive failing of the payload task if the previous payload is not uploaded (yet) --- scripts/deploy/publish-build-artifacts.sh | 4 ++-- scripts/deploy/publish-docs-content.sh | 2 +- tools/gulp/tasks/payload.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/deploy/publish-build-artifacts.sh b/scripts/deploy/publish-build-artifacts.sh index 46c48e53f1b9..5adf915e28e8 100755 --- a/scripts/deploy/publish-build-artifacts.sh +++ b/scripts/deploy/publish-build-artifacts.sh @@ -42,8 +42,8 @@ publishPackage() { rm -rf ${repoDir} mkdir -p ${repoDir} - # Clone the repository - git clone ${repoUrl} ${repoDir} + # Clone the repository and only fetch the last commit to download less unused data. + git clone ${repoUrl} ${repoDir} --depth 1 # Copy the build files to the repository rm -rf ${repoDir}/* diff --git a/scripts/deploy/publish-docs-content.sh b/scripts/deploy/publish-docs-content.sh index 621051353462..3778cc6254d9 100755 --- a/scripts/deploy/publish-docs-content.sh +++ b/scripts/deploy/publish-docs-content.sh @@ -25,7 +25,7 @@ commitMessage="$(git log --oneline -n 1)" # create directory and clone test repo rm -rf $repoPath mkdir -p $repoPath -git clone $repoUrl $repoPath +git clone $repoUrl $repoPath --depth 1 # Clean out repo directory and copy contents of dist/docs into it rm -rf $repoPath/* diff --git a/tools/gulp/tasks/payload.ts b/tools/gulp/tasks/payload.ts index ba64119152c8..01ab2f82dd48 100644 --- a/tools/gulp/tasks/payload.ts +++ b/tools/gulp/tasks/payload.ts @@ -146,11 +146,11 @@ async function uploadPayloadResults(database: firebaseAdmin.database.Database, c async function getPayloadResults(database: firebaseAdmin.database.Database, commitSha: string) { const snapshot = await database.ref('payloads').child(commitSha).once('value'); - if (!snapshot.exists()) { - throw `There is no payload data uploaded for SHA ${commitSha}`; + if (snapshot.exists()) { + return snapshot.val(); + } else { + console.error(`There is no payload data uploaded for SHA ${commitSha}`); } - - return snapshot.val(); } /** Gets the SHA of the commit where the payload was uploaded before this Travis Job started. */