From e9ad54317d3f3f598104f21e6054838c9c982061 Mon Sep 17 00:00:00 2001 From: stas Date: Tue, 16 Feb 2021 11:52:48 -0800 Subject: [PATCH] Use updated schemathesis docker image --- cli/raft-tools/libs/python3/raft.py | 10 ++++++++-- cli/raft-tools/tools/Schemathesis/config.json | 4 ++-- cli/raft-tools/tools/Schemathesis/run.py | 5 +++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cli/raft-tools/libs/python3/raft.py b/cli/raft-tools/libs/python3/raft.py index 4a0a18a2..c33a107f 100644 --- a/cli/raft-tools/libs/python3/raft.py +++ b/cli/raft-tools/libs/python3/raft.py @@ -26,7 +26,7 @@ def install_certificates(): subprocess.check_call(["update-ca-certificates", "--fresh"]) -def auth_token(init): +def auth_token(init, pip_root_dir=None): work_directory = os.environ['RAFT_WORK_DIRECTORY'] run_directory = os.environ['RAFT_TOOL_RUN_DIRECTORY'] with open(os.path.join(work_directory, "task-config.json"), 'r') as task_config: @@ -49,7 +49,13 @@ def auth_token(init): if init: print("Installing MSAL requirements") - subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", os.path.join(msal_dir, "requirements.txt")]) + args = [sys.executable, "-m", "pip", "install", "--no-cache-dir"] + if pip_root_dir: + args = args + ["--root", pip_root_dir] + + args = args + ["-r", os.path.join(msal_dir, "requirements.txt")] + + subprocess.check_call(args) else: print("Retrieving MSAL token") sys.path.append(msal_dir) diff --git a/cli/raft-tools/tools/Schemathesis/config.json b/cli/raft-tools/tools/Schemathesis/config.json index 2713b28c..f93cd4ce 100644 --- a/cli/raft-tools/tools/Schemathesis/config.json +++ b/cli/raft-tools/tools/Schemathesis/config.json @@ -1,9 +1,9 @@ { - "container" : "python:3.9.1-buster", + "container" : "schemathesis/schemathesis:v3.0.8-buster", "shell" : "/bin/sh", "run" : { "shellArguments" : ["-c", - "pip install schemathesis; cd /; python3 $RAFT_TOOL_RUN_DIRECTORY/run.py install; sleep $RAFT_STARTUP_DELAY; python3 $RAFT_TOOL_RUN_DIRECTORY/run.py" ] + "cd /; python3 $RAFT_TOOL_RUN_DIRECTORY/run.py install; sleep $RAFT_STARTUP_DELAY; python3 $RAFT_TOOL_RUN_DIRECTORY/run.py" ] }, "idle" : { "shellArguments" : ["-c", "echo DebugMode; while true; do sleep 100000; done;"] diff --git a/cli/raft-tools/tools/Schemathesis/run.py b/cli/raft-tools/tools/Schemathesis/run.py index f7c50c86..1605f113 100644 --- a/cli/raft-tools/tools/Schemathesis/run.py +++ b/cli/raft-tools/tools/Schemathesis/run.py @@ -11,9 +11,10 @@ if __name__ == "__main__": if len(sys.argv) == 2 and sys.argv[1] == "install": - subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", os.path.join(raft_libs_dir, "requirements.txt")]) - raft.auth_token(True) + subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", "--root", "/tmp", "-r", os.path.join(raft_libs_dir, "requirements.txt")]) + raft.auth_token(True, pip_root_dir='/tmp') else: + sys.path.append('/tmp/usr/local/lib/python3.9/site-packages') raft.install_certificates() token = raft.auth_token(False)