handle long disk names on GCE
Summary
The MachineName
is used for the disk name. If it is too long GCE will fail with:
Error creating machine: Error in driver during machine creation: googleapi: Error 400: Invalid value for field 'resource.disks[0].initializeParams.diskName': 'runner-a38f313a-google-autoscale-runner-1504950796-7a5257a9-disk'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)', invalid" driver=google name=runner-a38f313a-google-autoscale-runner-1504950796-7a5257a9 operation=create
Steps to reproduce
- Use GCE
- Set
MachineName
to something long likegoogle-autoscale-runner-%s
← one char too much!
regex test: https://regex101.com/r/LIu6GJ/1
Actual behavior
Machine creation fails.
Expected behavior
? Disk name should be shorter or gitlab-runner should refuse to even attempt to create the machine.
Environment description
- GCE preemptive machines
- docker version Docker version 17.07.0-ce, build 8784753
Used GitLab Runner version
gitlab-runner --version
Version: 9.5.0
Git revision: 413da38
Git branch: 9-5-stable
GO version: go1.8.3
Built: Tue, 22 Aug 2017 13:35:13 +0000
OS/Arch: linux/amd64
Edited by username-removed-90452