mirror of
https://github.com/tubearchivist/tubearchivist-server.git
synced 2024-11-22 03:40:12 +00:00
optionally skip clone and call subprocess directly
This commit is contained in:
parent
14cfbea287
commit
d63e5bc407
@ -95,6 +95,10 @@ class Builder(RedisBase):
|
|||||||
|
|
||||||
def clone(self):
|
def clone(self):
|
||||||
"""clone repo to destination"""
|
"""clone repo to destination"""
|
||||||
|
if not self.task_detail["clone"]:
|
||||||
|
print("skip clone")
|
||||||
|
return
|
||||||
|
|
||||||
print("clone repo")
|
print("clone repo")
|
||||||
repo_dir = os.path.join(self.CLONE_BASE, self.task_detail["name"])
|
repo_dir = os.path.join(self.CLONE_BASE, self.task_detail["name"])
|
||||||
if os.path.exists(repo_dir):
|
if os.path.exists(repo_dir):
|
||||||
@ -106,8 +110,12 @@ class Builder(RedisBase):
|
|||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""build the container"""
|
"""build the container"""
|
||||||
build_command = ["docker", "buildx"] + self.task_detail["build"]
|
if not self.task_detail["clone"]:
|
||||||
build_command.append(os.path.join(self.CLONE_BASE, self.task))
|
build_command = self.task_detail["build"]
|
||||||
|
else:
|
||||||
|
build_command = ["docker", "buildx"] + self.task_detail["build"]
|
||||||
|
build_command.append(os.path.join(self.CLONE_BASE, self.task))
|
||||||
|
|
||||||
subprocess.run(build_command, check=True)
|
subprocess.run(build_command, check=True)
|
||||||
|
|
||||||
def remove_task(self):
|
def remove_task(self):
|
||||||
|
@ -427,6 +427,8 @@ class TaskHandler(RedisBase):
|
|||||||
"name": self.repo_conf.get("gh_repo"),
|
"name": self.repo_conf.get("gh_repo"),
|
||||||
"build": build_command,
|
"build": build_command,
|
||||||
}
|
}
|
||||||
|
if task_name == "sync_es":
|
||||||
|
task.update({"clone": False})
|
||||||
|
|
||||||
self.conn.json().set(self.key, f".tasks.{repo}", task)
|
self.conn.json().set(self.key, f".tasks.{repo}", task)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user