Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
CTB
ctb-platform-backend-antigo
Commits
09376c65
Commit
09376c65
authored
6 years ago
by
Bruno Martin
Browse files
Options
Download
Email Patches
Plain Diff
set gitlab ci
parent
e4e79bd6
develop
master
v0.5.1
v0.5.0
v0.4.0
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.1
v0.2.0
v0.1.0
No related merge requests found
Pipeline
#7377
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
85 deletions
+44
-85
.gitlab-ci.yml
.gitlab-ci.yml
+44
-85
No files found.
.gitlab-ci.yml
View file @
09376c65
...
...
@@ -9,117 +9,76 @@ stages:
variables
:
DJANGO_RELEASE_IMAGE
:
$CI_REGISTRY_IMAGE/django:$CI_BUILD_REF_NAME
NGINX_RELEASE_IMAGE
:
$CI_REGISTRY_IMAGE/nginx:$CI_BUILD_REF_NAME
DJANGO_HOMOLOG_IMAGE
:
$CI_REGISTRY_IMAGE/django:$CI_BUILD_REF_NAME-$CI_COMMIT_SHORT_SHA
NGINX_hOMOLOG_IMAGE
:
$CI_REGISTRY_IMAGE/nginx:$CI_BUILD_REF_NAME-$CI_COMMIT_SHORT_SHA
KUBECONFIG
:
/etc/k8s-config
##########
###
##
Production
##########
###
build to
production
:
##########
##
Homolog
##########
build to
homolog
:
stage
:
build
script
:
-
docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
-
docker build -f compose/production/Dockerfile --target django -t $DJANGO_RELEASE_IMAGE .
-
docker tag $DJANGO_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/django:latest"
-
docker push $DJANGO_RELEASE_IMAGE
-
docker push "$CI_REGISTRY_IMAGE/django:latest"
-
docker build -f compose/production/Dockerfile --target nginx -t $NGINX_RELEASE_IMAGE .
-
docker tag $NGINX_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/nginx:latest"
-
docker push $NGINX_RELEASE_IMAGE
-
docker push "$CI_REGISTRY_IMAGE/nginx:latest"
-
docker build -f compose/production/Dockerfile --target django -t $DJANGO_HOMOLOG_IMAGE .
-
docker push $DJANGO_HOMOLOG_IMAGE
-
docker build -f compose/production/Dockerfile --target nginx -t $NGINX_HOMOLOG_IMAGE .
-
docker push $NGINX_HOMOLOG_IMAGE
only
:
-
tags
environment
:
production
-
/master/
environment
:
homolog
variables
:
GIT_SUBMODULE_STRATEGY
:
recursive
tags
:
-
docker
# deploy to production:
# stage: deploy
# image: cdrx/rancher-gitlab-deploy
# script:
# - upgrade --environment <env_name> --stack <stack_name> --service <service_name> --no-finish-upgrade --sidekicks
# only:
# - tags
# environment: production
# variables:
# GIT_STRATEGY: none
# tags:
# - docker
deploy to homolog
:
stage
:
deploy
image
:
hacklab/kubectl:latest
script
:
-
echo ${kube_config} | base64 -d > ${KUBECONFIG}
-
kubectl -n ctb-escola-dev --record deployment.apps/django set image deployment.v1.apps/django django=$DJANGO_HOMOLOG_IMAGE nginx=$NGINX_HOMOLOG_IMAGE
only
:
-
/master/
environment
:
homolog
variables
:
GIT_STRATEGY
:
none
tags
:
-
docker
##########
##
Homolog
##########
build to
homolog
:
##########
###
##
Production
##########
###
build to
production
:
stage
:
build
script
:
-
docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
-
docker build -f compose/production/Dockerfile --target django -t $DJANGO_RELEASE_IMAGE .
-
docker tag $DJANGO_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/django:
master
"
-
docker tag $DJANGO_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/django:
latest
"
-
docker push $DJANGO_RELEASE_IMAGE
-
docker push "$CI_REGISTRY_IMAGE/django:
master
"
-
docker push "$CI_REGISTRY_IMAGE/django:
latest
"
-
docker build -f compose/production/Dockerfile --target nginx -t $NGINX_RELEASE_IMAGE .
-
docker tag $NGINX_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/nginx:
master
"
-
docker tag $NGINX_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/nginx:
latest
"
-
docker push $NGINX_RELEASE_IMAGE
-
docker push "$CI_REGISTRY_IMAGE/nginx:
master
"
-
docker push "$CI_REGISTRY_IMAGE/nginx:
latest
"
only
:
-
/master/
environment
:
homolog
-
tags
environment
:
production
variables
:
GIT_SUBMODULE_STRATEGY
:
recursive
tags
:
-
docker
# test to homolog:
# stage: test
# script:
# - docker build -f compose/test/django/Dockerfile -t $DJANGO_RELEASE_IMAGE .
# - docker tag $DJANGO_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/django:test"
# - docker run -d --env-file=./compose/test/test_env --name=postgres postgres:9.6
# - docker run --env-file=./compose/test/test_env --link=postgres:postgres "$CI_REGISTRY_IMAGE/django:test" /test.sh
# only:
# - /master/
# environment: homolog
# variables:
# GIT_STRATEGY: none
# tags:
# - docker
# deploy to homolog:
# stage: deploy
# image: cdrx/rancher-gitlab-deploy
# script:
# - upgrade --environment <env_name> --stack <stack_name> --service <service_name> --no-finish-upgrade --sidekicks
# only:
# - /master/
# environment: homolog
# tags:
# - docker
##########
## Develop
##########
build to develop
:
stage
:
build
deploy to production
:
stage
:
deploy
image
:
hacklab/kubectl:latest
script
:
-
docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
-
docker build -f compose/test/django/Dockerfile -t $DJANGO_RELEASE_IMAGE .
-
docker tag $DJANGO_RELEASE_IMAGE "$CI_REGISTRY_IMAGE/django:develop"
-
docker push "$CI_REGISTRY_IMAGE/django:develop"
-
echo ${kube_config} | base64 -d > ${KUBECONFIG}
-
kubectl -n ctb-escola-prod --record deployment.apps/django set image deployment.v1.apps/django django=$DJANGO_RELEASE_IMAGE nginx=$NGINX_RELEASE_IMAGE
only
:
-
/develop/
environment
:
development
-
tags
environment
:
production
variables
:
GIT_
SUBMODULE_
STRATEGY
:
recursiv
e
GIT_STRATEGY
:
non
e
tags
:
-
docker
# test to develop:
# stage: test
# script:
# - docker run -d --env-file=./compose/test/test_env --name=postgres postgres:9.6
# - docker run --env-file=./compose/test/test_env --link=postgres:postgres "$CI_REGISTRY_IMAGE/django:develop" /test.sh
# only:
# - /develop/
# environment: development
# tags:
# - docker
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment