skip uglify js / source maps on pre-merge builds v2
refs DE-161 Test Plan: 1. Ensure that JS sourcemaps are skipped on pre-merge 1. Ensure that JS sourcemaps are run on post-merge 3. Ensure that Linters catch bundle size increase limits on pre-merge Change-Id: I59607d902b191169a0415fc7673cb3a3a06dba68 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243619 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Aaron Ogata <aogata@instructure.com> QA-Review: Alex Slaughter <aslaughter@instructure.com> Product-Review: Aaron Ogata <aogata@instructure.com> Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
This commit is contained in:
parent
4f3e41a233
commit
217b1f35de
|
@ -179,9 +179,11 @@ RUN set -eux; \
|
|||
&& yarn cache clean
|
||||
|
||||
FROM yarn-only AS webpack-final
|
||||
ARG JS_BUILD_NO_UGLIFY=0
|
||||
|
||||
COPY --chown=docker:docker . ${APP_HOME}
|
||||
|
||||
RUN set -exu; \
|
||||
\
|
||||
COMPILE_ASSETS_NPM_INSTALL=0 bundle exec rails canvas:compile_assets \
|
||||
COMPILE_ASSETS_NPM_INSTALL=0 JS_BUILD_NO_UGLIFY="$JS_BUILD_NO_UGLIFY" bundle exec rails canvas:compile_assets \
|
||||
&& yarn cache clean
|
||||
|
|
|
@ -288,7 +288,11 @@ pipeline {
|
|||
sh './build/new-jenkins/docker-with-flakey-network-protection.sh pull $MERGE_TAG'
|
||||
sh 'docker tag $MERGE_TAG $PATCHSET_TAG'
|
||||
} else {
|
||||
sh 'build/new-jenkins/docker-build.sh'
|
||||
withEnv([
|
||||
"JS_BUILD_NO_UGLIFY=${configuration.isChangeMerged() ? 0 : 1}"
|
||||
]) {
|
||||
sh 'build/new-jenkins/docker-build.sh'
|
||||
}
|
||||
sh "./build/new-jenkins/docker-with-flakey-network-protection.sh push $RUBY_GEMS_PATCHSET_IMAGE"
|
||||
sh "./build/new-jenkins/docker-with-flakey-network-protection.sh push $RUBY_PATCHSET_IMAGE"
|
||||
sh "./build/new-jenkins/docker-with-flakey-network-protection.sh push $YARN_PATCHSET_IMAGE"
|
||||
|
|
|
@ -51,6 +51,7 @@ DOCKER_BUILDKIT=1 docker build \
|
|||
DOCKER_BUILDKIT=1 docker build \
|
||||
${commonRubyArgs[@]} \
|
||||
${commonNodeArgs[@]} \
|
||||
--build-arg JS_BUILD_NO_UGLIFY="$JS_BUILD_NO_UGLIFY" \
|
||||
--tag "$PATCHSET_TAG" \
|
||||
--target webpack-final \
|
||||
"$WORKSPACE"
|
||||
|
|
|
@ -7,6 +7,7 @@ services:
|
|||
- redis
|
||||
environment:
|
||||
RAILS_ENV: development
|
||||
USE_OPTIMIZED_JS: "true"
|
||||
ports:
|
||||
- "8181:80"
|
||||
init: true
|
||||
|
|
|
@ -46,13 +46,13 @@ require('./bundles')
|
|||
// after-uglify size of things, but can skip making sourcemaps if you want it to
|
||||
// go faster. So this is to allow people to use either environment variable:
|
||||
// the technically more correct SKIP_SOURCEMAPS one or the historically used JS_BUILD_NO_UGLIFY one.
|
||||
const skipSourcemaps = Boolean(process.env.SKIP_SOURCEMAPS || process.env.JS_BUILD_NO_UGLIFY)
|
||||
const skipSourcemaps = Boolean(process.env.SKIP_SOURCEMAPS || process.env.JS_BUILD_NO_UGLIFY === '1')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
|
||||
module.exports = {
|
||||
mode: process.env.NODE_ENV,
|
||||
performance: {
|
||||
performance: skipSourcemaps ? false : {
|
||||
// This just reflects how big the 'main' entry is at the time of writing. Every
|
||||
// time we get it smaller we should change this to the new smaller number so it
|
||||
// only goes down over time instead of growing bigger over time
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace :canvas do
|
|||
# build dev bundles even in prod mode so you can debug with ?optimized_js=0 query string
|
||||
# (except for on jenkins where we set JS_BUILD_NO_UGLIFY anyway so there's no need for an unminified fallback)
|
||||
build_prod = ENV['RAILS_ENV'] == 'production' || ENV['USE_OPTIMIZED_JS'] == 'true' || ENV['USE_OPTIMIZED_JS'] == 'True'
|
||||
dont_need_dev_fallback = build_prod && ENV['JS_BUILD_NO_UGLIFY']
|
||||
dont_need_dev_fallback = build_prod && ENV['JS_BUILD_NO_UGLIFY'] == "1"
|
||||
build_tasks << 'js:webpack_development' unless dont_need_dev_fallback
|
||||
build_tasks << 'js:webpack_production' if build_prod
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue