This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
инструмент_gitlab [2022/07/13 08:52] val [GitLab CI/CD] |
инструмент_gitlab [2022/07/16 19:52] val [Установка] |
||
---|---|---|---|
Line 6: | Line 6: | ||
===== Установка ===== | ===== Установка ===== | ||
+ | * RAM от 4Gb | ||
* [[https://about.gitlab.com/install/|Install self-managed GitLab]] | * [[https://about.gitlab.com/install/|Install self-managed GitLab]] | ||
* Доступно из РФ: [[https://packages.gitlab.com/gitlab/gitlab-ce]] | * Доступно из РФ: [[https://packages.gitlab.com/gitlab/gitlab-ce]] | ||
Line 155: | Line 156: | ||
</code> | </code> | ||
- | ==== Пример docker ==== | + | ==== Пример shell docker ==== |
* Технология Docker [[Технология Docker#Предоставление прав непривилегированным пользователям]] | * Технология Docker [[Технология Docker#Предоставление прав непривилегированным пользователям]] | ||
Line 175: | Line 176: | ||
- echo $(date) "Do your deploy here" >> /tmp/Bash.gitlab-ci.log | - echo $(date) "Do your deploy here" >> /tmp/Bash.gitlab-ci.log | ||
- docker-compose up -d | - docker-compose up -d | ||
+ | tags: | ||
+ | - webddeploy | ||
+ | </code> | ||
+ | |||
+ | ==== Пример shell Kubernetes ==== | ||
+ | <code> | ||
+ | gitlab-runner@gate:~/webd$ cat build.sh | ||
+ | </code><code> | ||
+ | #!/bin/sh | ||
+ | |||
+ | VER="$(echo $CI_COMMIT_MESSAGE | sed 's/[^a-zA-Z0-9\.]//g')" | ||
+ | |||
+ | docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD http://$CI_REGISTRY | ||
+ | docker build -t $CI_REGISTRY/$CI_REGISTRY_IMAGE:$VER webd | ||
+ | docker push $CI_REGISTRY/$CI_REGISTRY_IMAGE:$VER | ||
+ | </code><code> | ||
+ | gitlab-runner@gate:~/webd$ cat my-webd-deployment-env.yaml | ||
+ | </code><code> | ||
+ | ... | ||
+ | image: server.corp13.un:5000/student/webd:$VER | ||
+ | </code><code> | ||
+ | gitlab-runner@gate:~/webd$ cat deploy.sh | ||
+ | </code><code> | ||
+ | #!/bin/sh | ||
+ | |||
+ | export VER="$(echo $CI_COMMIT_MESSAGE | sed 's/[^a-zA-Z0-9\.]//g')" | ||
+ | |||
+ | #envsubst < my-webd-deployment-env.yaml | kubectl apply -f - | ||
+ | #kubectl apply -f my-webd-service.yaml,my-webd-ingress.yaml | ||
+ | |||
+ | #export HELM_NAMESPACE=my-ns | ||
+ | #helm test my-webd && helm upgrade my-webd webd-chart/ --set=image.tag=$VER || helm install my-webd webd-chart/ --set=image.tag=$VER | ||
+ | </code><code> | ||
+ | gitlab-runner@gate:~/webd$ cat .gitlab-ci.yml | ||
+ | stages: | ||
+ | - lintertest | ||
+ | - build | ||
+ | - deploy | ||
+ | |||
+ | lintertest1: | ||
+ | stage: lintertest | ||
+ | script: | ||
+ | - echo $(date) "Do a test here" >> /tmp/Bash.gitlab-ci.log | ||
+ | - shellcheck webd/webd | ||
+ | tags: | ||
+ | - shellcheck | ||
+ | |||
+ | build1: | ||
+ | stage: build | ||
+ | script: | ||
+ | - echo $(date) "Do a build here" >> /tmp/Bash.gitlab-ci.log | ||
+ | - ./build.sh | ||
+ | tags: | ||
+ | - webddeploy | ||
+ | |||
+ | deploy1: | ||
+ | stage: deploy | ||
+ | script: | ||
+ | - echo $(date) "Do your deploy k8s here" >> /tmp/Bash.gitlab-ci.log | ||
+ | - ./deploy.sh | ||
tags: | tags: | ||
- webddeploy | - webddeploy |