Skip to content

Commit

Permalink
chore: Add purge task for the ACR (#173)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer authored Nov 1, 2024
1 parent 256f6bc commit e56844b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions terraform/modules/azure/registry/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,29 @@ resource "azurerm_container_registry_cache_rule" "docker-io" {
// This credentialset has been created manually in the portal using kedacoreci credentials
// https://learn.microsoft.com/en-us/azure/container-registry/container-registry-artifact-cache?pivots=development-environment-azure-portal#create-new-credentials
credential_set_id = "${azurerm_container_registry.acr.id}/credentialSets/docker-credentials"
}

resource "azurerm_container_registry_task" "acr_purge_task" {
name = "scheduledAcrPurgeTask"
container_registry_id = azurerm_container_registry.acr.id
platform {
os = "Linux"
architecture = "amd64"
}
encoded_step {
task_content = <<EOF
version: v1.1.0
steps:
- cmd: acr purge --filter '.*:.*' --untagged --ago 15d
disableWorkingDirectoryOverride: true
timeout: 3600
EOF
}
timer_trigger {
name = "t1"
schedule = "0 0 * * Tue"
enabled = true
}

tags = var.tags
}

0 comments on commit e56844b

Please sign in to comment.