renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.15k stars 2.23k forks source link

Specify which actions can occur during/outside scheduled window #4866

Closed mayfieldiv closed 11 months ago

mayfieldiv commented 4 years ago

What would you like Renovate to be able to do?

I wish I could more granularly specify which actions Renovate will perform during/outside of the scheduled window. For example, if rebaseStalePrs = true, I only want the rebasing to happen during the scheduled window. However, I still want merge requests to be created at any time.

updateNotScheduled is currently available to specify that no actions (updates) should occur outside the schduled window, but it has undesirable effects such as making the master issue not link to the merge requests.

Describe the solution you'd like

A new config option could be created, or maybe the updateNotScheduled config option could be extended to accept an array of actions that can be performed outside of the scheduled window.

I think you'd be better at coming up with a list of actions that Renovate performs, but I'll give it a shot.

automerge
create
maintainLockFile
pruneStale
rebaseConflicted
rebaseStale
recreateClosed
rarkins commented 4 years ago

I think this is a really good idea. As always, making things configurable saves us from the impossible task of having to find defaults that satisfy everyone.

Also, we don't have to get it perfect first go - it would be easy to add to the list over time if we missed anything.

We could change updateNotScheduled to be an array of strings with the default containing all the functionality we think relevant. We can massage existing configs with updateNotScheduled=false to updateNotScheduled=[].

mayfieldiv commented 4 years ago

Great! That sounds like a reasonable solution. Any thoughts on which actions should be configurable in the first revision?

rarkins commented 4 years ago

We'll need a list of:

Brainstorming:

The ticked ones are the ones I think we currently do out of schedule.

Some which I'm not sure about:

We also need to think what to do if (a) packages in a group have different schedules, and (b) packages in a group have different actions list. We might want to "AND" them in both cases (e.g. if any schedule matches, and combine/deduplicate the actions list.

halfzebra commented 4 years ago

Looks like exactly what I needed for my current Renovate setup! 👍

I want to merge Renovate PRs only during the office hours to address the potential issues in a timely manner, having an option to control this with proposed configuration option would be a spot-on solution.

The proposed default setup looks good, can't comment on possible complications with package-specific configuration, looks like a slightly more complicated problem to solve.

@rarkins any pointers on where to start for anyone willing to work on this?

rarkins commented 4 years ago

I'm wondering if we can do no actions outside of schedule by default now that it's more practical to request rebasing or PR opening using checkboxes in PRs and the Dependency Dashboard. However those options only really work effectively if using GitHub or GitLab, so users on other platforms may need to adjust their default out-of-schedule actions.

@halfzebra it would be implemented a little bit like suppressNotifications

i.e. an array, supporting a list of possible values, probably defaulting to empty, and being mergeable. You can see how that array is then used throughout the code.

We could call it outOfScheduleActions.

It would then be used in the code similarly to suppressNotifications although in this case we'd have a list of things to do in We could call itoutOfScheduleActions, instead of things **not to do** insuppressNotifications`.

devanjain commented 3 years ago

Can we also define an option for scanning dependencies as well. Like if its out of schedule, don't scan for dependencies and gracefully exit.

With auto discovery enabled on project level for SCM, we are running renovate on very frequent schedule to ensure not to miss on any repositories schedule. And with large number of renovate enabled repos, un-necessary load is being generated on the package manager, as scans happens irrespective if its under the schedule or not, and then checks option for SCM PR/MR operations.

halfzebra commented 3 years ago

I feel like I don't have the resources to work on this in the near future.

Please feel free to pick this up 🙌

rarkins commented 3 years ago

@devanjain do your repos have different schedules or would there be times when renovate runs and exits early for all repos?

devanjain commented 3 years ago

we have different schedules in repos. In our implementation, we are running auto-discovery enabled renovate task per stash project, which have multiple repos with different schedule.

vvictor10 commented 1 year ago

@rarkins We have a very similar situation like @devanjain. We are running renovate using bitbucket pipelines and the scheduling options on bitbucket pipelines is pretty minimal. So we want to run the pipeline weekly on a particular day and time window. But we want the dependencies scan to happen only once a quarter(for e.g.). So ideally, we would like renovate to not scan for dependencies unless the pipeline job runs within the schedule window.

Currently, it looks like renovate runs the scan for all our dependencies(Android/Gradle project) and just skips the PR creation. Is there anyway that we can achieve what we want with the current available options/configs.

Thanks.

rarkins commented 1 year ago

No, and that's not how Renovate works. If it doesn't "scan", it can't do anything else

vvictor10 commented 1 year ago

Can it not check the schedule before it scans?

rarkins commented 1 year ago

So you want it to do nothing at all on the repo? Why would you "run the pipeline weekly on a particular day and time window" if it does absolutely nothing?

vvictor10 commented 1 year ago

I have no other choice with bitbucket pipelines, the least frequent option is weekly.

rarkins commented 1 year ago

So your goal here is to save some CI cycles once a week?

fallemand commented 1 year ago

I find this very useful. We want to prepare PRs on the weekend (when the CI consumption is low), and auto-merge PRs during working hours (in case something breaks). I wasn't able to get it working with the current config:

  "packageRules": [
    {
      "matchUpdateTypes": [
        "minor",
        "patch"
      ],
      "automerge": true
    }
  ],
  "schedule": [
    "after 9am every weekend"
  ],
  "automergeSchedule": [
    "after 9am and before 5pm every weekday"
  ],