mirror of
https://github.com/tubearchivist/tubearchivist-server.git
synced 2024-11-21 19:30:12 +00:00
better clone-pull path building
This commit is contained in:
parent
4158bae090
commit
e6ec703eac
@ -96,17 +96,13 @@ class Builder(RedisBase):
|
|||||||
def clone(self):
|
def clone(self):
|
||||||
"""clone repo to destination"""
|
"""clone repo to destination"""
|
||||||
print("clone repo")
|
print("clone repo")
|
||||||
clone = ["git", "clone", self.task_detail["clone"]]
|
repo_dir = os.path.join(self.CLONE_BASE, self.task_detail["name"])
|
||||||
pull = ["git", "pull", self.task_detail["clone"]]
|
if os.path.exists(repo_dir):
|
||||||
os.chdir("clone")
|
command = ["git", "-C", repo_dir, "pull"]
|
||||||
try:
|
else:
|
||||||
subprocess.run(clone, check=True)
|
command = ["git", "clone", self.task_detail["clone"], repo_dir]
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
print("git pull instead")
|
subprocess.run(command, check=True)
|
||||||
os.chdir(self.task)
|
|
||||||
subprocess.run(pull, check=True)
|
|
||||||
os.chdir("../")
|
|
||||||
os.chdir("../")
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""build the container"""
|
"""build the container"""
|
||||||
|
Loading…
Reference in New Issue
Block a user