1

I'm trying to write a build pipeline that runs every second friday (essentially at the end of a sprint). Using the classic editor it appears I can only set a trigger that would run every friday. Is there any way I can achieve what I'm after?

Perhaps it runs every week but stops immediately if it can interpret the when the build was last run (although that doesn't seem to be exposed anywhere). I guess another alternative would be a triggering build that calls to the devops API to figure out if its the last day of the timebox. Neither of theses are ideal though for a fairly simple requirement (imo).

Thanks

1 Answer 1

0

I don't think you can alter the trigger right now in Azure DevOps. What I do is to create an extra task to start with, and use powershell (or your language of choice) to check if the week number is even or odd and then proceed with the build or not.

2
  • Yeah, thats what I ended up doing. For reference: $NumberOfSecondsInWeek = 604800 $WeekNumber = [System.Math]::Ceiling((Get-Date -UFormat %s) / $NumberOfSecondsInWeek) $IsEndOfSprint = ($WeekNumber % 2) -eq $(end-of-sprint-week-number) Write-Host "##vso[task.setvariable variable=is-end-of-sprint]$IsEndOfSprint" Commented Jan 27, 2020 at 8:20
  • That looks complicated... not sure why you're doing stuff using seconds... You could get the weeknumber simply with Get-Date -uformat %V Commented Jan 28, 2020 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.