update flakes with a random delay
This commit is contained in:
parent
b5681b1ea0
commit
776a6ea499
|
@ -3,6 +3,7 @@
|
||||||
import json
|
import json
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
|
@ -13,19 +14,16 @@ from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from buildbot.configurators import ConfiguratorBase
|
from buildbot.configurators import ConfiguratorBase
|
||||||
from buildbot.plugins import reporters, schedulers, secrets, steps, util, worker
|
from buildbot.plugins import (reporters, schedulers, secrets, steps, util,
|
||||||
|
worker)
|
||||||
from buildbot.process import buildstep, logobserver, remotecommand
|
from buildbot.process import buildstep, logobserver, remotecommand
|
||||||
from buildbot.process.log import Log
|
from buildbot.process.log import Log
|
||||||
from buildbot.process.project import Project
|
from buildbot.process.project import Project
|
||||||
from buildbot.process.properties import Interpolate, Properties
|
from buildbot.process.properties import Interpolate, Properties
|
||||||
from buildbot.process.results import ALL_RESULTS, statusToString
|
from buildbot.process.results import ALL_RESULTS, statusToString
|
||||||
from buildbot.steps.trigger import Trigger
|
from buildbot.steps.trigger import Trigger
|
||||||
from github_projects import ( # noqa: E402
|
from github_projects import (GithubProject, create_project_hook, # noqa: E402
|
||||||
GithubProject,
|
load_projects, refresh_projects)
|
||||||
create_project_hook,
|
|
||||||
load_projects,
|
|
||||||
refresh_projects,
|
|
||||||
)
|
|
||||||
from twisted.internet import defer, threads
|
from twisted.internet import defer, threads
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
|
|
||||||
|
@ -579,6 +577,11 @@ def config_for_project(
|
||||||
nix_supported_systems: list[str],
|
nix_supported_systems: list[str],
|
||||||
nix_eval_max_memory_size: int,
|
nix_eval_max_memory_size: int,
|
||||||
) -> Project:
|
) -> Project:
|
||||||
|
# get a deterministic jitter for the project
|
||||||
|
random.seed(project.name)
|
||||||
|
# don't run all projects at the same time
|
||||||
|
jitter = random.randint(1, 60) * 60
|
||||||
|
|
||||||
config["projects"].append(Project(project.name))
|
config["projects"].append(Project(project.name))
|
||||||
config["schedulers"].extend(
|
config["schedulers"].extend(
|
||||||
[
|
[
|
||||||
|
@ -623,13 +626,11 @@ def config_for_project(
|
||||||
builderNames=[f"{project.name}/update-flake"],
|
builderNames=[f"{project.name}/update-flake"],
|
||||||
buttonName="Update flakes",
|
buttonName="Update flakes",
|
||||||
),
|
),
|
||||||
# updates flakes once a weeek
|
# updates flakes once a week
|
||||||
schedulers.NightlyTriggerable(
|
schedulers.Periodic(
|
||||||
name=f"{project.id}-update-flake-weekly",
|
name=f"{project.id}-update-flake-weekly",
|
||||||
builderNames=[f"{project.name}/update-flake"],
|
builderNames=[f"{project.name}/update-flake"],
|
||||||
hour=3,
|
periodicBuildTimer=24*60*60*7 + jitter,
|
||||||
minute=0,
|
|
||||||
dayOfWeek=6,
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue