Skip to content

Commit

Permalink
Merge branch 'develop' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurVardevanyan committed Oct 5, 2021
2 parents bfac086 + cc95bcc commit 7c068e2
Showing 1 changed file with 34 additions and 14 deletions.
48 changes: 34 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ stages:
- test
- build
- push
- deploy

PythonTests:
stage: test
Expand All @@ -28,43 +29,62 @@ PythonTests:
script:
- python3 manage.py test

before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY

DockerBuild:
stage: build
image: docker:latest
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:dind
alias: docker
command: ["--tls=false"]
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH || true
- docker build --network host --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA

PushLatest:
variables:
GIT_STRATEGY: none
PushProduction:
stage: push
image: docker:latest
variables:
GIT_STRATEGY: none
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:dind
alias: docker
command: ["--tls=false"]
only:
- production
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH

PushDevelop:
variables:
GIT_STRATEGY: none
stage: push
image: docker:latest
variables:
GIT_STRATEGY: none
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:dind
alias: docker
command: ["--tls=false"]
only:
- develop
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:develop
- docker push $CI_REGISTRY_IMAGE:develop
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH

0 comments on commit 7c068e2

Please sign in to comment.