.gitlab.yml
에 stage를 정의했었다.
각 stage 구체화 하자.
image
, script
를 변경시킨다.
이번 stage에서 사용될 이미지는 도커 이미지다.
Test and Lint:
image: docker:20.10.0
services:
- docker:20.10.0-dind
stage: Test and Lint
script:
- apk add python3-dev py-pip libffi-dev openssl-dev gcc libc-dev make
- pip3 install -I docker-compose==1.26.2
- docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py test && flake8"
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^(master|production)$/ || $CI_COMMIT_BRANCH =~ /^(master|production)$/'
Validate Terraform:
stage: Test and Lint
script:
- cd deploy/
- terraform init -backend=false
- terraform validate
- terraform fmt -check
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^(master|production)$/ || $CI_COMMIT_BRANCH =~ /^(master|production)$/'