Gitlab runner持续集成CI/CD怎么设置标签指定Runner节点执行

搭建Runner参考:
https://www.cnblogs.com/minseo/p/18472436

需求:

  • 未打标签的.gitlab-ci使用默认runner
  • 打标签的.gitlab-ci使用指定的runner
  1. 环境查看
    系统环境
# cat /etc/redhat-release 
Rocky Linux release 9.3 (Blue Onyx)
# uname -a
Linux Rocky9StoneCrm003080 5.14.0-362.18.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Feb 11 13:49:23 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

软件环境

# git version
# git version 2.43.5
  1. 配置Runner
# http://ip/admin

新建全局runner
image
不要勾选"运行未打标签的作业"
image
下一步在Runner端执行命令创建runner
3. 编写.gitlab-ci
配置tags即可使用打标签的runner执行作业

# cat .gitlab-ci.yml 
# cat .gitlab-ci.yml 
stages:
  - build
  - test
  - deploy

build:
  tags:
    - prd
  stage: build
  script:
    - echo "Build Test2dd"

test:
  tags:
    - prd
  stage: test
  script:
    - echo "Test"

deploy:
  tags:
    - prd
  stage: deploy
  script:
    - echo "Deploy2a"

image

posted @   minseo  阅读(81)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
历史上的今天:
2017-12-20 Python全栈day10(Pycharm的安装和使用)
点击右上角即可分享
微信分享提示