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
инструмент_gitlab [2025/03/17 18:51]
val [Пример CI с использованием контейнеров]
инструмент_gitlab [2025/07/29 09:16] (current)
val [Установка из пакета]
Line 24: Line 24:
 server# time EXTERNAL_URL="​http://​$(hostname)"​ apt-get install gitlab-ce server# time EXTERNAL_URL="​http://​$(hostname)"​ apt-get install gitlab-ce
 ... ...
-real    ​38m49.787s  !!! Загрузка может прерываться,​ надо повторять команду !!!+real    ​122m54.883s  !!! Загрузка может прерываться,​ надо повторять команду !!!
 .. ..
 </​code>​ </​code>​
Line 260: Line 260:
 <​code>​ <​code>​
 # wget http://​gate.isp.un/​unix/​Git/​gitlab-runner_amd64.deb ​              # Version: 17.3.1-1 # wget http://​gate.isp.un/​unix/​Git/​gitlab-runner_amd64.deb ​              # Version: 17.3.1-1
- 
-##2 часа## curl -LJO "​https://​gitlab-runner-downloads.s3.amazonaws.com/​latest/​deb/​gitlab-runner_amd64.deb"​ 
  
 # dpkg -i gitlab-runner_amd64.deb # dpkg -i gitlab-runner_amd64.deb
 +
 +## Может занять 2 часа ## 
 +# ###curl -LJO "​https://​s3.dualstack.us-east-1.amazonaws.com/​gitlab-runner-downloads/​latest/​deb/​gitlab-runner-helper-images.deb"​
 +# ###curl -LJO "​https://​s3.dualstack.us-east-1.amazonaws.com/​gitlab-runner-downloads/​latest/​deb/​gitlab-runner_amd64.deb"​
 +# ###dpkg -i gitlab-runner-helper-images.deb gitlab-runner_amd64.deb
 </​code>​ </​code>​
 ==== Регистрация ==== ==== Регистрация ====
Line 537: Line 540:
 ==== Пример shell Kubernetes ==== ==== Пример shell Kubernetes ====
  
 +<​code>​
 +kube1:​~/​gowebd-k8s#​ cat .gitlab-ci.yml
 +</​code><​code>​
 +stages:
 +  - deploy
 +
 +#variables:
 +#  HELM_NAMESPACE:​ "​my-ns"​
 +
 +trigger-deploy:​
 +  stage: deploy
 +  rules:
 +    - if: '​$CI_PIPELINE_SOURCE == "​pipeline"​ && $VER'
 +  script:
 +    - env
 +    - envsubst < my-webd-deployment-env.yaml | kubectl apply -f - -n my-ns
 +#    - helm upgrade -i my-webd webd-chart/ --set=image.tag=$VER --create-namespace
 +  tags:
 +    - k8s-deploy
 +
 +manual-deploy:​
 +  stage: deploy
 +  when: manual
 +  variables:
 +    VER: "​$MY_WEBD_VER" ​ # New Pipeline or Settings->​CI/​CD->​Variables
 +  script:
 +    - env
 +    - envsubst < my-webd-deployment-env.yaml | kubectl apply -f - -n my-ns
 +#    - helm upgrade -i my-webd webd-chart/ --set=image.tag=$VER --create-namespace
 +  tags:
 +    - k8s-deploy
 +</​code>​
 +
 +== старый вариант ==
 <​code>​ <​code>​
 gitlab-runner@server:​~/​webd$ cp my-webd-deployment.yaml my-webd-deployment-env.yaml gitlab-runner@server:​~/​webd$ cp my-webd-deployment.yaml my-webd-deployment-env.yaml
Line 588: Line 625:
 stages: stages:
 #  - lint #  - lint
 +#  - prebuildtest
   - build   - build
 #  - test #  - test
Line 692: Line 730:
 #    - tags #    - tags
  
 +#Unit test:
 +#  stage: prebuildtest
 +#  script:
 +#    - export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
 +#    - poetry install
 +#    - poetry run python3 -m unittest
 +#  except:
 +#    - tags
 +#  tags:
 +#    - build
  
 #Deploy: #Deploy:
инструмент_gitlab.1742226684.txt.gz · Last modified: 2025/03/17 18:51 by val