ass cicd p2

This commit is contained in:
Sergey Bondarev
2021-12-14 14:56:14 +03:00
parent 4dc41b7a78
commit 18abde91e0
13 changed files with 692 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
# Деплой на production
## 1. Добавляем переменные и шаг деплоя на production кластер
```yaml
variables:
K8S_PROD_API_URL: https://ip.add.re.ss:6443
```
```yaml
deploy:prod:
stage: deploy
image: centosadmin/kubernetes-helm:3.6.3
environment:
name: production
script:
- kubectl config set-cluster k8s --insecure-skip-tls-verify=true --server=$K8S_PROD_API_URL
- kubectl config set-credentials ci --token=$K8S_PROD_CI_TOKEN
- kubectl config set-context ci --cluster=k8s --user=ci
- kubectl config use-context ci
- helm upgrade --install xpaste .helm
--set image=$CI_REGISTRY_IMAGE
--set imageTag=$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
--debug
--atomic
--timeout 120s
--namespace $NAMESPACE-$CI_ENVIRONMENT_SLUG
only:
- master
```
Или копируем готовый файл `.gitlab-ci.yml` в репозиторий xpaste.
Пушим, смотрим результат.