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: include:
- local: 'ci_templates/.cic-template.yml' - 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-eth/.gitlab-ci.yml'
# - local: 'apps/cic-ussd/.gitlab-ci.yml' - local: 'apps/cic-ussd/.gitlab-ci.yml'
# - local: 'apps/cic-notify/.gitlab-ci.yml' - local: 'apps/cic-notify/.gitlab-ci.yml'
# - local: 'apps/cic-meta/.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' - local: 'apps/data-seeding/.gitlab-ci.yml'
stages: stages:
- build - build

View File

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

View File

@ -2,43 +2,46 @@
variables: variables:
APP_NAME: cic-eth APP_NAME: cic-eth
DOCKERFILE_PATH: docker/Dockerfile_ci DOCKERFILE_PATH: docker/Dockerfile_ci
CONTEXT: $CI_PROJECT_DIR/apps/$APP_NAME CONTEXT: apps/$APP_NAME
.cic_eth_mr_changes_target:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- $CONTEXT/$APP_NAME/**/*
when: always
build-mr-cic-eth: build-mr-cic-eth:
extends: extends:
- .cic_eth_variables - .cic_eth_variables
<<<<<<< HEAD
- .cic_eth_changes_target
- .py_build_target_dev - .py_build_target_dev
======= rules:
- .cic_eth_mr_changes_target - if: $CI_PIPELINE_SOURCE == "merge_request_event"
- .py_build_target_test changes:
>>>>>>> master - apps/cic-eth/**/*
when: always
test-mr-cic-eth: test-mr-cic-eth:
stage: test stage: test
extends: extends:
- .cic_eth_variables - .cic_eth_variables
<<<<<<< HEAD cache:
- .cic_eth_changes_target key:
files:
- test_requirements.txt
paths:
- /root/.cache/pip
image: $MR_IMAGE_TAG image: $MR_IMAGE_TAG
=======
- .cic_eth_mr_changes_target
stage: test
image: $IMAGE_TAG_BASE
>>>>>>> master
script: script:
- cd apps/$APP_NAME/ - cd apps/$APP_NAME/
- pip install -r test_requirements.txt - 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: build-push-cic-eth:
extends: extends:
- .py_build_push - .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? # 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 #COPY util/liveness/health.sh /usr/local/bin/health.sh
RUN echo "TEST RULE CHANGE"
ENTRYPOINT [] ENTRYPOINT []

View File

@ -3,42 +3,41 @@
variables: variables:
APP_NAME: cic-meta APP_NAME: cic-meta
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile 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: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
# - changes: changes:
# - $CONTEXT/$APP_NAME/* - apps/cic-meta/**/*
- when: always 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
test-mr-cic-meta: test-mr-cic-meta:
extends: extends:
- .cic_meta_variables - .cic_meta_variables
- .cic_meta_changes_target
stage: test stage: test
image: $IMAGE_TAG image: $MR_IMAGE_TAG
script: script:
- cd /tmp/src/cic-meta - cd /tmp/src/cic-meta
- npm install --dev - npm install --dev
- npm run test - npm run test
- npm run test:coverage - 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: build-push-cic-meta:
extends: extends:
- .py_build_push - .py_build_push
- .cic_meta_variables - .cic_meta_variables
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- apps/cic-meta/**/*
when: always

View File

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

View File

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

View File

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

View File

@ -39,4 +39,4 @@ RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
-r requirements.txt -r requirements.txt
COPY contract-migration/ . COPY contract-migration/ .
RUN chmod +x *.sh RUN chmod +x *.sh

View File

@ -2,20 +2,25 @@
variables: variables:
APP_NAME: data-seeding APP_NAME: data-seeding
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile_ci DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile_ci
CONTEXT: apps/
.data_seeding_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
build-mr-data-seeding: build-mr-data-seeding:
extends: extends:
- .data_seeding_changes_target
- .py_build_merge_request - .py_build_merge_request
- .data_seeding_variables - .data_seeding_variables
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/data-seeding/**/*
when: always
build-push-data-seeding: build-push-data-seeding:
extends: extends:
- .py_build_push - .py_build_push
- .data_seeding_variables - .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 - mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json" - 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 - /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: .py_build_target_dev:
stage: build stage: build
@ -40,9 +37,6 @@ variables:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json" - 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
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG --destination $CI_REGISTRY_IMAGE/$APP_NAME:latest - /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