Skip to content

Commit a81adf2

Browse files
committed
feat(azure): add optional timer schedule for container build
1 parent 425bca7 commit a81adf2

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

modules/azure/container_registry.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ resource "azurerm_container_registry_task" "alz" {
3636
identity {
3737
type = "SystemAssigned" # Note this has to be a System Assigned Identity to work with private networking and `network_rule_bypass_option` set to `AzureServices`
3838
}
39+
timer_trigger {
40+
name = "scheduled-build"
41+
schedule = var.container_registry_task_timer_trigger_schedule
42+
enabled = var.container_registry_task_timer_trigger_enabled
43+
}
3944
registry_credential {
4045
custom {
4146
login_server = azurerm_container_registry.alz[0].login_server

modules/azure/variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,30 @@ variable "container_registry_image_tag" {
498498
default = "{{.Run.ID}}"
499499
}
500500

501+
variable "container_registry_task_timer_trigger_enabled" {
502+
description = <<-EOT
503+
**(Optional, default: `true`)** Enable daily timer trigger for container registry image builds.
504+
505+
When enabled, the ACR task runs daily to rebuild the agent image,
506+
ensuring it stays up-to-date with latest patches and dependencies.
507+
508+
See container_registry_task_timer_trigger_schedule for customizing the schedule.
509+
EOT
510+
type = bool
511+
default = true
512+
}
513+
514+
variable "container_registry_task_timer_trigger_schedule" {
515+
description = <<-EOT
516+
**(Optional, default: `"0 0 * * 0"`)** CRON schedule for the container registry task timer trigger.
517+
518+
Default schedule runs at midnight on Sundays.
519+
Modify as needed to fit maintenance windows or update frequency.
520+
EOT
521+
type = string
522+
default = "0 0 * * 0"
523+
}
524+
501525
variable "use_self_hosted_agents" {
502526
description = <<-EOT
503527
**(Optional, default: `true`)** Controls whether to deploy self-hosted CI/CD agents in Azure Container Instances.

0 commit comments

Comments
 (0)