Commit d5d51a42 authored by Bruce Flynn's avatar Bruce Flynn

CI/testing tweaks

parent 11b3721e
Pipeline #2984 failed with stages
in 1 minute and 5 seconds
variables:
DOCKER_CMD: docker-compose -p amrc_aws -f tests/docker-compose.yaml
DKR: docker-compose -p amrcaws -f tests/docker-compose.yaml
stages:
- build
- test
- push
- deploy
build:
stage: build
script:
- ${DOCKER_CMD} build app
- docker login -u brucef -p "${PULL_TOKEN}" gitlab.ssec.wisc.edu:5555
- ${DKR} build app
- docker tag amrcaws_app ${CI_PROJECT_NAME}
test:
stage: test
before_script:
- ${DOCKER_CMD} up -d db
- sleep 10
- ${DKR} up -d db
- ${DKR} run app wait-for-it.sh db:5432
script:
- ${DOCKER_CMD} run --rm app py.test -xv
- ${DKR} run app py.test -xv
after_script:
- ${DOCKER_CMD} down --remove-orphan
- ${DKR} down
push_prod:
stage: push
only:
- /^[0-9]+\.[0-9]+\.[0-9]+$/
script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker tag ${CI_PROJECT_NAME} ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
- docker tag ${CI_PROJECT_NAME} ${CI_REGISTRY_IMAGE}:latest
- docker push ${CI_REGISTRY_IMAGE}:latest
FROM debian
# minimal deps required to install miniconda and compile py-exts
RUN apt-get update && apt-get -y install \
bzip2 \
curl \
gcc \
git \
libx11-6 \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# install Miniconda3
WORKDIR /tmp
RUN curl -so installer.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash installer.sh -b -p /miniconda && \
rm installer.sh
# install deps that tend to cause issues via conda
RUN /miniconda/bin/conda install -y psycopg2 curl
# put miniconda bins first on the path
ENV PATH /miniconda/bin:$PATH
FROM gitlab.ssec.wisc.edu:5555/brucef/mydocker/pyservice:2
RUN mkdir /code
WORKDIR /code
......
export COMPOSE_PROJECT_NAME=amrcaws
export COMPOSE_FILE=$PWD/tests/docker-compose.yaml
docker-compose up -d db
......@@ -6,7 +6,7 @@ services:
context: ..
dockerfile: tests/Dockerfile
environment:
TEST_DBURL: postgresql://docker@db/__test
TEST_DB_HOST: "db:5432"
db:
environment:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment