Skip to content

Commit

Permalink
fix: use the same image for spinning up dummy machine and update defa…
Browse files Browse the repository at this point in the history
…ult runner machine image to COS
  • Loading branch information
MeNsaaH committed Apr 29, 2022
1 parent e91481a commit 7c24b17
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ locals {
runners_enable_monitoring = var.runners_enable_monitoring
runners_network = var.network
runners_subnetwork = var.subnetwork
runners_docker_machine_image = var.runner_machine_image
})

template_shutdown_script = templatefile("${path.module}/templates/shutdown-script.sh.tpl", {
Expand Down Expand Up @@ -116,3 +117,4 @@ locals {
}
)
}

6 changes: 5 additions & 1 deletion templates/startup-script.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else
# See: https://github.com/docker/machine/issues/3845#issuecomment-280389178
export USER=root
export HOME=/root
suffix="$(< /dev/urandom tr -dc _a-z-0-9 | head -c6)"
suffix="$(< /dev/urandom tr -dc a-z-0-9 | head -c6)"
dummymachine="${prefix}-gitlab-runner-dummy-machine-$suffix"
echo "Verifying docker-machine and generating SSH keys ahead of time."
docker-machine create --driver google \
Expand All @@ -79,6 +79,9 @@ else
%{~ if runners_subnetwork != "" ~}
--google-subnetwork ${runners_subnetwork} \
%{~ endif ~}
%{~ if runners_docker_machine_image != "" ~}
--google-machine-image ${runners_docker_machine_image} \
%{~ endif ~}
$dummymachine
docker-machine rm -y $dummymachine
unset HOME
Expand Down Expand Up @@ -136,3 +139,4 @@ ${post_install}
service gitlab-runner restart
chkconfig gitlab-runner on
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ variable "docker_machine_preemptible" {
variable "runner_machine_image" {
description = "A GCP custom image to use for spinning up runners when using docker-machine"
type = string
default = "ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20220419"
default = "cos-cloud/global/images/family/cos-97-lts"
}

variable "docker_machine_disk_type" {
Expand Down

0 comments on commit 7c24b17

Please sign in to comment.