GitLabRunner 类型

  • shared : 运行整个平台项目的作业(gitlab)
  • group: 运行特定group下的所有项目的作业(group)
  • specific: 运行指定的项目作业(project)
  • locked: 无法运行项目作业
  • paused: 不会运行作业

获取runner token

获取shared类型runner token

  • 进入系统设置-Runners-复制token
    file

获取group类型的runner token

  • 进入一个group
    file

  • 进入setting-CICD-展开Runners抽屉,复制runner token
    file

获取specific类型的runner token

  • 进入具体的项目
    file

  • 依次进入Settings-CI/CD-展开Runners抽屉-复制runner token
    file

进行注册

命令行交互注册

gitlab-runner register                                                                                  [127]
Runtime platform                                    arch=amd64 os=linux pid=15262 revision=f5da3c5a version=16.6.1
WARNING: Running in user-mode.                     
WARNING: The user-mode requires you to manually start builds processing: 
WARNING: $ gitlab-runner run                       
WARNING: Use sudo for system-mode:                 
WARNING: $ sudo gitlab-runner...                   

Created missing unique system ID                    system_id=s_0e1e8c8b8eab
Enter the GitLab instance URL (for example, https://gitlab.com/):
http://192.168.188.131 
Enter the registration token:
atRPbBgGvmUczLs12gC9
Enter a description for the runner:
[localhost.localdomain]: devops-service-runner
Enter tags for the runner (comma-separated):
build
Enter optional maintenance note for the runner:
note
WARNING: Support for registration tokens and runner parameters in the 'register' command has been deprecated in GitLab Runner 15.6 and will be replaced with support for authentication tokens. For more information, see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow 
Registering runner... succeeded                     runner=atRPbBgG
Enter an executor: custom, docker, docker-windows, virtualbox, docker-autoscaler, instance, kubernetes, parallels, shell, ssh, docker+machine:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

Configuration (with the authentication token) was saved in "/home/left/.gitlab-runner/config.toml"
  • 效果
    file

直接注册

gitlab-runner register \
  --non-interactive \
  --executor "shell" \
  --url "http://192.168.188.131/" \
  --registration-token "atRPbBgGvmUczLs12gC9" \
  --description "devops-runner" \
  --tag-list "build,deploy" \
  --run-untagged="true" \
  --locked="false" \
  --access-level="not_protected"
  • 效果
    file

参考资料

GitLabRunner注册

Categories:

Tags:

还没发表评论,快来发表第一个评论吧~

发表回复