Обновить README.md
This commit is contained in:
parent
767349763a
commit
873199b859
1 changed files with 104 additions and 0 deletions
104
README.md
104
README.md
|
|
@ -74,3 +74,107 @@ sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/
|
|||
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
|
||||
sudo gitlab-runner start
|
||||
```
|
||||
### Check server ip
|
||||
```
|
||||
hostname -I
|
||||
```
|
||||
|
||||
## Get registration token
|
||||
1. open project
|
||||
2. Settings -> CI/CD -> runners -> New project runner
|
||||
3. copy token
|
||||
4. remember gitlab url(which one you use to open gitlab in browser or use IP)
|
||||
|
||||
## Register runner
|
||||
|
||||
```
|
||||
sudo gitlab-runner register
|
||||
```
|
||||
#### There will be questions
|
||||
```plain
|
||||
Enter the GitLab instance URL: http://10.0.2.15:85 <-- insert yours IP!
|
||||
Enter the registration token: [вставь токен]
|
||||
Enter a description: ubuntu-runner
|
||||
Enter tags: docker
|
||||
Enter optional maintenance note:
|
||||
Registering runner... succeeded
|
||||
Enter an executor: docker
|
||||
Enter the default Docker image: docker:latest
|
||||
```
|
||||
## Setup config (URGENT)
|
||||
|
||||
```
|
||||
sudo nano /etc/gitlab-runner/config.toml
|
||||
```
|
||||
|
||||
Set it like this
|
||||
|
||||
```toml
|
||||
concurrent = 1
|
||||
check_interval = 0
|
||||
shutdown_timeout = 0
|
||||
|
||||
[session_server]
|
||||
session_timeout = 1800
|
||||
|
||||
[[runners]]
|
||||
name = "ubuntu-runner"
|
||||
url = "http://10.0.2.15:85" # <-- IP instead of localhost!
|
||||
token = "glrt-..." # <-- your token - do not touch it!
|
||||
executor = "docker"
|
||||
clone_url = "http://10.0.2.15:85" # <-- add this line!
|
||||
|
||||
[runners.docker]
|
||||
image = "docker:latest"
|
||||
privileged = true # <-- needs for Docker-in-Docker
|
||||
extra_hosts = ["gitlab.local:10.0.2.15"] # <-- if you use gitlab.local
|
||||
|
||||
[runners.cache]
|
||||
[runners.cache.s3]
|
||||
[runners.cache.gcs]
|
||||
[runners.cache.azure]
|
||||
```
|
||||
**Change 10.0.2.15 to your IP from hostname -I**
|
||||
|
||||
### Restart runner
|
||||
```
|
||||
sudo gitlab-runner restart
|
||||
sudo gitlab-runner verify
|
||||
```
|
||||
|
||||
***Respond should be:***
|
||||
`verifying runner ... is valid runner=...`
|
||||
|
||||
#### In runner(Gitlab UI) allow untagged jobs
|
||||
1. Project -> Setting -> CI/CD -> Runners
|
||||
2. Find `ubuntu-runner`, click Edit
|
||||
3. Set mark in checkbox
|
||||
4. Save changes
|
||||
|
||||
## Test pipeline
|
||||
1. in project root(IDE) create `.gitlab-ci.yml`
|
||||
2. Put this code:
|
||||
```yaml
|
||||
hello:
|
||||
stage: test
|
||||
image: alpine:latest
|
||||
script:
|
||||
- echo "Runner works!"
|
||||
- echo "GitLab CI is alive!"
|
||||
```
|
||||
|
||||
**Then push**
|
||||
```
|
||||
git add .gtlab-ci.yml
|
||||
git commit -m "test runner"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
**After that go to Ci/CD -> Pipelines -> check if green pipeline appeared**
|
||||
|
||||
### Check if all works fine
|
||||
|
||||
```
|
||||
sudo gitlab-runner list
|
||||
sudo journalctl -u gitlab-runner -f
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue