Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stages:
- - build
- - test
- - deploy
- - clean
- variables:
- PROJECT_NAME: myproject$CI_BUILD_REF
- COMPOSE: docker-compose -p myproject$CI_BUILD_REF
- IMAGE_NAME: docker.io/redacted
- DEPLOY_WEBHOOK_DEV: redacted
- DEPLOY_WEBHOOK_STAGING: redacted
- build:
- stage: build
- script:
- - echo "Building $PROJECT_NAME with $COMPOSE"
- - $COMPOSE pull
- - $COMPOSE build node
- - $COMPOSE run --rm node npm run build
- - sleep 1
- - $COMPOSE build
- test_python:
- stage: test
- only:
- - branches
- script:
- - $COMPOSE up -d web
- - $COMPOSE run --rm node npm run build
- - $COMPOSE run --rm web python manage.py collectstatic --noinput
- - $COMPOSE run --rm web ./manage.py test
- test_js:
- stage: test
- only:
- - branches
- script:
- - $COMPOSE run --rm node npm run lint
- - $COMPOSE run --rm node npm run test
- deploy_dev:
- stage: deploy
- only:
- - dev
- script:
- - echo "Tag and push ${PROJECT_NAME}_web"
- - docker tag ${PROJECT_NAME}_web ${IMAGE_NAME}:dev
- - docker push ${IMAGE_NAME}:dev
- - "./bin/send-deploy-webhook.sh dev $DEPLOY_WEBHOOK_DEV"
- deploy_staging:
- stage: deploy
- only:
- - qa
- script:
- - echo "Tag and push ${PROJECT_NAME}_web"
- - docker tag ${PROJECT_NAME}_web ${IMAGE_NAME}qa
- - docker push ${IMAGE_NAME}:qa
- - "./bin/send-deploy-webhook.sh qa $DEPLOY_WEBHOOK_STAGING"
- clean_docker:
- stage: clean
- when: always
- script:
- - $COMPOSE stop
- - $COMPOSE down
- - $COMPOSE rm -f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement