cache yarn install for client_apps

refs DE-183

[change-merged]
[build-registry-path=jenkins/canvas-lms-de-183-pt-3]

Change-Id: I1f3523790f058593ed16c22e5b5c81f82e223ea8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244661
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
Aaron Ogata 2020-08-09 08:14:06 -07:00
parent e29c95b1fc
commit 38182bb44d
4 changed files with 11 additions and 1 deletions

View File

@ -135,6 +135,8 @@ COPY --chown=docker:docker packages ${APP_HOME}packages
COPY --chown=docker:docker script ${APP_HOME}script
COPY --chown=docker:docker yarn.lock ${APP_HOME}
COPY --chown=docker:docker client_apps/canvas_quizzes/package.json ${APP_HOME}client_apps/canvas_quizzes/package.json
RUN set -eux; \
mkdir -p .yardoc \
app/stylesheets/brandable_css_brands \

View File

@ -132,6 +132,8 @@ COPY --chown=docker:docker packages ${APP_HOME}packages
COPY --chown=docker:docker script ${APP_HOME}script
COPY --chown=docker:docker yarn.lock ${APP_HOME}
<%= yarn_files_client_apps.map { |p| "COPY --chown=docker:docker #{p} ${APP_HOME}#{p}" }.join('\n') %>
RUN set -eux; \
mkdir -p <%= docker_compose_volume_paths.join(" \\\n ") %> \
&& (yarn install --pure-lockfile || yarn install --pure-lockfile --network-concurrency 1) \

View File

@ -64,6 +64,10 @@ class DockerfileWriter
def docker_compose_config
DockerUtils.compose_config(*compose_files)
end
def yarn_files_client_apps
paths = Dir.glob('./client_apps/*/package.json').map { |p| p.sub('./', '') }
end
end
options = {}

View File

@ -6,13 +6,15 @@ namespace :js do
task :build_client_apps do
require 'config/initializers/client_app_symlinks'
npm_install = ENV["COMPILE_ASSETS_NPM_INSTALL"] != "0"
Dir.glob('./client_apps/*/').each do |app_dir|
app_name = File.basename(app_dir)
Dir.chdir(app_dir) do
puts "Building client app '#{app_name}'"
if File.exists?('./package.json')
if npm_install && File.exists?('./package.json')
output = system 'yarn install --pure-lockfile || yarn install --pure-lockfile --network-concurrency 1'
unless $?.exitstatus == 0
puts "INSTALL FAILURE:\n#{output}"