I have an azure pipeline that has 3 stages
send notification to user that resources will be deleted
request approval and wait 24 hours
delete resource
I have the pipeline almost ready but i can't work around how to wait in the second stage for 24 hours the delay task timeouts after 60 Minutes and schedule function can't work for me because the pipeilne is triggered on other pipeline completion
schedules:
- cron: "31 17 * * *"
displayName: every Every 24 hours execution for delete the aci if anything change in the branche main
branches:
include:
- main
- releases/*
exclude:
- releases/old/*
# Trigger this pipeline on model-train pipeline completion
trigger: none
resources:
containers:
- container: mlops
image: mcr.microsoft.com/mlops/python:latest
pipelines:
- pipeline: deploy-to-aci-dev
source: Deploy-to-aci-dev # Name of the triggering pipeline
trigger:
branches:
include:
- master
variables:
- template: estimation_engine-variables-template.yml
- group: devopsforai-aml-vg
stages:
- stage: 'Delay'
displayName: 'Delay for 24 Hours'
jobs:
- job: "Send_notif_sendgrid"
displayName: "send deletion notification for dev aci - sendgrid"
pool:
vmImage: 'windows-2019'
timeoutInMinutes: 60
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Install-Module -Name PSSendGrid -Force
Import-Module -Name PSSendGrid
$Parameters = @{
FromAddress = "***************************"
ToAddress = "***************************"
Subject = "Dev-Aci sera supprimé dans 24 heures"
Body = "Azure container instance dans l'environnement Dev sera supprimé dans 24 Heures"
Token = "*******************************************"
FromName = "Pipeline Alert"
ToName = "DigitRE"
}
Send-PSSendGridMail @Parameters
- stage: 'DELETE_ACI'
displayName: 'Delete Dev ACI'
condition: variables['ACI_DEPLOYMENT_NAME_DEV']
jobs:
- job: "DELETE_ACI"
displayName: "Delete Dev Aci"
container: mlops
timeoutInMinutes: 0
steps:
- task: AzureCLI@1
displayName: 'Install AzureML CLI'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
inlineScript: |
set -e # fail on error
az container delete -n $(ACI_DEPLOYMENT_NAME_DEV) -g $(RESOURCE_GROUP) --yes -y ```