Skip to content

Commit

Permalink
improve lint:browser-code debugging
Browse files Browse the repository at this point in the history
refs DE-465

Change-Id: I560c445ee7bd4b501686bb10bc4ffb64b4b910ad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256692
Reviewed-by: Kyle Rosenbaum <[email protected]>
Tested-by: Service Cloud Jenkins <[email protected]>
QA-Review: Aaron Ogata <[email protected]>
Product-Review: Aaron Ogata <[email protected]>
  • Loading branch information
aogata-inst committed Jan 14, 2021
1 parent acb9563 commit 360ddf3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ pipeline {
RUBY = configuration.ruby() // RUBY_VERSION is a reserved keyword for ruby installs

JS_DEBUG_IMAGE = "${configuration.buildRegistryPath("js-debug")}:${imageTagVersion()}-$TAG_SUFFIX"
LINTER_DEBUG_IMAGE = "${configuration.buildRegistryPath("linter-debug")}:${imageTagVersion()}-$TAG_SUFFIX"

CASSANDRA_PREFIX = configuration.buildRegistryPath('cassandra-migrations')
DYNAMODB_PREFIX = configuration.buildRegistryPath('dynamodb-migrations')
Expand Down Expand Up @@ -587,7 +588,8 @@ pipeline {
timedStage('Linters', stages, {
credentials.withGerritCredentials {
withEnv([
"PLUGINS_LIST=${configuration.plugins().join(' ')}"
"PLUGINS_LIST=${configuration.plugins().join(' ')}",
"UPLOAD_DEBUG_IMAGE=${configuration.getBoolean('upload-linter-debug-image', 'false')}",
]) {
sh 'build/new-jenkins/linters/run-gergich.sh'
}
Expand Down
8 changes: 7 additions & 1 deletion build/new-jenkins/linters/run-gergich.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ RUN --mount=type=bind,target=/tmp/src,source=/usr/src/app,from=patchset \
RUN cp -rf config/docker-compose.override.yml.example /usr/src/app/docker-compose.override.yml
EOF

if [ "$UPLOAD_DEBUG_IMAGE" = "true" ]; then
docker tag local/gergich $LINTER_DEBUG_IMAGE
docker push $LINTER_DEBUG_IMAGE
fi

cat <<EOF | docker run --interactive ${inputs[@]} --volume $GERGICH_VOLUME:/home/docker/gergich local/gergich /bin/bash - &
set -ex
export COMPILE_ASSETS_NPM_INSTALL=0
export JS_BUILD_NO_FALLBACK=1
./build/new-jenkins/linters/run-and-collect-output.sh "gergich capture custom:./build/gergich/compile_assets:Gergich::CompileAssets 'rake canvas:compile_assets'"
./build/new-jenkins/linters/run-and-collect-output.sh "yarn lint:browser-code"
gergich status
echo "WEBPACK_BUILD OK!"
EOF
Expand Down Expand Up @@ -85,6 +90,7 @@ fi
./build/new-jenkins/linters/run-and-collect-output.sh "bundle exec ruby script/rlint"
./build/new-jenkins/linters/run-and-collect-output.sh "bundle exec ruby script/eslint"
./build/new-jenkins/linters/run-and-collect-output.sh "bundle exec ruby script/lint_commit_message"
./build/new-jenkins/linters/run-and-collect-output.sh "yarn lint:browser-code"
gergich status
echo "LINTER OK!"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@
"postinstall": "test -n \"$DISABLE_POSTINSTALL\" || (yarn build:packages && ./script/install_hooks && ./script/fix_inst_esm.sh)",
"webpack:analyze": "echo 'if you get any errors here, make sure you have ran `rake canvas:compile_assets` first' && NODE_ENV=production SKIP_SOURCEMAPS=1 node --max_old_space_size=8096 $(yarn bin)/webpack --json > stats-prod.json && NODE_OPTIONS=\"--max_old_space_size=8192\" npx webpack-bundle-analyzer stats-prod.json public/dist/webpack-production",
"webpack": "gulp rev 1> /dev/null & NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --progress --color --watch",
"webpack-development": "gulp rev 1> /dev/null & NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --color && yarn lint:browser-code",
"webpack-production": "NODE_ENV=production gulp rev && NODE_ENV=production NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --color && yarn lint:browser-code",
"webpack-development": "gulp rev 1> /dev/null & NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --color",
"webpack-production": "NODE_ENV=production gulp rev && NODE_ENV=production NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --color",
"workspace-run": "r() { wsrun --fast-exit --exclude-missing --collect-logs --report -c $@; exit $?; } && r",
"workspace-run-serial": "r() { wsrun --fast-exit --exclude-missing --collect-logs --report --serial -c $@; exit $?; } && r",
"jspec": "./spec/jspec.sh",
Expand Down

0 comments on commit 360ddf3

Please sign in to comment.