Skip to content

Commit 9092b71

Browse files
committed
(nipa-update.jinja2): Copy remote directory, so we dont overwrite results.json
If we just generate results.json, it will delete old results. Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent bbdf187 commit 9092b71

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

config/runtime/nipa-update.jinja2

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ class Job(BaseJob):
5656
subprocess.run(["git", "pull"], cwd=nipa_path)
5757
# chdir to the nipa_path
5858
os.chdir(nipa_path)
59-
# run the nipa-update
60-
args = ["/tmp/kernelci-nipa/nipa-results", "--id", parent_job]
61-
# if api_name is not production, add --staging
62-
if self._api_name != "production":
63-
args.append("--staging")
64-
r = subprocess.run(args, cwd=nipa_path)
65-
if r.returncode != 0:
66-
raise Exception(f"Failed to run nipa-update for node {self._nodeid}: {r.stderr}")
6759
# Upload results to the storage
6860
# Check key env var KCI_SSH_KEY
6961
ssh_key_path = os.getenv("KCI_SSH_KEY")
@@ -78,7 +70,25 @@ class Job(BaseJob):
7870
if self._api_name != "production":
7971
ssh_username = "nipa-staging"
8072
ssh_host = "storage.staging.kernelci.org"
81-
73+
74+
# create a local directory for the nipa-results
75+
local_nipa_results = "/tmp/kernelci-nipa/netdev-results"
76+
if not os.path.exists(local_nipa_results):
77+
os.makedirs(local_nipa_results)
78+
79+
# copy current(remote) nipa-results to a local directory
80+
cmd = f"scp -P {ssh_port} -r -i {ssh_key_path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {ssh_username}@{ssh_host}:* {local_nipa_results}/netdev-results"
81+
subprocess.run(cmd, shell=True)
82+
83+
# run the nipa-update
84+
args = ["/tmp/kernelci-nipa/nipa-results", "--id", parent_job]
85+
# if api_name is not production, add --staging
86+
if self._api_name != "production":
87+
args.append("--staging")
88+
r = subprocess.run(args, cwd=nipa_path)
89+
if r.returncode != 0:
90+
raise Exception(f"Failed to run nipa-update for node {self._nodeid}: {r.stderr}")
91+
8292
cmd = f"scp -P {ssh_port} -r -i {ssh_key_path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {nipa_path}/netdev-results/* {ssh_username}@{ssh_host}:"
8393
# scp nipa-results to the storage, recursive
8494
subprocess.run(cmd, shell=True, cwd=nipa_path)

0 commit comments

Comments
 (0)