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 10:47] val [GitLab Runner] |
инструмент_gitlab [2022/06/20 12:50] val [GitLab CI/CD] |
||
---|---|---|---|
Line 40: | 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]] |
<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><code> | ||
+ | root@server:~/openvpn1# cat .gitlab-ci.yml | ||
+ | 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><code> | ||
+ | vagrant@node1:~/project1$ cat .gitlab-ci.yml | ||
+ | </code><code> | ||
test1: | test1: | ||
stage: test | stage: test |