Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.56 KiB
Newer Older
L4168's avatar
L4168 committed
stages:
L4168's avatar
L4168 committed
  - purge
L4168's avatar
L4168 committed
  - e2e-test
  - rf-test
  - push-results
L4168's avatar
L4168 committed

L4168's avatar
L4168 committed
purge-old-containers:
L4168's avatar
L4168 committed
  image:
    name: docker/compose:1.24.0
    entrypoint: ['/bin/sh', '-c']
L4168's avatar
L4168 committed
  services:
    - docker:dind
L4168's avatar
L4168 committed
  stage: purge
L4168's avatar
L4168 committed
  tags: ['docker']
L4168's avatar
L4168 committed
  only:
    - testing
L4168's avatar
L4168 committed
  script:
L4168's avatar
L4168 committed
    - docker-compose down
L4168's avatar
L4168 committed
  allow_failure: true
L4168's avatar
L4168 committed

L4168's avatar
L4168 committed
e2e-testing:
L4168's avatar
L4168 committed
  image:
    name: docker/compose:1.24.0
    entrypoint: ['/bin/sh', '-c']
L4168's avatar
L4168 committed
  services:
    - docker:dind
  stage: e2e-test
L4168's avatar
L4168 committed
  tags: ['compose']
L4168's avatar
L4168 committed
  only:
    - testing
L4168's avatar
L4168 committed
  script:
L4168's avatar
L4168 committed
    - printf "SECRET=%s\n" "$SECRET" > .env
L4168's avatar
L4168 committed
    - docker image prune -f
    - docker-compose build --no-cache
    - docker-compose up -d
L4168's avatar
L4168 committed
  after_script:
L4168's avatar
L4168 committed
    - sleep 3
    - echo "create database ehasa;" | docker exec -i postgis psql -U postgres
    - echo "create user ehasa;" | docker exec -i postgis psql -U postgres
    - echo "alter user ehasa with encrypted password 'salasana';" | docker exec -i postgis psql -U postgres
    - echo "grant all privileges on database ehasa to ehasa;" | docker exec -i postgis psql -U postgres
    - echo 'create extension "uuid-ossp";' | docker exec -i postgis psql -U postgres ehasa
L4168's avatar
L4168 committed
  allow_failure: true

rf-test:
  image: gitlab.labranet.jamk.fi:4567/wimma-lab-2019/mysticons/devsecops/robot
  stage: rf-test
  tags: ['docker']
  only:
    - testing
  script:
    - export ROBOT_TESTS=./tests
    - export OUTPUT_DIR=./results
    - run.sh
  artifacts:
    when: always
    untracked: true
    expire_in: 24h

push-results:
  stage: push-results
  tags: ['shell']
  only:
    - testing
  when: always
  script:
    - docker cp ./results front:/usr/share/nginx/html