.gitlab-ci.yml 1.59 KB
Newer Older
Andreas Böttger's avatar
Andreas Böttger committed
1 2 3 4 5 6 7 8 9 10 11 12
variables:
    REVIEW_IMAGE: docker.rz.tu-harburg.de:5000/docker/jekyll
    DOCKER_CONTAINER_NAME: ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG}

stages:
    - review
    - deploy
    
review:start:
    stage: review
    script:
        - pwd
Alexander Lehning's avatar
Alexander Lehning committed
13
        - sudo docker run --detach --rm --env VIRTUAL_HOST=${CI_ENVIRONMENT_SLUG} --name ${DOCKER_CONTAINER_NAME} ${REVIEW_IMAGE}:latest || true
Andreas Böttger's avatar
Andreas Böttger committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
        - sudo docker cp . ${DOCKER_CONTAINER_NAME}:/opt/app
        - sudo docker exec ${DOCKER_CONTAINER_NAME} bundle install --gemfile=/opt/app/Gemfile
    #when: manual
    environment:
        name: review/${CI_COMMIT_REF_NAME}
        url: http://${CI_ENVIRONMENT_SLUG}.collaborating.tuhh.de
        on_stop: review:stop
    only:
        - branches
    tags:
        - development
        - ssg
    except:
        - master

review:stop:
    stage: review
    variables:
        GIT_STRATEGY: none
    script:
        - sudo docker stop ${DOCKER_CONTAINER_NAME}
    when: manual
    environment:
        name: review/${CI_COMMIT_REF_NAME}
        action: stop
    only:
        - branches
    tags:
        - development
        - ssg
    except:
        - master
    
Andreas Böttger's avatar
Andreas Böttger committed
47
    
Andreas Böttger's avatar
Andreas Böttger committed
48 49 50 51 52 53 54 55 56 57 58 59 60
#deploy:
#    stage: deploy
#    only:
#        - master
#    tags:
#        - production
#    script:
#        - pwd
#        - sshpass -p "$SSH_PASSWD" ssh -p "$SSH_PORT" $SSH_USER@$HOST_NAME "mkdir -p /usr/share/nginx/html/production"
#        - sshpass -p "$SSH_PASSWD" scp -P "$SSH_PORT" -r _site/* $SSH_USER@$HOST_NAME:/usr/share/nginx/html/production
#    environment:
#        name: production
#        url: https://$PROXY_HOST_NAME/$CI_PROJECT_PATH/