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:
George Pollard
2022-07-13 10:09:32 +12:00
committed by GitHub
parent ec515a57fd
commit 0b8093b89e
2 changed files with 34 additions and 7 deletions

View File

@ -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. "