Skip to content

Commit

Permalink
(nipa-update.jinja2): Copy remote directory, so we dont overwrite res…
Browse files Browse the repository at this point in the history
…ults.json

If we just generate results.json, it will delete old results.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
  • Loading branch information
nuclearcat committed Mar 3, 2025
1 parent bbdf187 commit 9092b71
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions config/runtime/nipa-update.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ class Job(BaseJob):
subprocess.run(["git", "pull"], cwd=nipa_path)
# chdir to the nipa_path
os.chdir(nipa_path)
# run the nipa-update
args = ["/tmp/kernelci-nipa/nipa-results", "--id", parent_job]
# if api_name is not production, add --staging
if self._api_name != "production":
args.append("--staging")
r = subprocess.run(args, cwd=nipa_path)
if r.returncode != 0:
raise Exception(f"Failed to run nipa-update for node {self._nodeid}: {r.stderr}")
# Upload results to the storage
# Check key env var KCI_SSH_KEY
ssh_key_path = os.getenv("KCI_SSH_KEY")
Expand All @@ -78,7 +70,25 @@ class Job(BaseJob):
if self._api_name != "production":
ssh_username = "nipa-staging"
ssh_host = "storage.staging.kernelci.org"


# create a local directory for the nipa-results
local_nipa_results = "/tmp/kernelci-nipa/netdev-results"
if not os.path.exists(local_nipa_results):
os.makedirs(local_nipa_results)

# copy current(remote) nipa-results to a local directory
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"
subprocess.run(cmd, shell=True)

# run the nipa-update
args = ["/tmp/kernelci-nipa/nipa-results", "--id", parent_job]
# if api_name is not production, add --staging
if self._api_name != "production":
args.append("--staging")
r = subprocess.run(args, cwd=nipa_path)
if r.returncode != 0:
raise Exception(f"Failed to run nipa-update for node {self._nodeid}: {r.stderr}")

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}:"
# scp nipa-results to the storage, recursive
subprocess.run(cmd, shell=True, cwd=nipa_path)
Expand Down

0 comments on commit 9092b71

Please sign in to comment.