Clone into unique directory so we don't step on a previous publish that hasn't finished.
This commit is contained in:
parent
e24ced5c34
commit
a2c7411b3d
|
@ -1,7 +1,8 @@
|
||||||
"""Git_service."""
|
"""Git_service."""
|
||||||
import datetime
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import uuid
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from flask import g
|
from flask import g
|
||||||
|
@ -59,16 +60,16 @@ class GitService:
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def publish(process_model_id: str, branch_to_update: str) -> None:
|
def publish(process_model_id: str, branch_to_update: str) -> str:
|
||||||
source_process_model_root = FileSystemService.root_path()
|
source_process_model_root = FileSystemService.root_path()
|
||||||
source_process_model_path = os.path.join(source_process_model_root, process_model_id)
|
source_process_model_path = os.path.join(source_process_model_root, process_model_id)
|
||||||
|
unique_hex = uuid.uuid4().hex
|
||||||
|
clone_dir = f"sample-process-models.{unique_hex}"
|
||||||
|
|
||||||
# clone new instance of sample-process-models, checkout branch_to_update
|
# clone new instance of sample-process-models, checkout branch_to_update
|
||||||
os.chdir("/tmp")
|
os.chdir("/tmp")
|
||||||
destination_process_root = "/tmp/sample-process-models"
|
destination_process_root = f"/tmp/{clone_dir}"
|
||||||
if os.path.exists(destination_process_root):
|
os.system(f"git clone https://github.com/sartography/sample-process-models.git {clone_dir}")
|
||||||
shutil.rmtree(destination_process_root)
|
|
||||||
os.system("git clone https://github.com/sartography/sample-process-models.git")
|
|
||||||
os.chdir(destination_process_root)
|
os.chdir(destination_process_root)
|
||||||
|
|
||||||
# create publish branch from branch_to_update
|
# create publish branch from branch_to_update
|
||||||
|
|
Loading…
Reference in New Issue