From 24270b3e7891cb636003796088491a76d356fcf0 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Mon, 10 Feb 2020 17:10:42 +0100 Subject: [PATCH] [misc] update the build scripts to 1.3.5 --- services/spelling/.dockerignore | 1 + services/spelling/.eslintrc | 62 +++++++++++++------ .../spelling/.github/PULL_REQUEST_TEMPLATE.md | 1 + services/spelling/.prettierrc | 2 +- services/spelling/Dockerfile | 18 ++++-- services/spelling/Jenkinsfile | 1 + services/spelling/Makefile | 11 +++- services/spelling/buildscript.txt | 13 ++-- services/spelling/docker-compose.ci.yml | 14 ++--- services/spelling/docker-compose.yml | 31 ++++------ services/spelling/install_deps.sh | 3 - services/spelling/package.json | 2 +- 12 files changed, 98 insertions(+), 61 deletions(-) diff --git a/services/spelling/.dockerignore b/services/spelling/.dockerignore index ba1c3442de..79eabe8ed1 100644 --- a/services/spelling/.dockerignore +++ b/services/spelling/.dockerignore @@ -5,3 +5,4 @@ gitrev .npm .nvmrc nodemon.json +cache/ diff --git a/services/spelling/.eslintrc b/services/spelling/.eslintrc index 984a32e882..42a4b5cace 100644 --- a/services/spelling/.eslintrc +++ b/services/spelling/.eslintrc @@ -1,13 +1,16 @@ // this file was auto-generated, do not edit it directly. // instead run bin/update_build_scripts from // https://github.com/sharelatex/sharelatex-dev-environment -// Version: 1.1.21 +// Version: 1.3.5 { "extends": [ "standard", "prettier", - "prettier/standard", + "prettier/standard" ], + "parserOptions": { + "ecmaVersion": 2017 + }, "plugins": [ "mocha", "chai-expect", @@ -17,25 +20,46 @@ "node": true, "mocha": true }, - "globals": { - "expect": true, - "define": true - }, "rules": { - // Add some mocha specific rules - "mocha/handle-done-callback": "error", - "mocha/no-exclusive-tests": "error", - "mocha/no-global-tests": "error", - "mocha/no-identical-title": "error", - "mocha/no-nested-tests": "error", - "mocha/no-pending-tests": "error", - "mocha/no-skipped-tests": "error", - - // Add some chai specific rules - "chai-expect/missing-assertion": "error", - "chai-expect/terminating-properties": "error", // Swap the no-unused-expressions rule with a more chai-friendly one "no-unused-expressions": 0, "chai-friendly/no-unused-expressions": "error" - } + }, + "overrides": [ + { + // Test specific rules + "files": ["test/**/*.js"], + "globals": { + "expect": true + }, + "rules": { + // mocha-specific rules + "mocha/handle-done-callback": "error", + "mocha/no-exclusive-tests": "error", + "mocha/no-global-tests": "error", + "mocha/no-identical-title": "error", + "mocha/no-nested-tests": "error", + "mocha/no-pending-tests": "error", + "mocha/no-skipped-tests": "error", + "mocha/no-mocha-arrows": "error", + + // chai-specific rules + "chai-expect/missing-assertion": "error", + "chai-expect/terminating-properties": "error", + + // prefer-arrow-callback applies to all callbacks, not just ones in mocha tests. + // we don't enforce this at the top-level - just in tests to manage `this` scope + // based on mocha's context mechanism + "mocha/prefer-arrow-callback": "error" + } + }, + { + // Backend specific rules + "files": ["app/**/*.js", "app.js", "index.js"], + "rules": { + // don't allow console.log in backend code + "no-console": "error" + } + } + ] } diff --git a/services/spelling/.github/PULL_REQUEST_TEMPLATE.md b/services/spelling/.github/PULL_REQUEST_TEMPLATE.md index ed25ee83c1..eccd3ef6e9 100644 --- a/services/spelling/.github/PULL_REQUEST_TEMPLATE.md +++ b/services/spelling/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,4 @@ + ### Description diff --git a/services/spelling/.prettierrc b/services/spelling/.prettierrc index db87853525..5845b82113 100644 --- a/services/spelling/.prettierrc +++ b/services/spelling/.prettierrc @@ -1,7 +1,7 @@ # This file was auto-generated, do not edit it directly. # Instead run bin/update_build_scripts from # https://github.com/sharelatex/sharelatex-dev-environment -# Version: 1.1.21 +# Version: 1.3.5 { "semi": false, "singleQuote": true diff --git a/services/spelling/Dockerfile b/services/spelling/Dockerfile index 3eede7d1e1..3efdf1a95b 100644 --- a/services/spelling/Dockerfile +++ b/services/spelling/Dockerfile @@ -1,6 +1,15 @@ -FROM node:10.19.0 as app +# This file was auto-generated, do not edit it directly. +# Instead run bin/update_build_scripts from +# https://github.com/sharelatex/sharelatex-dev-environment +# Version: 1.3.5 + +FROM node:10.19.0 as base WORKDIR /app +COPY install_deps.sh /app +RUN chmod 0755 ./install_deps.sh && ./install_deps.sh + +FROM base as app #wildcard as some files may not be in all repos COPY package*.json npm-shrink*.json /app/ @@ -11,12 +20,11 @@ COPY . /app -FROM node:10.19.0 +FROM base COPY --from=app /app /app - -WORKDIR /app -RUN chmod 0755 ./install_deps.sh && ./install_deps.sh +RUN mkdir -p cache \ +&& chown node:node cache USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/spelling/Jenkinsfile b/services/spelling/Jenkinsfile index db7143ab38..2ee7ed8f90 100644 --- a/services/spelling/Jenkinsfile +++ b/services/spelling/Jenkinsfile @@ -16,6 +16,7 @@ pipeline { } stages { + stage('Install') { steps { withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) { diff --git a/services/spelling/Makefile b/services/spelling/Makefile index c7039c6b63..7a1a04eb35 100644 --- a/services/spelling/Makefile +++ b/services/spelling/Makefile @@ -1,7 +1,7 @@ # This file was auto-generated, do not edit it directly. # Instead run bin/update_build_scripts from # https://github.com/sharelatex/sharelatex-dev-environment -# Version: 1.1.21 +# Version: 1.3.5 BUILD_NUMBER ?= local BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) @@ -33,14 +33,20 @@ test_unit: test_acceptance: test_clean test_acceptance_pre_run test_acceptance_run +test_acceptance_debug: test_clean test_acceptance_pre_run test_acceptance_run_debug + test_acceptance_run: @[ ! -d test/acceptance ] && echo "spelling has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance +test_acceptance_run_debug: + @[ ! -d test/acceptance ] && echo "spelling has no acceptance tests" || $(DOCKER_COMPOSE) run -p 127.0.0.9:19999:19999 --rm test_acceptance npm run test:acceptance -- --inspect=0.0.0.0:19999 --inspect-brk + test_clean: $(DOCKER_COMPOSE) down -v -t 0 test_acceptance_pre_run: - @[ ! -f test/acceptance/scripts/pre-run ] && echo "spelling has no pre acceptance tests task" || $(DOCKER_COMPOSE) run --rm test_acceptance test/acceptance/scripts/pre-run + @[ ! -f test/acceptance/js/scripts/pre-run ] && echo "spelling has no pre acceptance tests task" || $(DOCKER_COMPOSE) run --rm test_acceptance test/acceptance/js/scripts/pre-run + build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ @@ -53,4 +59,5 @@ publish: docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) + .PHONY: clean test test_unit test_acceptance test_clean build publish diff --git a/services/spelling/buildscript.txt b/services/spelling/buildscript.txt index 71eac4ce3c..dc2b1648eb 100644 --- a/services/spelling/buildscript.txt +++ b/services/spelling/buildscript.txt @@ -1,8 +1,11 @@ spelling ---node-version=10.19.0 ---script-version=1.1.21 ---build-target=docker ---dependencies=mongo,redis +--public-repo=False --language=es ---docker-repos=gcr.io/overleaf-ops +--env-add= +--node-version=10.19.0 --acceptance-creds=None +--dependencies=mongo,redis +--docker-repos=gcr.io/overleaf-ops +--env-pass-through= +--data-dirs=cache +--script-version=1.3.5 diff --git a/services/spelling/docker-compose.ci.yml b/services/spelling/docker-compose.ci.yml index d2bcca9ec6..b99da9b18e 100644 --- a/services/spelling/docker-compose.ci.yml +++ b/services/spelling/docker-compose.ci.yml @@ -1,9 +1,9 @@ # This file was auto-generated, do not edit it directly. # Instead run bin/update_build_scripts from # https://github.com/sharelatex/sharelatex-dev-environment -# Version: 1.1.21 +# Version: 1.3.5 -version: "2" +version: "2.3" services: test_unit: @@ -25,13 +25,14 @@ services: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test depends_on: - - mongo - - redis + mongo: + condition: service_healthy + redis: + condition: service_healthy user: node command: npm run test:acceptance:_run - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -39,9 +40,8 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root - redis: image: redis mongo: - image: mongo:3.4 + image: mongo:3.6 diff --git a/services/spelling/docker-compose.yml b/services/spelling/docker-compose.yml index 234b93e236..7c29241598 100644 --- a/services/spelling/docker-compose.yml +++ b/services/spelling/docker-compose.yml @@ -1,13 +1,15 @@ # This file was auto-generated, do not edit it directly. # Instead run bin/update_build_scripts from # https://github.com/sharelatex/sharelatex-dev-environment -# Version: 1.1.21 +# Version: 1.3.5 -version: "2" +version: "2.3" services: test_unit: - build: . + build: + context: . + target: base volumes: - .:/app working_dir: /app @@ -18,7 +20,9 @@ services: user: node test_acceptance: - build: . + build: + context: . + target: base volumes: - .:/app working_dir: /app @@ -32,24 +36,15 @@ services: NODE_ENV: test user: node depends_on: - - mongo - - redis + mongo: + condition: service_healthy + redis: + condition: service_healthy command: npm run test:acceptance - - - tar: - build: . - image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER - volumes: - - ./:/tmp/build/ - command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . - user: root - redis: image: redis mongo: - image: mongo:3.4 - + image: mongo:3.6 diff --git a/services/spelling/install_deps.sh b/services/spelling/install_deps.sh index 18a2f42fd0..8579dd5ae5 100644 --- a/services/spelling/install_deps.sh +++ b/services/spelling/install_deps.sh @@ -13,6 +13,3 @@ apt-get update apt-get install -y aspell aspell-en aspell-af aspell-am aspell-ar aspell-ar-large aspell-bg aspell-bn aspell-br aspell-ca aspell-cs aspell-cy aspell-da aspell-de aspell-de-alt aspell-el aspell-eo aspell-es aspell-et aspell-eu-es aspell-fa aspell-fo aspell-fr aspell-ga aspell-gl-minimos aspell-gu aspell-he aspell-hi aspell-hr aspell-hsb aspell-hu aspell-hy aspell-id aspell-is aspell-it aspell-kk aspell-kn aspell-ku aspell-lt aspell-lv aspell-ml aspell-mr aspell-nl aspell-nr aspell-ns aspell-pa aspell-pl aspell-pt aspell-pt-br aspell-ro aspell-ru aspell-sk aspell-sl aspell-ss aspell-st aspell-sv aspell-tl aspell-tn aspell-ts aspell-uk aspell-uz aspell-xh aspell-zu apt-get install aspell-or=0.03-1-6 aspell-te=0.01-2-6 aspell-no=2.2-4 aspell-ta=20040424-1-2 -mkdir /app/cache -chown node:node /app/cache -chmod 0777 /app/cache diff --git a/services/spelling/package.json b/services/spelling/package.json index 2a961ddbd6..538e798a4e 100644 --- a/services/spelling/package.json +++ b/services/spelling/package.json @@ -11,7 +11,7 @@ "start": "node $NODE_APP_OPTIONS app.js", "test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js", "test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP", - "test:unit:_run": "mocha --recursive --reporter spec --exit $@ test/unit/js", + "test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js", "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP", "compile:unit_tests": "[ ! -e test/unit/coffee ] && echo 'No unit tests to compile' || coffee -o test/unit/js -c test/unit/coffee", "compile:acceptance_tests": "[ ! -e test/acceptance/coffee ] && echo 'No acceptance tests to compile' || coffee -o test/acceptance/js -c test/acceptance/coffee",