当前位置: 首页 > news >正文

使用GitHub Actions的Self-hosted runner

  1. 登录github网站选择项目点击Settings按钮,进入设置页面
  2. 点击actions/runners进入Runners页面
  3. 点击New self-hosted runner按钮进入新增页面
  4. 选择相应配置,生成相应的命令,在内网机器上运行
  • 下载:

    # Create a folder
    $ mkdir actions-runner && cd actions-runner# Download the latest runner package
    $ curl -o actions-runner-linux-x64-2.319.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.319.1/actions-runner-linux-x64-2.319.1.tar.gz# Optional: Validate the hash
    $ echo "3f6efb7488a183e291fc2c62876e14c9ee732864173734facc85a1bfb1744464  actions-runner-linux-x64-2.319.1.tar.gz" | shasum -a 256 -c# Extract the installer
    $ tar xzf ./actions-runner-linux-x64-2.319.1.tar.gz
    Configure
    
  • 配置

    # Create the runner and start the configuration experience
    $ ./config.sh --url https://github.com/xxxx/deployWeb --token AGIAQ3S7N4IAHW7REWDQQP3GZAL7Y# Last step, run it!
    $ ./run.sh
    
    • 运行./config.sh --url https://github.com/xxxx/deployWeb --token AGIAQ3S7N4IAHW7REWDQQP3GZAL7Y输出:Must not run with sudo,改用RUNNER_ALLOW_RUNASROOT=true ./config.sh --url https://github.com/xxxx/deployWeb --token AGIAQ3S7N4IAHW7REWDQQP3GZAL7Y 参考链接
    • 运行RUNNER_ALLOW_RUNASROOT=true ./config.sh --url https://github.com/xxxx/deployWeb --token AGIAQ3S7N4IAHW7REWDQQP3GZAL7Y输出Http response code: NotFound from 'POST https://api.github.com/actions/runner-registration' (Request Id: 5EA2:282BC3:355B13:38E34C:66C8062C) {"message":"Not Found","documentation_url":"https://docs.github.com/rest","status":"404"} Response status code does not indicate success: 404 (Not Found). 查token不是静态的,它会很快过期,所以当不立即使用令牌时就会发生这种情况,刷新github页面重置token参数就可以了。参考链接
  • 成功
    ```bash
    RUNNER_ALLOW_RUNASROOT=true ./config.sh --url https://github.com/xxxx/deployWeb --token AGIAQ3TYM6U23HE23X2U3A3GZAKWK

      --------------------------------------------------------------------------------|        ____ _ _   _   _       _          _        _   _                      ||       / ___(_) |_| | | |_   _| |__      / \   ___| |_(_) ___  _ __  ___      ||      | |  _| | __| |_| | | | | '_ \    / _ \ / __| __| |/ _ \| '_ \/ __|     ||      | |_| | | |_|  _  | |_| | |_) |  / ___ \ (__| |_| | (_) | | | \__ \     ||       \____|_|\__|_| |_|\__,_|_.__/  /_/   \_\___|\__|_|\___/|_| |_|___/     ||                                                                              ||                       Self-hosted runner registration                        ||                                                                              |--------------------------------------------------------------------------------# Authentication√ Connected to GitHub# Runner RegistrationEnter the name of the runner group to add this runner to: [press Enter for Default] Enter the name of runner: [press Enter for XXX-dev-test] my-action-runnerThis runner will have the following labels: 'self-hosted', 'Linux', 'X64' Enter any additional labels (ex. label-1,label-2): [press Enter to skip] √ Runner successfully added√ Runner connection is good# Runner settingsEnter name of work folder: [press Enter for _work] /actions-runner√ Settings Saved.```
    
  1. 在你的GitHub Actions workflow中,将 runs-on 指定为 self-hosted后推送项目,Runner运行输出如下:。
    Requested labels: self-hosted
    Job defined at: mingchangge/deployWeb/.github/workflows/deploy.yaml@refs/heads/master
    Waiting for a runner to pick up this job...
    

结束语

到这一步我就没有往下面进行了。因为我突发奇想的要在K8s上运行GitHub Actions的自托管运行器,所以本篇就这样结束了。或许等我把即定目标前端项目自动化部署实现【这个目标目前只完成了k8s的部署。私有docker镜像搭建、内网GitHub Actions的自托管运行器、项目CI构建均没有完成啊啊啊啊!!!】,会回头继续补充本篇内容。

删除Runner

删除Runner,我直接将actions-runner文件夹删除了。等回头重新搭建完成,再运行下面的命令吧。

./config.sh remove --token AGIAQ3TS4DIE57KTU7FYPZTGZQE5Q

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • leetcode541:反转字符串II
  • io进程----文件io
  • 8月27日,每日信息差
  • 【深度学习】爱因斯坦求和约定
  • STM32 - 笔记3
  • 最新网站服务器CC压力测试系统源码
  • 开源 AI 智能名片 O2O 商城小程序在社交私域中的圈层价值
  • 【卡梅德生物】羊驼单抗定制:从单B细胞筛选到应用
  • Web开发:通过Quatz开启定时任务调度的基础demo
  • 【JVM】垃圾回收算法(一)
  • c++核心编程指南
  • k8s备份etcd3.5
  • jenkins任务中无法执行sudo,管理员操作
  • 分块矩阵的转置
  • Vue3源码调试-第二篇
  • 时间复杂度分析经典问题——最大子序列和
  • “寒冬”下的金三银四跳槽季来了,帮你客观分析一下局面
  • Angular 响应式表单 基础例子
  • Fundebug计费标准解释:事件数是如何定义的?
  • Java 最常见的 200+ 面试题:面试必备
  • jdbc就是这么简单
  • JS进阶 - JS 、JS-Web-API与DOM、BOM
  • PHP 程序员也能做的 Java 开发 30分钟使用 netty 轻松打造一个高性能 websocket 服务...
  • 对话:中国为什么有前途/ 写给中国的经济学
  • 前端学习笔记之观察者模式
  • 使用Tinker来调试Laravel应用程序的数据以及使用Tinker一些总结
  • 用jquery写贪吃蛇
  • 做一名精致的JavaScripter 01:JavaScript简介
  • 2017年360最后一道编程题
  • Spark2.4.0源码分析之WorldCount 默认shuffling并行度为200(九) ...
  • ​iOS实时查看App运行日志
  • ​linux启动进程的方式
  • # 学号 2017-2018-20172309 《程序设计与数据结构》实验三报告
  • # 职场生活之道:善于团结
  • (2022版)一套教程搞定k8s安装到实战 | RBAC
  • (C语言)二分查找 超详细
  • (Redis使用系列) Springboot 整合Redisson 实现分布式锁 七
  • (windows2012共享文件夹和防火墙设置
  • (非本人原创)我们工作到底是为了什么?​——HP大中华区总裁孙振耀退休感言(r4笔记第60天)...
  • (附源码)计算机毕业设计ssm基于B_S的汽车售后服务管理系统
  • (三)mysql_MYSQL(三)
  • (十)T检验-第一部分
  • (四)【Jmeter】 JMeter的界面布局与组件概述
  • (四)linux文件内容查看
  • (转)3D模板阴影原理
  • (转)JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
  • .NET 2.0中新增的一些TryGet,TryParse等方法
  • .Net Remoting(分离服务程序实现) - Part.3
  • .NET/C# 利用 Walterlv.WeakEvents 高性能地中转一个自定义的弱事件(可让任意 CLR 事件成为弱事件)
  • .netcore 6.0/7.0项目迁移至.netcore 8.0 注意事项
  • .net开发引用程序集提示没有强名称的解决办法
  • .NET连接数据库方式
  • .ui文件相关
  • @EnableConfigurationProperties注解使用
  • @PreAuthorize注解