.gitlab-ci.yml updated v68

This commit is contained in:
Ivan Nikolaev-Axenov 2024-06-06 10:17:59 +03:00
parent 28fd132795
commit 5edbf4cf79

View file

@ -11,18 +11,23 @@ QEMU_ALPINE_DIR = os.environ['QEMU_ALPINE_DIR']
RESULT_FILES_DIR = os.environ['RESULT_FILES_DIR']
def run_docker(folder_name):
def run_docker(folder_name, date):
print(f"Running docker-compose for {folder_name}")
os.chdir(QEMU_ALPINE_DIR)
subprocess.call('docker compose up -d', shell=True)
time.sleep(3)
subprocess.call('scp -P 2233 -r ../clearing-docker-compose root@localhost:/root/clr_test', shell=True)
subprocess.call('ssh root@localhost -p 2222 -t \'cd clr_test; docker compose pull; docker compose build; date --set "2020-01-01 00:00:00"; docker compose up --abort-on-container-exit --exit-code-from clearing_system\'', shell=True)
subprocess.call("scp -P 2233 -r root@localhost:/root/clr_test/mnt/testFiles {RESULT_FILES_DIR}", shell=True)
subprocess.call(f"ssh root@localhost -p 2222 -t \'cd clr_test; docker compose pull; docker compose build; date --set \"{date} 00:00:00\"; docker compose up --abort-on-container-exit --exit-code-from clearing_system'", shell=True)
subprocess.call(f"scp -P 2233 -r root@localhost:/root/clr_test/mnt/testFiles {RESULT_FILES_DIR}", shell=True)
os.remove(f"{QEMU_ALPINE_DIR}/mounted/data.qcow2")
os.chdir("..")
def read_date(folder_name):
with open(f"{DATA_ROOT_DIR}/{folder_name}/date.txt") as f:
return f.read()
def main():
folders = [i for i in sorted(os.listdir(DATA_ROOT_DIR)) if re.search("\\d{1,}.\\d{1,}.*", i)]
shutil.rmtree(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/expected")
@ -32,7 +37,7 @@ def main():
shutil.copytree(f"{DATA_ROOT_DIR}/{folders[0]}/db/", f"{CLR_TEST_DIR}/db/", dirs_exist_ok=True)
shutil.copytree(f"{DATA_ROOT_DIR}/{folders[0]}/clearing_testing_utils/", f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/", dirs_exist_ok=True)
shutil.copy2(f"{QEMU_ALPINE_DIR}/data.qcow2", f"{QEMU_ALPINE_DIR}/mounted")
run_docker(folders[0])
run_docker(folders[0], read_date(folders[0]))
# for folder in folders:
# shutil.rmtree(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store")
# os.remove(f"{CLR_TEST_DIR}/db/export.sql")