Skip to content

Commit 89740aa

Browse files
fixed restore build artifacts issue on docker hub triggering
1 parent 2961fb5 commit 89740aa

File tree

4 files changed

+38
-29
lines changed

4 files changed

+38
-29
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-benchmarks-specification"
3-
version = "0.1.210"
3+
version = "0.1.213"
44
description = "The Redis benchmarks specification describes the cross-language/tools requirements and expectations to foster performance and observability standards around redis related technologies. Members from both industry and academia, including organizations and individuals are encouraged to contribute."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "Readme.md"

redis_benchmarks_specification/__builder__/builder.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -521,22 +521,29 @@ def store_airgap_image_redis(conn, docker_client, run_image):
521521
run_image, airgap_key
522522
)
523523
)
524-
run_image_binary_stream = io.BytesIO()
525-
run_image_docker = docker_client.images.get(run_image)
526-
for chunk in run_image_docker.save():
527-
run_image_binary_stream.write(chunk)
524+
528525
# 7 days expire
529526
binary_exp_secs = 24 * 60 * 60 * 7
530-
res_airgap = conn.set(
531-
airgap_key,
532-
run_image_binary_stream.getbuffer(),
533-
ex=binary_exp_secs,
534-
)
535-
logging.info(
536-
"DOCKER AIR GAP: result of set bin data to {}: {}".format(
537-
airgap_key, res_airgap
527+
if conn.exists(airgap_key):
528+
logging.info(
529+
f"DOCKER AIRGAP KEY ALREADY EXISTS: {airgap_key}. Updating only the expire time"
530+
)
531+
conn.expire(airgap_key, binary_exp_secs)
532+
else:
533+
run_image_binary_stream = io.BytesIO()
534+
run_image_docker = docker_client.images.get(run_image)
535+
for chunk in run_image_docker.save():
536+
run_image_binary_stream.write(chunk)
537+
res_airgap = conn.set(
538+
airgap_key,
539+
run_image_binary_stream.getbuffer(),
540+
ex=binary_exp_secs,
541+
)
542+
logging.info(
543+
"DOCKER AIR GAP: result of set bin data to {}: {}".format(
544+
airgap_key, res_airgap
545+
)
538546
)
539-
)
540547

541548

542549
def generate_benchmark_stream_request(

redis_benchmarks_specification/__cli__/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def trigger_tests_dockerhub_cli_command_logic(args, project_name, project_versio
9090
)
9191
build_stream_fields["github_repo"] = args.gh_repo
9292
build_stream_fields["github_org"] = args.gh_org
93+
build_stream_fields["restore_build_artifacts"] = "False"
9394
server_name = args.gh_repo
9495
if args.server_name is not None:
9596
server_name = args.server_name

redis_benchmarks_specification/__self_contained_coordinator__/artifacts.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ def restore_build_artifacts_from_test_details(
66
build_artifacts, conn, temporary_dir, testDetails
77
):
88
for build_artifact in build_artifacts:
9-
buffer_key = testDetails["{}".format(build_artifact).encode()]
10-
logging.info(
11-
"Reading artifact binary {} from key {}".format(build_artifact, buffer_key)
12-
)
13-
buffer = bytes(conn.get(buffer_key))
14-
artifact_fname = "{}/{}".format(temporary_dir, build_artifact)
15-
with open(artifact_fname, "wb") as fd:
16-
fd.write(buffer)
17-
os.chmod(artifact_fname, 755)
18-
# TODO: re-enable
19-
# if build_artifact == "redis-server":
20-
# redis_server_path = artifact_fname
9+
build_artifact_key = "{}".format(build_artifact).encode()
10+
if build_artifact_key in testDetails:
11+
buffer_key = testDetails[build_artifact_key]
12+
logging.info(
13+
"Reading artifact binary {} from key {}".format(
14+
build_artifact, buffer_key
15+
)
16+
)
17+
buffer = bytes(conn.get(buffer_key))
18+
artifact_fname = "{}/{}".format(temporary_dir, build_artifact)
19+
with open(artifact_fname, "wb") as fd:
20+
fd.write(buffer)
21+
os.chmod(artifact_fname, 755)
2122

22-
logging.info(
23-
"Successfully restored {} into {}".format(build_artifact, artifact_fname)
24-
)
23+
logging.info(
24+
"Successfully restored {} into {}".format(build_artifact, artifact_fname)
25+
)

0 commit comments

Comments
 (0)