diff --git a/Jenkinsfile b/Jenkinsfile index 8844d357d0bc6039dac5006f6d43ab3f48c87bb4..5951a3a73926717b32d52927973e298a09cff5c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { def smokeURL = env.SMOKE_URL def slackURL = env.SLACK_URL - def habCommand = "sudo /usr/bin/hab-docker-studio -k mozillareality run /bin/bash scripts/hab-build-and-push.sh ${baseAssetsPath} ${assetBundleServer} ${targetS3Url} ${env.BUILD_NUMBER}" + def habCommand = "sudo /usr/bin/hab-docker-studio -k mozillareality run /bin/bash scripts/hab-build-and-push.sh ${baseAssetsPath} ${assetBundleServer} ${targetS3Url} ${env.BUILD_NUMBER} ${env.GIT_COMMIT}" sh "/usr/bin/script --return -c ${shellString(habCommand)} /dev/null" def gitMessage = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'[%an] %s'").trim() diff --git a/scripts/hab-build-and-push.sh b/scripts/hab-build-and-push.sh index 2f04c0a26fd57505bfd508de05b56e920e947b37..f890d0e053a95860c5d758a5288c451ac7bc89f1 100755 --- a/scripts/hab-build-and-push.sh +++ b/scripts/hab-build-and-push.sh @@ -3,7 +3,9 @@ export BASE_ASSETS_PATH=$1 export ASSET_BUNDLE_SERVER=$2 export TARGET_S3_URL=$3 -export BUILD_VERSION=$4 +export BUILD_NUMBER=$4 +export GIT_COMMIT=$5 +export BUILD_VERSION="${BUILD_NUMBER} (${GIT_COMMIT})" # To build + push to S3 run: # hab studio run "bash scripts/hab-build-and-push.sh" diff --git a/src/hub.js b/src/hub.js index 06c38f5181e2dda8b97307afd2bb0e8fd73698a3..51419d8d636cf18e1c4e292dade6146e156d0ff3 100644 --- a/src/hub.js +++ b/src/hub.js @@ -1,3 +1,5 @@ +console.log(`Hubs version: ${process.env.BUILD_VERSION || "?"}`); + import "./assets/stylesheets/hub.scss"; import queryString from "query-string"; @@ -431,11 +433,14 @@ const onReady = async () => { return; } - if (qs.required_version && qs.required_version !== process.env.BUILD_VERSION) { - remountUI({ roomUnavailableReason: "version_mismatch" }); - setTimeout(() => document.location.reload(), 5000); - exitScene(); - return; + if (qs.required_version && process.env.BUILD_VERSION) { + const buildNumber = process.env.BUILD_VERSION.split(" ", 1)[0]; // e.g. "123 (abcd5678)" + if (qs.required_version !== buildNumber) { + remountUI({ roomUnavailableReason: "version_mismatch" }); + setTimeout(() => document.location.reload(), 5000); + exitScene(); + return; + } } getAvailableVREntryTypes().then(availableVREntryTypes => {