Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/clients/gcloud_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ def create_runner_instance(self, registration_token, repo_url, template_name):
"Skipping instance creation.")
return None

instance_name = f"runner-{uuid.uuid4().hex[:16]}"
instance_uuid = uuid.uuid4().hex[:16]
if instance_template_resource.name.startswith("dependabot"):
instance_name = f"dependabot-{instance_uuid}"
else:
instance_name = f"runner-{instance_uuid}"

logger.info(f"Creating GCE instance {instance_name} with template {instance_template_resource.self_link}")

# Set instance name
Expand Down
2 changes: 1 addition & 1 deletion app/services/webhook_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def handle_workflow_job(self, payload):
template_name = None
if labels:
for label in labels:
if label.startswith('gcp-'):
if label.startswith('gcp-') or label.lower() == 'dependabot':
template_name = label
break
if template_name:
Expand Down
16 changes: 14 additions & 2 deletions gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ variable "github_runners_types" {
}))
# Similar to https://docs.github.com/en/enterprise-cloud@latest/actions/reference/runners/larger-runners
default = [
{
name = "dependabot"
instance_type = "e2-medium"
vcpu = 2
memory = 4
disk_type = "pd-ssd"
disk_size = 50
disk_provisioned_iops = 0
disk_provisioned_throughput = 0
image = "ubuntu-2404-lts-amd64"
arch = "amd64"
},
{
name = "gcp-ubuntu-slim"
instance_type = "e2-medium"
Expand Down Expand Up @@ -467,9 +479,9 @@ variable "github_runners_types" {
validation {
condition = alltrue([
for config in var.github_runners_types :
can(regex("^gcp-[a-zA-Z0-9-]+$", config.name))
can(regex("(^dependabot$|^gcp-[a-zA-Z0-9-]+$)", config.name))
])
error_message = "All names must start with 'gcp-' and only contain letters, numbers and hyphens."
error_message = "All names must start with 'gcp-' or must be named 'dependabot' and only contain letters, numbers and hyphens."
}

validation {
Expand Down