Browse Source

removed user temporarly, created make ci task

Henry Oswald 8 years ago
parent
commit
b86dc2623f

+ 1 - 1
services/clsi/Dockerfile

@@ -23,5 +23,5 @@ RUN useradd --user-group --create-home --home-dir /app --shell /bin/false app
 
 RUN [ -e ./install_deps.sh ] && ./install_deps.sh
 
-USER app
+# USER app
 CMD ["node","app.js"]

+ 2 - 20
services/clsi/Jenkinsfile

@@ -9,27 +9,9 @@ pipeline {
   }
 
   stages {
-    stage('Build') {
+    stage('CI') {
       steps {
-        sh 'make build'
-      }
-    }
-
-    stage('Unit Tests') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
-      }
-    }
-
-    stage('Acceptance Tests') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" up --build test_acceptance'
-      }
-    }
-
-    stage('Package and publish build') {
-      steps {
-        sh 'make publish'
+        sh 'make ci'
       }
     }
 

+ 12 - 0
services/clsi/Makefile

@@ -28,10 +28,22 @@ 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)
 
+ci:
+	# On the CI server, we want to run our tests in the image that we
+	# have built for deployment, which is what the docker-compose.ci.yml
+	# override does.
+	PROJECT_NAME=$(PROJECT_NAME) \
+	BRANCH_NAME=$(BRANCH_NAME) \
+	BUILD_NUMBER=$(BUILD_NUMBER) \
+	DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" \
+	$(MAKE) build test
+
+
 .PHONY: clean test test_unit test_acceptance test_clean build publish

+ 1 - 8
services/clsi/docker-compose.ci.yml

@@ -12,17 +12,10 @@ services:
 
   test_acceptance:
     build: .
-    image: quay.io/sharelatex/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
     extends:
       file: docker-compose-config.yml
       service: ci
-    environment:
-      REDIS_HOST: redis
-      MONGO_HOST: mongo
-    depends_on:
-      - redis
-      - mongo
-    entrypoint: npm run test:acceptance:_run
+    entrypoint: npm run test:acceptance
 
   redis:
     image: redis

+ 0 - 6
services/clsi/docker-compose.yml

@@ -21,12 +21,6 @@ services:
     extends:
       file: docker-compose-config.yml
       service: dev
-    environment:
-      REDIS_HOST: redis
-      MONGO_HOST: mongo
-    depends_on:
-      - redis
-      - mongo
     entrypoint: npm run test:acceptance
 
   redis: