Skip to content
Snippets Groups Projects
Commit 7673e484 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Merge branch 'issue-64' into 'main'

Change sshKeys to ssh-keys, set ubuntu user default

Closes #64

See merge request gitlab-org/ci-cd/docker-machine!72
parents d1e09284 f1ab75bd
No related branches found
No related tags found
No related merge requests found
...@@ -459,10 +459,19 @@ func (c *ComputeUtil) uploadSSHKey(instance *raw.Instance, sshKeyPath string) er ...@@ -459,10 +459,19 @@ func (c *ComputeUtil) uploadSSHKey(instance *raw.Instance, sshKeyPath string) er
metaDataValue := fmt.Sprintf("%s:%s %s\n", c.userName, strings.TrimSpace(string(sshKey)), c.userName) metaDataValue := fmt.Sprintf("%s:%s %s\n", c.userName, strings.TrimSpace(string(sshKey)), c.userName)
metadata := instance.Metadata metadata := instance.Metadata
// "sshKeys" was deprecated in favor of "ssh-keys" metadata key. However, old images may still depend
// on the old metadata configuration. And users may still have legitimate reasons to use these older
// images. As instance metadata is a simple key-value store, it should have no problems with having
// the keys defined twice under two different names. Legacy images will then still be able to use the
// legacy key naming, while new ones will get support for the expected new naming.
metadata.Items = append(metadata.Items, &raw.MetadataItems{ metadata.Items = append(metadata.Items, &raw.MetadataItems{
Key: "sshKeys", Key: "sshKeys",
Value: &metaDataValue, Value: &metaDataValue,
}) })
metadata.Items = append(metadata.Items, &raw.MetadataItems{
Key: "ssh-keys",
Value: &metaDataValue,
})
op, err := c.service.Instances.SetMetadata(c.project, c.zone, c.instanceName, metadata).Do() op, err := c.service.Instances.SetMetadata(c.project, c.zone, c.instanceName, metadata).Do()
if err != nil { if err != nil {
......
...@@ -70,9 +70,9 @@ type Driver struct { ...@@ -70,9 +70,9 @@ type Driver struct {
const ( const (
defaultZone = "us-central1-a" defaultZone = "us-central1-a"
defaultUser = "docker-user" defaultUser = "ubuntu"
defaultMachineType = "n1-standard-1" defaultMachineType = "n1-standard-1"
defaultImageName = "ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20170721" defaultImageName = "ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20210928"
defaultServiceAccount = "default" defaultServiceAccount = "default"
defaultScopes = "https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write" defaultScopes = "https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write"
defaultDiskType = "pd-standard" defaultDiskType = "pd-standard"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment