diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be6348ffd3feb06356a40cff0176c03b0a64c5f3..c751db1d70f46cdb71e66abd9c8e99acf96ff212 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,32 @@ # ** end header # +variables: + CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-webui-testenv + # 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:latest + + stages: - setup - linting @@ -31,24 +57,7 @@ stages: # setup ####### -# install pylint -setup:install-pylint: - stage: setup - tags: [ py36 ] - script: - - pip3 install pylint --user - -######### -# linting -######### - -# pylint everything -linting:pylint:python3: - stage: linting - tags: [ py36 ] - script: - - make pylint - +### TODO !!! use respective docker image ###### # test ###### @@ -56,18 +65,41 @@ linting:pylint:python3: # run qunit tests test:qunit: stage: test - tags: [ py36 ] + #tags: [ py36 ] artifacts: paths: - public/qunit.log - screenlog.* script: - - make run-qunit + - make pylint +# TODO fix the following +# - make run-qunit trigger_build: stage: deploy script: + - echo $TOKEN - /usr/bin/curl -X POST -F token=$TOKEN - -F "variables[PYLIB]=$CI_COMMIT_REF_NAME" + -F "variables[WEBUI]=$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: + - echo $TRIGGERED_BY + - echo $MYSQLBACKEND + - ping -4 -c 3 registry.indiscale.com + - echo $PYLIB + - cd 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:latest || true + - docker build + --pull + --cache-from $CI_REGISTRY_IMAGE:latest + -t $CI_REGISTRY_IMAGE:latest . + - docker push $CI_REGISTRY_IMAGE:latest diff --git a/makefile b/makefile index 0ac93add0a18a83364684e819e3beef1d03b8fc2..0aaadadb5bfeee61fe6cb51846854a5677778470 100644 --- a/makefile +++ b/makefile @@ -173,11 +173,11 @@ unzip: for f in $(LIBS_ZIP); do unzip -o -d libs $$f; done -PYLINT = pylint -d all -e E,F +PYLINT = pylint3 -d all -e E,F PYTHON_FILES = $(subst $(ROOT_DIR)/,,$(shell find $(ROOT_DIR)/ -iname "*.py")) pylint: $(PYTHON_FILES) for f in $(PYTHON_FILES); do $(PYLINT) $$f || exit 1; done -PYLINT_LOCAL = /usr/bin/pylint -d all -e E,F +PYLINT_LOCAL = /usr/bin/pylint3 -d all -e E,F pylint-local: $(PYTHON_FILES) for f in $(PYTHON_FILES); do $(PYLINT_LOCAL) $$f || exit 1; done diff --git a/test/docker/Dockerfile b/test/docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3d053e62a367e759905728bd53a5d064b54321d5 --- /dev/null +++ b/test/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM debian:latest +RUN apt-get update && \ + apt-get install firefox-esr pylint3 python3-pip python3-httpbin git \ + curl -y +RUN git clone -b dev https://gitlab.gwdg.de/bmp-caosdb/caosdb-pylib.git && \ + cd caosdb-pylib && pip3 install . +