SHARE
TWEET

Untitled

a guest Apr 1st, 2016 823 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stages:
  2.  - build
  3.   - test
  4.   - deploy
  5.   - clean
  6.  
  7. variables:
  8.   PROJECT_NAME: myproject$CI_BUILD_REF
  9.   COMPOSE: docker-compose -p myproject$CI_BUILD_REF
  10.   IMAGE_NAME: docker.io/redacted
  11.   DEPLOY_WEBHOOK_DEV: redacted
  12.   DEPLOY_WEBHOOK_STAGING: redacted
  13.  
  14. build:
  15.   stage: build
  16.   script:
  17.    - echo "Building $PROJECT_NAME with $COMPOSE"
  18.     - $COMPOSE pull
  19.     - $COMPOSE build node
  20.     - $COMPOSE run --rm node npm run build
  21.     - sleep 1
  22.     - $COMPOSE build
  23.  
  24. test_python:
  25.   stage: test
  26.   only:
  27.    - branches
  28.   script:
  29.    - $COMPOSE up -d web
  30.     - $COMPOSE run --rm node npm run build
  31.     - $COMPOSE run --rm web python manage.py collectstatic --noinput
  32.     - $COMPOSE run --rm web ./manage.py test
  33.  
  34. test_js:
  35.   stage: test
  36.   only:
  37.    - branches
  38.   script:
  39.    - $COMPOSE run --rm node npm run lint
  40.     - $COMPOSE run --rm node npm run test
  41.  
  42. deploy_dev:
  43.   stage: deploy
  44.   only:
  45.    - dev
  46.   script:
  47.    - echo "Tag and push ${PROJECT_NAME}_web"
  48.     - docker tag ${PROJECT_NAME}_web ${IMAGE_NAME}:dev
  49.     - docker push ${IMAGE_NAME}:dev
  50.     - "./bin/send-deploy-webhook.sh dev $DEPLOY_WEBHOOK_DEV"
  51.  
  52. deploy_staging:
  53.   stage: deploy
  54.   only:
  55.    - qa
  56.   script:
  57.    - echo "Tag and push ${PROJECT_NAME}_web"
  58.     - docker tag ${PROJECT_NAME}_web ${IMAGE_NAME}qa
  59.     - docker push ${IMAGE_NAME}:qa
  60.     - "./bin/send-deploy-webhook.sh qa $DEPLOY_WEBHOOK_STAGING"
  61.  
  62. clean_docker:
  63.   stage: clean
  64.   when: always
  65.   script:
  66.    - $COMPOSE stop
  67.     - $COMPOSE down
  68.     - $COMPOSE rm -f
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top