From f0ffdb2b25fd368268f8ae27f3ad65504748fe55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Tue, 5 Nov 2019 22:00:00 +0100 Subject: [PATCH] FIX: certificat problem and return value - The return value does not persist over lines in gitlab.yml file - The return value of tests is now saved in a file and read from it - The certificate of the docker container is now used. This prevents outdating --- .docker/Dockerfile | 2 +- .docker/docker-compose.yml | 4 ---- .docker/pycaosdb.ini | 2 +- .docker/run-test.sh | 5 ----- .docker/run.sh | 7 +++++-- .docker/tester.yml | 4 ++++ .gitlab-ci.yml | 13 ++++++------- 7 files changed, 17 insertions(+), 20 deletions(-) delete mode 100755 .docker/run-test.sh diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 81d89ad..69f27a4 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -7,4 +7,4 @@ RUN git clone https://gitlab.com/caosdb/caosdb-pylib.git && \ COPY . /git RUN rm -r /git/.git && mv /git/.docker/pycaosdb.ini /git WORKDIR /git -CMD .docker/run.sh +CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- tox diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index e55f171..953fb82 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -13,10 +13,6 @@ services: - sqldb networks: - caosnet - volumes: - - type: bind - source: "$CERTPATH" - target: /opt/caosdb/cert ports: # - "from_outside:from_inside" - "10443:10443" diff --git a/.docker/pycaosdb.ini b/.docker/pycaosdb.ini index e9c0926..17b437c 100644 --- a/.docker/pycaosdb.ini +++ b/.docker/pycaosdb.ini @@ -4,7 +4,7 @@ test_server_side_scripting.bin_dir=../caosdb-server/test_scripting/bin/ [Connection] url=https://caosdb-server:10443 username=admin -cacert=.docker/cert/caosdb.cert.pem +cacert=/cert/caosdb.cert.pem #cacert=/etc/ssl/cert.pem debug=0 diff --git a/.docker/run-test.sh b/.docker/run-test.sh deleted file mode 100755 index fbda711..0000000 --- a/.docker/run-test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -tox -echo $?>/test_success -echo "Saved result value" diff --git a/.docker/run.sh b/.docker/run.sh index 39a66c5..00c7618 100755 --- a/.docker/run.sh +++ b/.docker/run.sh @@ -1,2 +1,5 @@ -#!/bin/bash -/wait-for-it.sh caosdb-server:10443 -t 500 -- .docker/run-test.sh +#!/bin/sh + +docker-compose -f tester.yml run tester +rv=$? +echo $rv > result diff --git a/.docker/tester.yml b/.docker/tester.yml index 2d22c8b..634ac13 100644 --- a/.docker/tester.yml +++ b/.docker/tester.yml @@ -4,6 +4,10 @@ services: image: "$CI_REGISTRY_IMAGE:latest" networks: - docker_caosnet + volumes: + - type: bind + source: ./cert + target: /cert networks: docker_caosnet: external: true diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bcccf9d..c0a14a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,21 +79,20 @@ test: - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker pull $CI_REGISTRY_IMAGE:latest - cd .docker - - DIR=`pwd` - - CERTPATH=$DIR"/cert" CAOSDB_TAG=$CAOSDB_TAG docker-compose up -d - # prevent this script from terminating when the return value is non-zero - - docker-compose -f tester.yml run tester + - CAOSDB_TAG=$CAOSDB_TAG docker-compose up -d + - docker cp docker_caosdb-server_1:/opt/caosdb/cert cert + # writes the return value of the tests into the file result + - /bin/sh ./run.sh - docker logs docker_caosdb-server_1 &> ../caosdb_log.txt - docker logs docker_sqldb_1 &> ../mariadb_log.txt - docker-compose down - - docker cp docker_tester_1:/test_success test_success - - rc=`cat test_success` + - rc=`cat result` - exit $rc artifacts: paths: - caosdb_log.txt - mariadb_log.txt - #when: on_failure + when: on_failure expire_in: 1 week build-testenv: -- GitLab