diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..14ae750aa7f2f0c8262895c9b64a2a7f6e094d0f --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:stretch +RUN apt-get update && \ + apt-get install curl -y diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50d119aae3fbfa99bf3bf8c122b4aa14f4ae0b5d..2c4bb50e9d71d4cbc41c6d8ced00f23fa4bda84c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,137 +20,54 @@ # # ** end header # -stages: - - configure - - test - - setup - - clean - -########################### -# configure -########################### - -configure:mysql55: - stage: configure - tags: [ mysql55 ] - artifacts: - paths: - - .config.mysql55 - script: - - printf "\n\n\n\n\n\n\n\n\n$MYSQL_USER_PASSWORD" > .user_input - - ./configure < .user_input - - test -f .config - - cp .config .config.mysql55 -configure:mariadb10.1: - stage: configure - tags: [ maria10.1 ] - artifacts: - paths: - - .config.mariadb10.1 - script: - - printf "\n\n\n\n\ncaosdb-root\n\n\n\n$MYSQL_USER_PASSWORD" > .user_input - - ./configure < .user_input - - test -f .config - - cp .config .config.mariadb10.1 +variables: + CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-mysqlbackend-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 -########################## -# test -########################## - -# test the connection -test:test-connection:mysql55: - stage: test - tags: [ mysql55 ] - dependencies: - - configure:mysql55 - script: - - cp .config.mysql55 .config - - make test-connection - -test:test-connection:mariadb10.1: - stage: test - tags: [ maria10.1 ] - dependencies: - - configure:mariadb10.1 - script: - - cp .config.mariadb10.1 .config - - make test-connection - -######################### -# setup -######################### +image: $CI_REGISTRY_IMAGE +stages: + - setup + - deploy -# install without patches and drop -setup:install:mysql55: - stage: setup - tags: [ mysql55 ] - dependencies: - - configure:mysql55 - script: - - cp .config.mysql55 .config - - export $(sed -n '/DATABASE_NAME/p ' .config) - - make _install - - make drop-$DATABASE_NAME - -setup:install:mariadb10.1: - stage: setup - tags: [ maria10.1 ] - dependencies: - - configure:mariadb10.1 - script: - - cp .config.mariadb10.1 .config - - export $(sed -n '/DATABASE_NAME/p ' .config) - - make _install - - make drop-$DATABASE_NAME +trigger_build: + stage: deploy + script: + - /usr/bin/curl -X POST + -F token=8f29e5eeb7db2123d9c2bb84634da2 + -F "variables[MYSQLBACKEND]=$CI_COMMIT_REF_NAME" + -F "variables[TriggerdBy]=MYSQLBACKEND" + -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline -# upgrade database with patches and drop -setup:install_upgrade:mysql55: - stage: setup - tags: [ mysql55 ] - dependencies: - - configure:mysql55 - script: - - cp .config.mysql55 .config - - export $(sed -n '/DATABASE_NAME/p ' .config) - - make install - - make drop-$DATABASE_NAME - -setup:install_upgrade:mariadb10.1: +build-testenv: + image: docker:latest stage: setup - tags: [ maria10.1 ] - dependencies: - - configure:mariadb10.1 - script: - - cp .config.mariadb10.1 .config - - export $(sed -n '/DATABASE_NAME/p ' .config) - - make install - - make drop-$DATABASE_NAME - -############################### -# cleanup -############################### - -# drop database -clean:drop:mysql55: - stage: clean - when: always - tags: [ mysql55 ] - dependencies: - - configure:mysql55 - script: - - cp .config.mysql55 .config - - export $(sed -n '/DATABASE_NAME/p ' .config) - - if make _exists; then make drop-$DATABASE_NAME ; fi - -clean:drop:mariadb10.1: - stage: clean - when: always - tags: [ maria10.1 ] - dependencies: - - configure:mariadb10.1 - script: - - cp .config.mariadb10.1 .config - - export $(sed -n '/DATABASE_NAME/p ' .config) - - if make _exists; then make drop-$DATABASE_NAME ; fi \ No newline at end of file + script: + - cd .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