Merge branch 'bvander/cic-eth-base-image-and-testing' of gitlab.com:grassrootseconomics/cic-internal-integration into bvander/cic-eth-base-image-and-testing

This commit is contained in:
Blair Vanderlugt 2021-07-07 14:08:26 -07:00
commit 5668ed1cf5
11 changed files with 110 additions and 87 deletions

View File

@ -1,12 +1,12 @@
include:
- local: 'ci_templates/.cic-template.yml'
# - local: 'apps/contract-migration/.gitlab-ci.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/data-seeding/.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/data-seeding/.gitlab-ci.yml'
stages:
- build

View File

@ -2,21 +2,26 @@
variables:
APP_NAME: cic-cache
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.cic_cache_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
CONTEXT: apps
build-mr-cic-cache:
extends:
- .cic_cache_changes_target
- .py_build_merge_request
- .cic_cache_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
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

View File

@ -2,43 +2,46 @@
variables:
APP_NAME: cic-eth
DOCKERFILE_PATH: docker/Dockerfile_ci
CONTEXT: $CI_PROJECT_DIR/apps/$APP_NAME
.cic_eth_mr_changes_target:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- $CONTEXT/$APP_NAME/**/*
when: always
CONTEXT: apps/$APP_NAME
build-mr-cic-eth:
extends:
- .cic_eth_variables
<<<<<<< HEAD
- .cic_eth_changes_target
- .py_build_target_dev
=======
- .cic_eth_mr_changes_target
- .py_build_target_test
>>>>>>> master
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/cic-eth/**/*
when: always
test-mr-cic-eth:
stage: test
extends:
- .cic_eth_variables
<<<<<<< HEAD
- .cic_eth_changes_target
cache:
key:
files:
- test_requirements.txt
paths:
- /root/.cache/pip
image: $MR_IMAGE_TAG
=======
- .cic_eth_mr_changes_target
stage: test
image: $IMAGE_TAG_BASE
>>>>>>> master
script:
- cd apps/$APP_NAME/
- pip install -r test_requirements.txt
- pytest -x --cov=cic_eth --cov-fail-under=90 --cov-report term-missing tests
- export PYTHONPATH=. && pytest -x --cov=cic_eth --cov-fail-under=90 --cov-report term-missing tests
needs: ["build-mr-cic-eth"]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/cic-eth/**/*
when: always
build-push-cic-eth:
extends:
- .py_build_push
- .cic_eth_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/cic-eth/**/*
when: always

View File

@ -62,5 +62,7 @@ COPY crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/
# TODO this kind of code sharing across projects should be discouraged...can we make util a library?
#COPY util/liveness/health.sh /usr/local/bin/health.sh
RUN echo "TEST RULE CHANGE"
ENTRYPOINT []

View File

@ -3,42 +3,41 @@
variables:
APP_NAME: cic-meta
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
IMAGE_TAG: $CI_REGISTRY_IMAGE/$APP_NAME:unittest-$CI_COMMIT_SHORT_SHA
CONTEXT: apps
.cic_meta_changes_target:
build-mr-cic-meta:
extends:
- .py_build_merge_request
- .cic_notify_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# - changes:
# - $CONTEXT/$APP_NAME/*
- when: always
cic-meta-build-mr:
stage: build
extends:
- .cic_meta_variables
- .cic_meta_changes_target
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
# - /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG
changes:
- apps/cic-meta/**/*
when: always
test-mr-cic-meta:
extends:
- .cic_meta_variables
- .cic_meta_changes_target
stage: test
image: $IMAGE_TAG
image: $MR_IMAGE_TAG
script:
- cd /tmp/src/cic-meta
- npm install --dev
- npm run test
- npm run test:coverage
needs: ["cic-meta-build-mr"]
needs: ["build-mr-cic-meta"]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/cic-meta/**/*
when: always
build-push-cic-meta:
extends:
- .py_build_push
- .cic_meta_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/cic-meta/**/*
when: always

View File

@ -2,21 +2,26 @@
variables:
APP_NAME: cic-notify
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.cic_notify_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
CONTEXT: apps/
build-mr-cic-notify:
extends:
- .cic_notify_changes_target
- .py_build_merge_request
- .cic_notify_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/cic-notify/**/*
when: always
build-push-cic-notify:
extends:
- .py_build_push
- .cic_notify_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/cic-notify/**/*
when: always

View File

@ -2,21 +2,26 @@
variables:
APP_NAME: cic-ussd
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.cic_ussd_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
CONTEXT: apps/
build-mr-cic-ussd:
extends:
- .cic_ussd_changes_target
- .py_build_merge_request
- .cic_ussd_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/cic-ussd/**/*
when: always
build-push-cic-ussd:
extends:
- .py_build_push
- .cic_ussd_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/cic-ussd/**/*
when: always

View File

@ -2,19 +2,24 @@
variables:
APP_NAME: contract-migration
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile_ci
.contract_migration_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
CONTEXT: apps/
build-mr-contract-migration:
extends:
- .contract_migration_changes_target
- .py_build_merge_request
- .contract_migration_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/contract-migration/**/*
when: always
build-push-contract-migration:
extends:
- .py_build_push
- .contract_migration_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/contract-migration/**/*
when: always

View File

@ -2,20 +2,25 @@
variables:
APP_NAME: data-seeding
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile_ci
.data_seeding_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
CONTEXT: apps/
build-mr-data-seeding:
extends:
- .data_seeding_changes_target
- .py_build_merge_request
- .data_seeding_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/data-seeding/**/*
when: always
build-push-data-seeding:
extends:
- .py_build_push
- .data_seeding_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/data-seeding/**/*
when: always

View File

@ -16,9 +16,6 @@ variables:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --destination $IMAGE_TAG
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
.py_build_target_dev:
stage: build
@ -40,9 +37,6 @@ variables:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
# - /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG --destination $CI_REGISTRY_IMAGE/$APP_NAME:latest
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: always