From 9eadb436de1f4ee08d51373c64f494e18e8d6464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Tue, 16 Jul 2019 17:03:44 +0200 Subject: [PATCH] ci --- .gitlab-ci.yml | 52 ++++++++++++++++++++++++++++---------- src/test/docker/Dockerfile | 4 +++ 2 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 src/test/docker/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ceb74265..424da6b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,30 @@ # # ** end header # +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 + +services: + - docker:dind + +image: $CI_REGISTRY_IMAGE stages: - setup - code-generation @@ -85,23 +109,25 @@ test:server: - echo "defaultRealm = CaosDB" > conf/ext/usersources.ini - mvn test -########### -# Clean -########### -clean:mvn: - tags: [ java10 ] - stage: clean - when: always - dependencies: [] - script: - - mvn clean - trigger_build: stage: deploy script: - /usr/bin/curl -X POST -F token=8f29e5eeb7db2123d9c2bb84634da2 - -F "variables[TRIGGER_REPO]=$CI_PROJECT_NAME" - -F "variables[TRIGGER_BRANCH]=$CI_COMMIT_REF_NAME" + -F "variables[SERVER]=$CI_COMMIT_REF_NAME" -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline +build-testenv: + image: docker:latest + stage: setup + script: + - cd src/test/docker + - echo $CI_REGISTRY_PASSWORD + - echo $CI_REGISTRY + - 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 + --cache-from $CI_REGISTRY_IMAGE + -t $CI_REGISTRY_IMAGE . + - docker push $CI_REGISTRY_IMAGE diff --git a/src/test/docker/Dockerfile b/src/test/docker/Dockerfile new file mode 100644 index 00000000..8be92ff9 --- /dev/null +++ b/src/test/docker/Dockerfile @@ -0,0 +1,4 @@ +FROM debian:latest +RUN apt-get update && \ + apt-get install git make mariadb-server maven openjdk-8-jdk-headless \ + python3-pip screen libpam0g-dev unzip -y -- GitLab