VM name validation fails when runner token has underscore
Overview
We use a part of the Runner token we name VMs so that the machines are identifiable by that, for example, if we have a token of xxx_xxxxxxxxxxxxxxx
the VM name will turn out to be runner-xxx_xxxx-wsrm-b294bdd6117bce92
. The autoscaler fails to to create the VM on certain provides since _
is not accepted as a name.
{"PID":1304,"error":"couldn't create the Virtual Machine \"runner-bs_byuve-wsrm-19e05cec018953c8f3c0\": couldn't execute instance create request: googleapi: Error 400: Invalid value for field 'resource.name': 'runner-bs_byuve-wsrm-19e05cec018953c8f3c0'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'\nMore details:\nReason: invalid, Message: Invalid value for field 'resource.name': 'runner-bs_byuve-wsrm-19e05cec018953c8f3c0'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'\nReason: invalid, Message: Invalid value for field 'resource.disks[0].initializeParams.diskName': 'runner-bs_byuve-wsrm-19e05cec018953c8f3c0-disk'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'\n","level":"error","msg":"Application execution failed","time":"2019-11-11T12:32:02Z"}
Workaround
The only workaround is to register the Runner again hoping to get a new token.
Proposal
Before generating the VM name drop the underscore