Explicit specification of protocol is needed when the Instance is Windows OS
Summary
I have tested the Instance executor in the following environment.
- Runner Manager
- Amazon Linux 2023
- gitlab-runner 16.8.0 (working in docker container)
- fleeting-plugin-aws 0.4.0 (placed in the same container with gitlab-runner)
- Autoscaled Runner:
- Windows Server 2022 Datacenter (This is a custom AMI. I installed Git and GitLab Runner to the AMI provided by AWS)
- gitlab-runner 16.9.0
In this environment, Windows OS should be automatically detected, so I should not need to explicitly specify protocol
in the Runner Manager's config.toml
.
However, Windows OS seems not detected, so I need to specify protocol = "winrm"
Steps to reproduce
Use the following config.toml
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "autoscale win"
url = "https://<hostname>"
id = 12
token = "glrt-URAhDAXXXXXX"
executor = "instance"
shell = "powershell"
[runners.autoscaler]
max_use_count = 1
max_instances = 1
plugin = "fleeting-plugin-aws-linux-amd64"
[runners.autoscaler.plugin_config]
config_file = "/root/.aws/config"
credentials_file = "/root/.aws/credentials"
name = "RunnerGrouop_win"
[runners.autoscaler.connector_config]
username = "Administrator"
password = "XXXXXX"
key_path = "/root/.aws/AWStest.pem"
use_static_credentials = true
keepalive = "0s"
timeout = "0s"
use_external_addr = false
[[runners.autoscaler.policy]]
idle_count = 1
idle_time = "5m0s"
scale_factor = 0.0
scale_factor_limit = 0
What is the current bug behavior?
Jobs are hung in "Dialing instance".
What is the expected correct behavior?
Windows OS should detect automatically. And jobs are worked as normal even if the protocol is not specified.
Relevant logs and/or screenshots
Runner's log is like following.
2024-02-16T10:05:44.454Z [INFO] instance discovery: group=aws/us-east-1/RunnerGrouop_win id=i-06a4a6b19231e6f91 state=creating cause=requested
2024-02-16T10:06:15.082Z [INFO] instance update: group=aws/us-east-1/RunnerGrouop_win id=i-06a4a6b19231e6f91 state=running
2024-02-16T10:06:15.298Z [INFO] ready: instance=i-06a4a6b19231e6f91 took=216.200708ms
Checking for jobs... received job=441 repo_url=https://<hostname>/test-group-02/cicd-sandbox.git runner=URAhDAURU
Added job to processing list builds=1 job=441 max_builds=1 project=73 repo_url=https://<hostname>/test-group-02/cicd-sandbox.git
Preparing instance... job=441 project=73 runner=URAhDAURU
Dialing instance external-address=54.242.121.118 instance-id=i-06a4a6b19231e6f91 internal-address=172.31.18.50 job=441 project=73 runner=URAhDAURU use-external-address=false
Appending trace to coordinator...ok code=202 job=441 job-log=0-427 job-status=running runner=URAhDAURU sent-log=0-426 status=202 Accepted update-interval=3s
Updating job... bytesize=427 checksum=crc32:5c7c0c80 job=441 runner=URAhDAURU
Submitting job to coordinator...ok bytesize=427 checksum=crc32:5c7c0c80 code=200 job=441 job-status= runner=URAhDAURU update-interval=0s
Updating job... bytesize=427 checksum=crc32:5c7c0c80 job=441 runner=URAhDAURU
Submitting job to coordinator...ok bytesize=427 checksum=crc32:5c7c0c80 code=200 job=441 job-status= runner=URAhDAURU update-interval=0s
In the AWS Console, AMI's platform is displayed as Windows.
AWS CLI also outputs instances' platform as Windows
$ aws ec2 describe-instances --instance-ids i-0128c6cfb77849c22 | grep Platform
"Platform": "windows",
"PlatformDetails": "Windows",
Possible fixes
As a workaround, we can run the job by specifying protocol
as follows.
[runners.autoscaler.connector_config]
protocol = "winrm"
username = "Administrator"
password = "XXXXXX"
key_path = "/root/.aws/AWStest.pem"
use_static_credentials = true
keepalive = "0s"
timeout = "0s"
use_external_addr = false
Edited by Kosuke Kamiya