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/06/15 09:18] val [GitLab CI/CD] |
инструмент_gitlab [2022/06/20 12:51] val [GitLab CI/CD] |
||
---|---|---|---|
Line 20: | Line 20: | ||
* [[https://docs.gitlab.com/runner/install/linux-manually.html|Install GitLab Runner manually on GNU/Linux]] | * [[https://docs.gitlab.com/runner/install/linux-manually.html|Install GitLab Runner manually on GNU/Linux]] | ||
+ | |||
+ | * [[https://medium.com/@ryzmen/gitlab-fast-pipelines-stages-jobs-c51c829b9aa1|GitLab: understanding pipelines, stages, jobs and organising them efficiently for speed and feedback loop]] | ||
+ | |||
* [[https://val.bmstu.ru/unix/Git/gitlab-runner_amd64.deb]] (15.0.0) | * [[https://val.bmstu.ru/unix/Git/gitlab-runner_amd64.deb]] (15.0.0) | ||
Line 37: | Line 40: | ||
==== GitLab CI/CD ==== | ==== GitLab CI/CD ==== | ||
- | * [[https://docs.gitlab.com/ee/ci/examples/|GitLab CI/CD Examples]] | + | * [[https://docs.gitlab.com/ee/ci/examples/#cicd-templates|CI/CD templates]] |
+ | |||
+ | === Пример 1 === | ||
<code> | <code> | ||
- | vagrant@node1:~/project1$ cat .gitlab-ci.yml | + | student@gate:~/dhcp$ cat .gitlab-ci.yml |
- | #before_script: | + | </code><code> |
- | # - echo $(date) "Before script section" >> /tmp/Bash.gitlab-ci.log | + | test1: |
+ | stage: test | ||
+ | script: | ||
+ | - echo $(date) "Do test dhcpd" >> /tmp/Bash.gitlab-ci.log | ||
+ | - make test | ||
+ | tags: | ||
+ | - dhcptest | ||
- | #after_script: | + | deploy1: |
- | # - echo $(date) "After script section" >> /tmp/Bash.gitlab-ci.log | + | stage: deploy |
+ | script: | ||
+ | - echo $(date) "Do deploy dhcpd" >> /tmp/Bash.gitlab-ci.log | ||
+ | - sudo make install | ||
+ | tags: | ||
+ | - dhcpdeploy | ||
+ | </code> | ||
+ | |||
+ | === Пример 2 === | ||
+ | |||
+ | <code> | ||
+ | root@server:~/openvpn1# cat .gitlab-ci.yml | ||
+ | </code><code> | ||
+ | deploy_test: | ||
+ | stage: deploy | ||
+ | script: | ||
+ | - echo $(date) "Deploy TEST openvpn1" >> /tmp/Bash.gitlab-ci.log | ||
+ | - ansible-playbook openvpn1.yaml -i inventory.yaml -e "variable_host=test_nodes" | ||
+ | tags: | ||
+ | - openvpn1deploy | ||
+ | rules: | ||
+ | - if: ($CI_COMMIT_BRANCH == "test" && $CI_COMMIT_REF_NAME == "test") | ||
+ | |||
+ | deploy_prod: | ||
+ | stage: deploy | ||
+ | script: | ||
+ | - echo $(date) "Deploy PROD openvpn1" >> /tmp/Bash.gitlab-ci.log | ||
+ | - ansible-playbook openvpn1.yaml -i inventory.yaml | ||
+ | tags: | ||
+ | - openvpn1deploy | ||
+ | rules: | ||
+ | - if: ($CI_COMMIT_BRANCH == "main" && $CI_COMMIT_REF_NAME == "main") | ||
+ | </code> | ||
+ | |||
+ | === Пример 3 === | ||
+ | |||
+ | <code> | ||
+ | vagrant@node1:~/project1$ cat .gitlab-ci.yml | ||
+ | </code><code> | ||
test1: | test1: | ||
stage: test | stage: test |