Use an IDE to create a python file containing the following script:
import json
from multiprocessing.connection import wait
import os
import time
with open ("/Users/elinaf/elina.json") as stud:
buildList = json.load(stud)
#get the results of the JSON file
a = buildList.get('results', None)
for build in a:
#print each build name and number
print(build["build.name"], build["build.number"])
#use the jfrog cli to scan each build name and number
os.system(f"jfrog rt bs {build['build.name']} {build['build.number']}")
print("Waiting for 60 seconds before scanning the next build...")
time.sleep(60)
Note: This script assumes that the JFrog CLI was already configured on the machine, and points to the Artifactory server. If the CLI was yet to be configured to point to Artifactory, it can be done using the jfrog c add command before running the script.
The output of the script execution should look similar to this:
Each build will be scanned 60 seconds apart to avoid overloading Xray with simultaneous scans. To avoid potentially affecting performance, run the script when Xray and Artifactory are less loaded (such as after work hours or during weekends).