From d4837226b64e55e401f8f66a0ad41cba1478351a Mon Sep 17 00:00:00 2001 From: Blair Vanderlugt Date: Thu, 19 Aug 2021 10:25:58 -0400 Subject: [PATCH] cache mr build and test --- .gitlab-ci.yml | 61 ++++++++++++----------------------- apps/cic-cache/.gitlab-ci.yml | 39 +++++++++++----------- 2 files changed, 39 insertions(+), 61 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c35ecea..62dd14b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,11 @@ -#include: +include: # - local: 'ci_templates/.cic-template.yml' # - local: 'apps/contract-migration/.gitlab-ci.yml' # - local: 'apps/cic-eth/.gitlab-ci.yml' # - local: 'apps/cic-ussd/.gitlab-ci.yml' # - local: 'apps/cic-notify/.gitlab-ci.yml' # - local: 'apps/cic-meta/.gitlab-ci.yml' -# - local: 'apps/cic-cache/.gitlab-ci.yml' + - local: 'apps/cic-cache/.gitlab-ci.yml' # - local: 'apps/data-seeding/.gitlab-ci.yml' image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/docker-with-compose:latest @@ -22,6 +22,22 @@ stages: variables: DOCKER_BUILDKIT: "1" COMPOSE_DOCKER_CLI_BUILD: "1" + MR_IMAGE_TAG: $CI_REGISTRY_IMAGE/$APP_NAME:mr-$CI_COMMIT_SHORT_SHA + +build-merge-request: + tags: + - integration + variables: + CI_DEBUG_TRACE: "true" + stage: + build + script: + - TAG=$MR_IMAGE_TAG FRONTEND_ENV=staging sh ./scripts/build-push.sh + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + changes: + - apps/cic-cache/**/* + when: always build-staging: tags: @@ -33,7 +49,7 @@ build-staging: script: - TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh only: - - bvander/integration-tests-on-docker + - staging deploy-staging: tags: @@ -50,27 +66,8 @@ deploy-staging: name: staging url: https://stag.grassrootseconomics.net only: - - bvander/integration-tests-on-docker + - staging - - #tests: - # stage: test - # script: - # - sh ./scripts/test.sh - # tags: - # - build - # - test - # - #build-stag: - # stage: build - # script: - # - TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh - # only: - # - master - # tags: - # - build - # - test - # #build-prod: # stage: build # script: @@ -81,24 +78,6 @@ deploy-staging: # - build # - test # - #deploy-stag: - # stage: deploy - # script: - # - > - # DOMAIN=stag.demo1.com - # TRAEFIK_TAG=stag.demo1.com - # STACK_NAME=stag-demo1-com - # TAG=stag - # sh ./scripts/deploy.sh - # environment: - # name: staging - # url: https://stag.demo1.com - # only: - # - master - # tags: - # - swarm - # - stag - # #deploy-prod: # stage: deploy # script: diff --git a/apps/cic-cache/.gitlab-ci.yml b/apps/cic-cache/.gitlab-ci.yml index ea7ec6c0..6369b38f 100644 --- a/apps/cic-cache/.gitlab-ci.yml +++ b/apps/cic-cache/.gitlab-ci.yml @@ -1,18 +1,17 @@ .cic_cache_variables: variables: APP_NAME: cic-cache - DOCKERFILE_PATH: docker/Dockerfile_ci CONTEXT: apps/$APP_NAME -build-mr-cic-cache: - extends: - - .py_build_merge_request - - .cic_cache_variables - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - changes: - - apps/cic-cache/**/* - when: always + #build-mr-cic-cache: + # extends: + # - .py_build_merge_request + # - .cic_cache_variables + # rules: + # - if: $CI_PIPELINE_SOURCE == "merge_request_event" + # changes: + # - apps/cic-cache/**/* + # when: always test-mr-cic-cache: stage: test @@ -32,21 +31,21 @@ test-mr-cic-cache: --extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple -r test_requirements.txt - export PYTHONPATH=. && pytest -x --cov=cic_cache --cov-fail-under=90 --cov-report term-missing tests - needs: ["build-mr-cic-cache"] + needs: ["build-merge-request"] rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" changes: - apps/$APP_NAME/**/* when: always -build-push-cic-cache: - extends: - - .py_build_push - - .cic_cache_variables - rules: - - if: $CI_COMMIT_BRANCH == "master" - changes: - - apps/cic-cache/**/* - when: always + #build-push-cic-cache: + # extends: + # - .py_build_push + # - .cic_cache_variables + # rules: + # - if: $CI_COMMIT_BRANCH == "master" + # changes: + # - apps/cic-cache/**/* + # when: always