Reputation: 11
I want to schedule a run for Release on Azure DevOps. But I found out that when the schedule is run, it will create a new Release to schedule run, not the old Release.
Is there any way to set up a run schedule in an old release?
How to set up a run schedule in an old release? Does Azure support this?
To clarify my issue:
I use trigger classic UI editor.
For example, I have release-340
I read the document when the schedule runs it will create a new release based on the old release to release-341. So every time running it will create another 342, 343... It's not my expected
Upvotes: 1
Views: 183
Reputation: 8072
every time like that it will create another 102, 103... I don't want that I just want it to run on existing release like the way manual deloy that release (Select release-100 and click Deloy)
It's not the usage of schedule trigger on DevOps, and not supported by schedule trigger on release.
There are two schedule triggers in Classic UI release pipeline as below:
The schedule release trigger
will start a new run(release)
when it triggers the pipeline, which is expected
.
The stage
level schedule trigger
will happen on current release
, but the prerequisite
is you have created release
, it works like screenshot below.
After the release completed, the schedule trigger will not run again
, which means it only works for 1st schedule time when the release exists.
As an alternative
, if you would like to schedule run the existing release
, you can use rest api Releases - Update Release Environment to redeploy the existing release. You can create a build pipeline
with schedule trigger to run the rest api. sample as below:
schedules:
- cron: '*/6 * * * *'
displayName: test schedule
branches:
include:
- main
always: true
pool:
vmImage: ubuntu-latest
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$organizaion= "yourorg"
$project = "projectname"
$releaseId = "21"
$environmentId = "39"
$url = "https://vsrm.dev.azure.com/$organizaion/$project/_apis/Release/releases/$releaseId/environments/$environmentId" + "?api-version=5.1-preview.6"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$(PAT)"))
#set status to inProgress to redeploy the stage
$body= '{
"status": "inProgress"
}'
$result=Invoke-RestMethod -Uri $url -Headers @{Authorization = ("Basic {0}" -f $base64AuthInfo)} -Method patch -ContentType "application/json" -Body $body
It will redeploy
the existing release stage in schedule:
Upvotes: 0