From d698cc318fc7bf2e73e7d1b687487c145313d633 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Feb 2018 15:42:51 +0000 Subject: [PATCH] updateded build scripts --- Jenkinsfile | 36 +++++++++++++++++-- Makefile | 7 +--- ...overrides.yml => docker-compose-config.yml | 0 docker-compose.ci.yml | 12 +++++-- docker-compose.yml | 6 ++-- kube.yaml | 8 ++--- 6 files changed, 50 insertions(+), 19 deletions(-) rename docker-compose-overrides.yml => docker-compose-config.yml (100%) diff --git a/Jenkinsfile b/Jenkinsfile index bc9ba01..326dce5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,9 +9,34 @@ pipeline { } stages { - stage('Build') { + stage('Install') { + agent { + docker { + image 'node:6.13.0' + args "-v /var/lib/jenkins/.npm:/tmp/.npm -e HOME=/tmp" + reuseNode true + } + } steps { - sh 'make build' + // we need to disable logallrefupdates, else git clones + // during the npm install will require git to lookup the + // user id which does not exist in the container's + // /etc/passwd file, causing the clone to fail. + sh 'git config --global core.logallrefupdates false' + sh 'rm -rf node_modules' + sh 'npm install && npm rebuild' + } + } + + stage('Compile') { + agent { + docker { + image 'node:6.13.0' + reuseNode true + } + } + steps { + sh 'npm run compile:all' } } @@ -29,7 +54,12 @@ pipeline { stage('Package and publish build') { steps { - sh 'make publish' + sh 'echo ${BUILD_NUMBER} > build_number.txt' + sh 'touch build.tar.gz' // Avoid tar warning about files changing during read + sh 'tar -czf build.tar.gz --exclude=build.tar.gz --exclude-vcs .' + withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") { + s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz") + } } } diff --git a/Makefile b/Makefile index 828e8f8..89066f5 100644 --- a/Makefile +++ b/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.0.3 +# Version: 1.1.0 BUILD_NUMBER ?= local BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) @@ -28,10 +28,5 @@ test_acceptance: test_clean # clear the database before each acceptance test run test_clean: $(DOCKER_COMPOSE) down -t 0 -build: - docker build --pull --tag quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) . - -publish: - docker push quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) .PHONY: clean test test_unit test_acceptance test_clean build publish diff --git a/docker-compose-overrides.yml b/docker-compose-config.yml similarity index 100% rename from docker-compose-overrides.yml rename to docker-compose-config.yml diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 695ad3c..00740d4 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,17 +1,23 @@ # 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.0.3 +# Version: 1.1.0 version: "2" services: test_unit: - image: quay.io/sharelatex/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER + image: node:6.13.0 + volumes: + - .:/app + working_dir: /app entrypoint: npm run test:unit:_run test_acceptance: - image: quay.io/sharelatex/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER + image: node:6.13.0 + volumes: + - .:/app + working_dir: /app environment: REDIS_HOST: redis MONGO_HOST: mongo diff --git a/docker-compose.yml b/docker-compose.yml index 6126666..c259abc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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.0.3 +# Version: 1.1.0 version: "2" @@ -14,12 +14,12 @@ services: entrypoint: npm run test:unit test_acceptance: - build: . + image: node:6.13.0 volumes: - .:/app working_dir: /app extends: - file: docker-compose-overrides.yml + file: docker-compose-config.yml service: dev environment: REDIS_HOST: redis diff --git a/kube.yaml b/kube.yaml index 44a562d..d3fb042 100644 --- a/kube.yaml +++ b/kube.yaml @@ -6,9 +6,9 @@ metadata: spec: type: LoadBalancer ports: - - port: 3009 + - port: 80 protocol: TCP - targetPort: 3009 + targetPort: 80 selector: run: clsi --- @@ -26,12 +26,12 @@ spec: spec: containers: - name: clsi - image: gcr.io/henry-terraform-admin/clsi:6e0c79688030117a9c27d0fc01d1271e6ac3dd3e + image: gcr.io/henry-terraform-admin/clsi imagePullPolicy: Always readinessProbe: httpGet: path: status - port: 3009 + port: 80 periodSeconds: 5 initialDelaySeconds: 0 failureThreshold: 3