mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 03:48:09 +00:00
Reuse Agent artifacts if nothing in src/agent changes (#2115)
The agent build takes most of the CI runtime, so improve it by only rebuilding if the pre-reqs or something inside `src/agent` changes. We will always skip the cache for builds on tags and from the `main` branch, so that version is stamped correctly there.
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
from typing import List, Optional, Tuple
|
||||
from uuid import UUID
|
||||
|
||||
@ -131,6 +132,10 @@ class Node(BASE_NODE, ORMMixin):
|
||||
|
||||
@classmethod
|
||||
def mark_outdated_nodes(cls) -> None:
|
||||
# if outdated agents are allowed, do not attempt to update
|
||||
if os.environ["ONEFUZZ_ALLOW_OUTDATED_AGENT"] == "true":
|
||||
return
|
||||
|
||||
# ony update 500 nodes at a time to mitigate timeout issues
|
||||
outdated = cls.search_outdated(exclude_update_scheduled=True, num_results=500)
|
||||
for node in outdated:
|
||||
@ -263,7 +268,7 @@ class Node(BASE_NODE, ORMMixin):
|
||||
from .pools import Pool
|
||||
from .scalesets import Scaleset
|
||||
|
||||
if self.is_outdated():
|
||||
if self.is_outdated() and os.environ["ONEFUZZ_ALLOW_OUTDATED_AGENT"] != "true":
|
||||
logging.info(
|
||||
"can_process_new_work agent and service versions differ, "
|
||||
"stopping node. "
|
||||
|
Reference in New Issue
Block a user