From 59872648905129ab6be1afb11d8802dec325c8e0 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 20 Mar 2024 15:10:42 -0700 Subject: [PATCH] [WIP] Add steps to build docker image before running process --- build/freeloadio.run | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build/freeloadio.run b/build/freeloadio.run index a26b887..96d6b48 100755 --- a/build/freeloadio.run +++ b/build/freeloadio.run @@ -10,11 +10,21 @@ commit_before_sha = getenv("CI_COMMIT_BEFORE_SHA") commit_sha = getenv("CI_COMMIT_SHA") commit_ref_name = getenv("CI_COMMIT_REF_NAME") directories = set() +dockerfile_updated = False cmd = "git clone https://code.ryuslash.org/ryuslash/git-lfs-test.git ." print(cmd) run(cmd, shell=True) +cmd = "docker images ryuslash.org/freeloadio" +print(cmd) +process = run(cmd, shell=True, capture_output=True) +process_output = process.stdout.decode() + +if len(process_output.strip().split("\n")) == 1: + # We don't have any docker file at all yet. + dockerfile_updated = True + if not match(r"^0+$", commit_before_sha): cmd = f"git diff --name-only {quote(commit_before_sha)} {quote(commit_sha)}" print(cmd) @@ -22,7 +32,14 @@ if not match(r"^0+$", commit_before_sha): process_output = process.stdout.decode() print(process_output) for filename in process_output.strip().split("\n"): + if filename == "Dockerfile": + dockerfile_updated = True directories.add(dirname(filename)) +if dockerfile_updated: + cmd = "docker build -t ryuslash.org/freeloadio:latest ." + print(cmd) + run(cmd, shell=True) + unix_directory_list = str.join(":", directories) print(f"python tasks.py probe --directories={quote(unix_directory_list)}")