Просмотр исходного кода

[web] tweak Jenkins pipeline following move to faster CI VMs (#29188)

* [web] tweak Jenkins pipeline following move to faster CI VMs

The webpack build time has been reduced by about 30%. Adjust the sleep
statement for delaying the webpack build accordingly.

Push the production docker image layers from the parallel steps already.
Use a shared "scratch" tag to avoid generating cruft per branch/build.

* [web] avoid sharing the cypress/downloads folder in CI

GitOrigin-RevId: 52fdf420ec04fd26e3823ff9fca8c52f7a7764d7
Jakob Ackermann 11 месяцев назад
Родитель
Сommit
49667a605b

+ 8 - 1
services/web/Jenkinsfile

@@ -279,7 +279,7 @@ pipeline {
           stages {
             stage('Wait a bit to give tests all the CPU capacity') {
               steps {
-                sh 'sleep 90'
+                sh 'sleep 60'
               }
             }
             stage('Build Webpack') {
@@ -330,6 +330,13 @@ pipeline {
                 }
               }
             }
+            stage('Push Production image early') {
+              steps {
+                dir('services/web') {
+                  sh 'make push_scratch'
+                }
+              }
+            }
           }
         }
       }

+ 13 - 0
services/web/Makefile

@@ -183,21 +183,26 @@ test_writefull:
 build_test_frontend_ct:
 	docker run --rm --volume /dev/shm:/dev/shm --user root $(IMAGE_CI) bash -ec 'for path in /overleaf/services/web/cypress/results /overleaf/services/web/node_modules/.cache; do mkdir -p $$path; chown -R node:node $$path; done && tar -cC / overleaf | tar -xC /dev/shm'
 
+test_frontend_ct_core_other: export CYPRESS_DOWNLOADS=./cypress/downloads/core
 test_frontend_ct_core_other: export CYPRESS_RESULTS=./cypress/results/core
 test_frontend_ct_core_other: export CYPRESS_SPEC_PATTERN=./test/frontend/**/*.spec.{js,jsx,ts,tsx}
 test_frontend_ct_core_other: export CYPRESS_EXCLUDE_SPEC_PATTERN=./test/frontend/features/**/*.spec.{js,jsx,ts,tsx}
 
+test_frontend_ct_core_features: export CYPRESS_DOWNLOADS=./cypress/downloads/core
 test_frontend_ct_core_features: export CYPRESS_RESULTS=./cypress/results/core
 test_frontend_ct_core_features: export CYPRESS_SPEC_PATTERN=./test/frontend/features/**/*.spec.{js,jsx,ts,tsx}
 test_frontend_ct_core_features: export CYPRESS_EXCLUDE_SPEC_PATTERN=./test/frontend/features/source-editor/**/*.spec.{js,jsx,ts,tsx}
 
+test_frontend_ct_modules: export CYPRESS_DOWNLOADS=./cypress/downloads/modules
 test_frontend_ct_modules: export CYPRESS_RESULTS=./cypress/results/modules
 test_frontend_ct_modules: export CYPRESS_SPEC_PATTERN=./modules/**/test/frontend/**/*.spec.{js,jsx,ts,tsx}
 
+test_frontend_ct_editor_other: export CYPRESS_DOWNLOADS=./cypress/downloads/editor_other
 test_frontend_ct_editor_other: export CYPRESS_RESULTS=./cypress/results/editor_other
 test_frontend_ct_editor_other: export CYPRESS_SPEC_PATTERN=./test/frontend/features/source-editor/**/*.spec.{js,jsx,ts,tsx}
 test_frontend_ct_editor_other: export CYPRESS_EXCLUDE_SPEC_PATTERN=./test/frontend/features/source-editor/components/codemirror-editor-visual*.spec.{js,jsx,ts,tsx}
 
+test_frontend_ct_editor_visual: export CYPRESS_DOWNLOADS=./cypress/downloads/editor_visual
 test_frontend_ct_editor_visual: export CYPRESS_RESULTS=./cypress/results/editor_visual
 test_frontend_ct_editor_visual: export CYPRESS_SPEC_PATTERN=./test/frontend/features/source-editor/components/codemirror-editor-visual*.spec.{js,jsx,ts,tsx}
 
@@ -547,6 +552,10 @@ shellcheck_fix:
 IMAGE_CI ?= ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
 IMAGE_REPO ?= us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME)
 IMAGE_REPO_FINAL ?= $(IMAGE_REPO):$(BRANCH_NAME)-$(BUILD_NUMBER)
+# A shared scratch tag that is used by all the pipelines for pushing the layers of the production image ASAP from a parallel step.
+# We do not want to make the image available before all the tests have passed.
+# Using a single tag avoids generating cruft in our docker repository / AR.
+IMAGE_SCRATCH ?= $(IMAGE_REPO):do-not-use-this-tag-for-deploys--it-is-used-for-early-pushes-in-ci
 IMAGE_CACHE ?= $(IMAGE_REPO):cache-$(shell cat \
 	$(MONOREPO)/package.json \
 	$(MONOREPO)/package-lock.json \
@@ -613,6 +622,7 @@ build:
 	docker build \
 		--build-arg SENTRY_RELEASE \
 		--tag $(IMAGE_REPO_FINAL) \
+		--tag $(IMAGE_SCRATCH) \
 		--target app \
 		--file Dockerfile \
 		../..
@@ -623,6 +633,9 @@ publish:
 push_branch:
 	docker push $(IMAGE_CACHE)
 
+push_scratch:
+	docker push $(IMAGE_SCRATCH)
+
 SENTRY_IMAGE=getsentry/sentry-cli:2.16.1
 sentry_prefetch:
 	docker pull $(SENTRY_IMAGE)

+ 1 - 0
services/web/cypress.config.ts

@@ -14,6 +14,7 @@ if (process.env.CI) {
 export default defineConfig({
   fixturesFolder: 'cypress/fixtures',
   video: process.env.CYPRESS_VIDEO === 'true',
+  downloadsFolder: process.env.CYPRESS_DOWNLOADS || 'cypress/downloads',
   screenshotsFolder: process.env.CYPRESS_RESULTS || 'cypress/results',
   videosFolder: process.env.CYPRESS_RESULTS || 'cypress/results',
   viewportHeight: 800,

+ 1 - 0
services/web/docker-compose.ci.yml

@@ -89,6 +89,7 @@ services:
     user: "${DOCKER_USER:-1000:1000}"
     environment:
       CI:
+      CYPRESS_DOWNLOADS:
       CYPRESS_RESULTS:
       CYPRESS_SPEC_PATTERN:
       CYPRESS_EXCLUDE_SPEC_PATTERN: