WoodpeckerRunner & some VCS changes
This commit is contained in:
parent
34ee5f8754
commit
312631f0b5
2 changed files with 54 additions and 35 deletions
|
|
@ -13,14 +13,6 @@ class GitService:
|
|||
self._repo.git.checkout(self._settings.git.branch)
|
||||
self._origin: Remote = self._repo.remotes.origin
|
||||
|
||||
def get_modified_compose(self) -> str | None:
|
||||
self._update()
|
||||
return self._diff()
|
||||
|
||||
def get_new_commit_hash(self) -> str:
|
||||
self._update()
|
||||
return self._repo.head.commit.hexsha
|
||||
|
||||
@staticmethod
|
||||
def _check_preconditions(config: GitConfig) -> Repo:
|
||||
def clone():
|
||||
|
|
@ -34,16 +26,5 @@ class GitService:
|
|||
return clone()
|
||||
return Repo(config.path)
|
||||
|
||||
def _update(self):
|
||||
self._origin.pull()
|
||||
|
||||
def _diff(self) -> str | None:
|
||||
diff = self._repo.head.commit.diff("HEAD~1")
|
||||
composes = [f for f in diff if f.a_path.endswith("docker-compose.yml")]
|
||||
match len(composes):
|
||||
case 0:
|
||||
return None
|
||||
case 1:
|
||||
return composes[0].a_path
|
||||
case _:
|
||||
raise Exception("Multiple compose files modified")
|
||||
def checkout(self, sha: str):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue