User Tools

Site Tools


инструмент_gitlab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
инструмент_gitlab [2022/06/26 18:55]
val
инструмент_gitlab [2022/07/13 08:58]
val [Пример docker]
Line 8: Line 8:
   * [[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]]
 +  * [[https://​www.techbeatly.com/​configure-custom-ssl-to-secure-gitlab-server/​|Configure Custom SSL to Secure GitLab Server]]
 +
 +===== Подключение =====
 +
 +  * [[https://​stackoverflow.com/​questions/​60062065/​gitlab-initial-root-password|gitlab initial root password]]
  
 <​code>​ <​code>​
Line 13: Line 18:
 </​code>​ </​code>​
  
-  * [[https://​www.techbeatly.com/​configure-custom-ssl-to-secure-gitlab-server/​|Configure Custom SSL to Secure GitLab Server]]+
  
 ===== Настройка ===== ===== Настройка =====
Line 99: Line 104:
  
   * [[https://​docs.gitlab.com/​ee/​ci/​examples/#​cicd-templates|CI/​CD templates]]   * [[https://​docs.gitlab.com/​ee/​ci/​examples/#​cicd-templates|CI/​CD templates]]
 +  * [[https://​stackoverflow.com/​questions/​64725914/​how-to-disable-auto-pipelines-in-gitlab|How to disable auto pipelines in gitlab]]
  
 ==== Пример shell make ==== ==== Пример shell make ====
Line 169: Line 175:
     - 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>​
 +
 +==== Пример 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
инструмент_gitlab.txt · Last modified: 2024/05/08 10:38 by val