Detector: perist executed actions
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
@@ -75,6 +75,7 @@ class Detector:
|
||||
_executed: DiskStoredList = None
|
||||
_branches: DiskStoredRefs = None
|
||||
_tags: DiskStoredRefs = None
|
||||
_project: str = None
|
||||
|
||||
def __init__(self, repo_path: Path, cache_dir: Path, project: str):
|
||||
log.debug(f"Initializing detector...")
|
||||
@@ -87,6 +88,8 @@ class Detector:
|
||||
log.debug(f"Creating detector dir")
|
||||
self._detector_dir.mkdir()
|
||||
|
||||
self._project = project
|
||||
|
||||
log.debug(f"Detector cache: {self._detector_dir}")
|
||||
self._executed = DiskStoredList(self._detector_dir.joinpath("detectorExecuted").as_posix())
|
||||
log.debug(f"Detector executed: {len(self._executed)} commits")
|
||||
@@ -225,7 +228,17 @@ class Detector:
|
||||
'log': commit.message,
|
||||
}
|
||||
env = DetectedCommit(env)
|
||||
log.info(f"Executing CI: commit {self._project}: {env.commit} @ {env.date} by {env.author}")
|
||||
if env.is_tag or env.is_branch:
|
||||
log.info(f"Additional info: branch: {env.branches}; tag(s) {env.tags}")
|
||||
executed_count += 1
|
||||
callback(env)
|
||||
# mark commit done
|
||||
self._executed.append(commit.hexsha)
|
||||
for item in special_branch:
|
||||
self._branches.update(item, commit.hexsha)
|
||||
for item in special_tag:
|
||||
self._tags.update(item, commit.hexsha)
|
||||
|
||||
self.persist_fingerprint()
|
||||
return executed_count
|
||||
|
||||
Reference in New Issue
Block a user