From 89d5cc9f49641aad79ac42660d186d31de9c7d02 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Mon, 7 Jun 2021 14:49:12 +0200 Subject: [PATCH] WIP: pipeline --- .docker/Dockerfile | 5 +++- .gitlab-ci.yml | 72 ++++++++++++++++++++++++---------------------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 4f986d1..8846086 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,7 +11,10 @@ RUN cmake .. RUN cmake --build . RUN cmake --install . --prefix /usr/local/ -WORKDIR / +COPY . /caosdb-cppinttest +WORKDIR /caosdb-cppinttest +RUN rm -rf .git + CMD ls -la && /wait-for-it.sh caosdb-server:10443 -t 500 -- \ # ... and run tests ctest diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 54a916f..aa2f1c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -111,6 +111,7 @@ build-test: tags: [ docker ] stage: build script: + - echo $PWD - mkdir build - cd build - cmake -D CMAKE_PREFIX_PATH=/usr/local/lib/libcaosdb-${CPPLIB_VERSION} .. @@ -138,53 +139,54 @@ test: - job: cert artifacts: true script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - echo $PWD + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - if [[ "$CAOSDB_TAG" == "" ]]; then - if echo "$F_BRANCH" | grep -c "^f-" ; then - CAOSDB_TAG=${DEPLOY_REF}_F_${F_BRANCH}-latest; - docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG || CAOSDB_TAG=${DEPLOY_REF}-latest ; - else - CAOSDB_TAG=${DEPLOY_REF}-latest; - fi; - fi - - docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG || CAOSDB_TAG=dev-latest ; + - if [[ "$CAOSDB_TAG" == "" ]]; then + if echo "$F_BRANCH" | grep -c "^f-" ; then + CAOSDB_TAG=${DEPLOY_REF}_F_${F_BRANCH}-latest; + docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG || CAOSDB_TAG=${DEPLOY_REF}-latest ; + else + CAOSDB_TAG=${DEPLOY_REF}-latest; + fi; + fi + - docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG || CAOSDB_TAG=dev-latest ; - - docker load < /image-cache/${CPPINTTEST_IMAGE_CACHE} || true - - docker pull $CPPINTTEST_REGISTRY_IMAGE + - docker load < /image-cache/${CPPINTTEST_IMAGE_CACHE} || true + - docker pull $CPPINTTEST_REGISTRY_IMAGE - - docker load < /image-cache/mariadb.tar || true - # load any(!!!) mariab image - - cd .docker - - ls -la - - ls -la cert + - docker load < /image-cache/mariadb.tar || true + # load any(!!!) mariab image + - cd .docker + - ls -la + - ls -la cert - # here the server and the mysql backend docker are being started - - echo "$CAOSDB_TAG" - - CAOSDB_TAG=$CAOSDB_TAG docker-compose up -d + # here the server and the mysql backend docker are being started + - echo "$CAOSDB_TAG" + - CAOSDB_TAG=$CAOSDB_TAG docker-compose up -d - # the pyinttest docker writes the return value of the tests into the - # file result - - /bin/sh ./run.sh + # the pyinttest docker writes the return value of the tests into the + # file result + - /bin/sh ./run.sh - # collect log files - - docker logs docker_caosdb-server_1 &> ../caosdb_log.txt - - docker logs docker_sqldb_1 &> ../mariadb_log.txt + # collect log files + - docker logs docker_caosdb-server_1 &> ../caosdb_log.txt + - docker logs docker_sqldb_1 &> ../mariadb_log.txt - # shut down - - CAOSDB_TAG=$CAOSDB_TAG docker-compose -f docker-compose.yml down + # shut down + - CAOSDB_TAG=$CAOSDB_TAG docker-compose -f docker-compose.yml down - # collect results - - rc=`cat result` + # collect results + - rc=`cat result` - # renew mariadb image in the cache (why? to renew the timestamp???) - - echo mariadb:$(docker image ls mariadb | grep mariadb | awk '{print $2}') - - docker save mariadb:$(docker image ls mariadb | grep mariadb | awk '{print $2}') > /image-cache/mariadb.tar || true + # renew mariadb image in the cache (why? to renew the timestamp???) + - echo mariadb:$(docker image ls mariadb | grep mariadb | awk '{print $2}') + - docker save mariadb:$(docker image ls mariadb | grep mariadb | awk '{print $2}') > /image-cache/mariadb.tar || true - # exit with fail when errors exist - - exit $rc + # exit with fail when errors exist + - exit $rc timeout: 3h artifacts: paths: -- GitLab