ci(jenkins): replace weather threshold magic numbers
This commit is contained in:
parent
de2523c313
commit
eb931e8d46
@ -95,6 +95,11 @@ _JOB_METRICS = (
|
||||
JENKINS_BUILD_WEATHER_JOB_HEALTH_SCORE,
|
||||
)
|
||||
|
||||
_WEATHER_SUNNY_MIN_SCORE = 80
|
||||
_WEATHER_PARTLY_CLOUDY_MIN_SCORE = 60
|
||||
_WEATHER_CLOUDY_MIN_SCORE = 40
|
||||
_WEATHER_RAINY_MIN_SCORE = 20
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class JenkinsBuildWeatherJob:
|
||||
@ -184,13 +189,13 @@ def _health_score(job: dict[str, Any], status: str) -> float:
|
||||
def _weather_icon(score: float) -> str:
|
||||
if score < 0:
|
||||
return "❔"
|
||||
if score >= 80:
|
||||
if score >= _WEATHER_SUNNY_MIN_SCORE:
|
||||
return "☀️"
|
||||
if score >= 60:
|
||||
if score >= _WEATHER_PARTLY_CLOUDY_MIN_SCORE:
|
||||
return "⛅"
|
||||
if score >= 40:
|
||||
if score >= _WEATHER_CLOUDY_MIN_SCORE:
|
||||
return "☁️"
|
||||
if score >= 20:
|
||||
if score >= _WEATHER_RAINY_MIN_SCORE:
|
||||
return "🌧️"
|
||||
return "⛈️"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user