我尝试在 Github 中将 AWS EC2 实例注册为新的自托管运行程序,但收到此错误:
GitHub Registration Token is received
AWS EC2 instance i-abcd is started
AWS EC2 instance i-abcd is up and running
Waiting 30s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner
Checking every 10s if the GitHub self-hosted runner is registered
Checking...
Checking...
Error: GitHub self-hosted runner registration error
Checking...
Error: A timeout of 5 minutes is exceeded. Your AWS EC2 instance was not able to register itself in GitHub as a new self-hosted runner.
我正在使用 this 创建我的 EC2 GitHub 运行程序。
我的工作流程中的代码:
- name: Start EC2 Runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.PAT_CLASSIC }}
ec2-image-id: ${{ secrets.EC2_IMAGE_ID }}
ec2-instance-type: m5a.xlarge
subnet-id: ${{ secrets.EC2_SUBNET_ID }}
security-group-id: ${{ secrets.EC2_SECURITY_GROUP_ID }}
我的 IAM 角色策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EC2Permissions",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:RunInstances",
"ec2:StartInstances",
"ec2:StopInstances",
"ec2:TerminateInstances",
"ec2:CreateTags",
"tag:TagResources"
],
"Resource": "*"
}
]
}
我已验证添加到 Github 中的机密的凭据是正确的。在 AWS 的 IAM 控制台中,我已验证 EC2 实例启动并运行时正在使用凭证。此外,CI 中显示的 EC2 实例是在 AWS EC2 中使用正确的 AMI ID、子网 ID 和安全组 ID 创建的。对于我的安全组,我已允许所有出站流量。
我已为此回购级别自托管运行程序重新生成了我的 PAT 令牌,并使用必要的权限对其进行了授权 -
read-public key
workflow
repo
read-repo hook
我在这里缺少什么?
成功了,错误的原因是 Github 不支持自托管运行器的 Amazon Linux AMI。 这有更多详情