diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c9b2adda3fdea532fadf76cd7afea661c3761ea..a040a4a58b374c268d202e3ef7ade8d97dd1805b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ # # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen +# Copyright (C) 2019 Henrik tom Wörden # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,63 +23,58 @@ # variables: - CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-server-testenv:latest - # When using dind service we need to instruct docker, to talk with the - # daemon started inside of the service. The daemon is available with - # a network connection instead of the default /var/run/docker.sock socket. - # - # The 'docker' hostname is the alias of the service container as described at - # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services - # - # Note that if you're using the Kubernetes executor, the variable should be set to - # tcp://localhost:2375/ because of how the Kubernetes executor connects services - # to the job container - # DOCKER_HOST: tcp://localhost:2375/ - # - # For non-Kubernetes executors, we use tcp://docker:2375/ - DOCKER_HOST: tcp://docker:2375/ - # When using dind, it's wise to use the overlayfs driver for - # improved performance. - DOCKER_DRIVER: overlay2 + CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-server-testenv:latest + # With dind the docker deamon is available on the network + DOCKER_HOST: tcp://docker:2375/ + # When using dind, it's wise to use the overlayfs driver for + # improved performance. + DOCKER_DRIVER: overlay2 services: - - docker:dind + - docker:dind image: $CI_REGISTRY_IMAGE stages: - - setup - - test - - deploy + - setup + - test + - deploy +# run unit tests of the server test: - stage: test - script: - - make easy-units - - mvn dependency:purge-local-repository - - mvn antlr4:antlr4 - - mvn compile - - echo "defaultRealm = CaosDB" > conf/ext/usersources.ini - - mvn test + tags: [ docker ] + stage: test + script: + - make easy-units + - mvn dependency:purge-local-repository + - mvn antlr4:antlr4 + - mvn compile + - echo "defaultRealm = CaosDB" > conf/ext/usersources.ini + - mvn test +# Trigger building of server image and integration tests trigger_build: + tags: [ docker ] stage: deploy script: - /usr/bin/curl -X POST - -F token=8f29e5eeb7db2123d9c2bb84634da2 - -F "variables[SERVER]=$CI_COMMIT_REF_NAME" - -F "variables[TriggerdBy]=SERVER" - -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline + -F token=8f29e5eeb7db2123d9c2bb84634da2 + -F "variables[SERVER]=$CI_COMMIT_REF_NAME" + -F "variables[TriggerdBy]=SERVER" + -F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA" + -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline +# Build a docker image in which tests for this repository can run build-testenv: - image: docker:latest - stage: setup - script: - - cd src/test/docker - - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - # use here general latest or specific branch latest... - - docker pull $CI_REGISTRY_IMAGE || true - - docker build - --pull - --cache-from $CI_REGISTRY_IMAGE - -t $CI_REGISTRY_IMAGE . - - docker push $CI_REGISTRY_IMAGE + tags: [ docker ] + image: docker:latest + stage: setup + script: + - cd src/test/docker + - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + # use here general latest or specific branch latest... + - docker pull $CI_REGISTRY_IMAGE || true + - docker build + --pull + --cache-from $CI_REGISTRY_IMAGE + -t $CI_REGISTRY_IMAGE . + - docker push $CI_REGISTRY_IMAGE