Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch merges configured to run daily or weekly do not run #1313

Open
dibarbet opened this issue Jan 27, 2023 · 1 comment
Open

Branch merges configured to run daily or weekly do not run #1313

dibarbet opened this issue Jan 27, 2023 · 1 comment

Comments

@dibarbet
Copy link
Member

dibarbet commented Jan 27, 2023

@CyrusNajmabadi noticed that none of his feature branches were getting merge PRs created. After looking at the runs in https://devdiv.visualstudio.com/DevDiv/_build?definitionId=12152 it seems like any branch merges configured to run daily or weekly never actually run.

The code to run these merges checks if the run is happening within +/- 5 minutes of 12am midnight.

// Since cron should schedule this to run every 3 hours starting at 12am,
// we expect to be run within a 10 minute window of this time.
// Adjust the time 5 minutes into the future in case the pipeline machine
// and scheduler machine have mismatched clocks.
var adjustedRunDateTime = runDateTime.AddMinutes(5);
var adjustedRunDate = adjustedRunDateTime.Date;
// Because the adjusted run time is being used, we treat a run as valid if
// it begins within the last 5 minutes of the previous day through the first
// 5 minutes of the current day.
var tenMinutes = new TimeSpan(hours: 0, minutes: 10, seconds: 0);
var isStartOfDay = adjustedRunDateTime - adjustedRunDate < tenMinutes;
// Daily and Weekly runs only happen at the start of the day
if (!isStartOfDay)
{
return false;
}
// Weekly runs only happen on Sunday
if (frequency == "weekly")
{
return adjustedRunDate.DayOfWeek == DayOfWeek.Sunday;
}
// Daily runs happen every day
return true;

I originally thought this might be happening because of a time change - however the pipeline appears to be correctly running at 12am UTC (https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7229636&view=results), and the code is correctly checking the UTC date. So not sure what is happening. Needs investigation

@RikkiGibson
Copy link
Contributor

Should we change this to make it work based on the age of the most recent auto-PR to the branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants