Skip to content

Commit a948794

Browse files
fixed restore build artifacts issue on docker hub triggering (#259)
* Added dockerhub build-variants. Added by.hash (we have by.branch, by.tag, by.hash now) * fixes per flake linter * Updated poetry lock * Running on tox on PR in gh * tox 5.0.0 and docker >= 7 * Fixed utils/tests/test_builder.py::test_commit_schema_to_stream_then_build * Fixed utils/tests/test_builder.py:76: AssertionError * Fixed poetry lock * Added dockerhub E2E triggering/tests * Running dockerhub tests by default on CI * Ensuring we have small CPU count requests for CI * Fixed prefetch image test * Include a way of triggering dockerhub run * Add airgap option to cli docker triggering * fixed restore build artifacts issue on docker hub triggering * Fixed linter issues
1 parent 987bb2c commit a948794

File tree

4 files changed

+39
-29
lines changed

4 files changed

+39
-29
lines changed

pyproject.toml

+1-1
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

+19-13
Original file line numberDiff line numberDiff line change
@@ -521,22 +521,28 @@ 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)
528524
# 7 days expire
529525
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
526+
if conn.exists(airgap_key):
527+
logging.info(
528+
f"DOCKER AIRGAP KEY ALREADY EXISTS: {airgap_key}. Updating only the expire time"
529+
)
530+
conn.expire(airgap_key, binary_exp_secs)
531+
else:
532+
run_image_binary_stream = io.BytesIO()
533+
run_image_docker = docker_client.images.get(run_image)
534+
for chunk in run_image_docker.save():
535+
run_image_binary_stream.write(chunk)
536+
res_airgap = conn.set(
537+
airgap_key,
538+
run_image_binary_stream.getbuffer(),
539+
ex=binary_exp_secs,
540+
)
541+
logging.info(
542+
"DOCKER AIR GAP: result of set bin data to {}: {}".format(
543+
airgap_key, res_airgap
544+
)
538545
)
539-
)
540546

541547

542548
def generate_benchmark_stream_request(

redis_benchmarks_specification/__cli__/cli.py

+1
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

+18-15
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@ 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(
25+
build_artifact, artifact_fname
26+
)
27+
)

0 commit comments

Comments
 (0)