From 0469aa0e87a1bf997b237c0bb38c7a8aa7cba340 Mon Sep 17 00:00:00 2001 From: sbriat Date: Thu, 9 Feb 2023 14:20:05 +0100 Subject: [PATCH] check ci --check --- .gitlab-ci.yml | 24 ++++++++++++++++++- docker-compose.ci.service.yml | 19 +++++++++++++++ ...pose.ci.yml => docker-compose.ci.tools.yml | 15 ------------ 3 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 docker-compose.ci.service.yml rename docker-compose.ci.yml => docker-compose.ci.tools.yml (64%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98ce039..c39240b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: docker:20.10.22 stages: - test + - build ############## # TEST STAGE # @@ -15,10 +16,31 @@ test: services: - docker:dind script: - - docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d + - docker-compose -f docker-compose.ci.tools.yml -p auth-tools --env-file ci/.env.ci up -d - sh ci/wait-up.sh + - docker-compose -f docker-compose.ci.service.yml -p auth-service --env-file ci/.env.ci up -d - docker exec -t v3-auth sh -c "npm run test:integration:ci" coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ rules: - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: always + +############### +# BUILD STAGE # +############### + +build: + stage: build + image: docker:20.10.22 + variables: + DOCKER_TLS_CERTDIR: "" + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE" . + - docker push "$CI_REGISTRY_IMAGE" + only: + - main + when: manual diff --git a/docker-compose.ci.service.yml b/docker-compose.ci.service.yml new file mode 100644 index 0000000..dfdb432 --- /dev/null +++ b/docker-compose.ci.service.yml @@ -0,0 +1,19 @@ +version: '3.8' + +services: + api: + container_name: v3-auth + build: + dockerfile: ci/Dockerfile + context: . + env_file: + - ci/.env.ci + ports: + - 5002:5002 + networks: + - v3-network + +networks: + v3-network: + name: v3-network + external: true diff --git a/docker-compose.ci.yml b/docker-compose.ci.tools.yml similarity index 64% rename from docker-compose.ci.yml rename to docker-compose.ci.tools.yml index bc1e38d..c8c83c9 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.tools.yml @@ -1,21 +1,6 @@ version: '3.8' services: - api: - container_name: v3-auth - build: - dockerfile: ci/Dockerfile - context: . - env_file: - - ci/.env.ci - ports: - - 5002:5002 - depends_on: - - db - - broker - networks: - - v3-network - db: container_name: v3-auth-db-test image: ${POSTGRES_IMAGE}