Skip to content

fixed restore build artifacts issue on docker hub triggering #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "redis-benchmarks-specification"
version = "0.1.210"
version = "0.1.213"
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."
authors = ["filipecosta90 <filipecosta.90@gmail.com>","Redis Performance Group <performance@redis.com>"]
readme = "Readme.md"
Expand Down
32 changes: 19 additions & 13 deletions redis_benchmarks_specification/__builder__/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,22 +521,28 @@ def store_airgap_image_redis(conn, docker_client, run_image):
run_image, airgap_key
)
)
run_image_binary_stream = io.BytesIO()
run_image_docker = docker_client.images.get(run_image)
for chunk in run_image_docker.save():
run_image_binary_stream.write(chunk)
# 7 days expire
binary_exp_secs = 24 * 60 * 60 * 7
res_airgap = conn.set(
airgap_key,
run_image_binary_stream.getbuffer(),
ex=binary_exp_secs,
)
logging.info(
"DOCKER AIR GAP: result of set bin data to {}: {}".format(
airgap_key, res_airgap
if conn.exists(airgap_key):
logging.info(
f"DOCKER AIRGAP KEY ALREADY EXISTS: {airgap_key}. Updating only the expire time"
)
conn.expire(airgap_key, binary_exp_secs)
else:
run_image_binary_stream = io.BytesIO()
run_image_docker = docker_client.images.get(run_image)
for chunk in run_image_docker.save():
run_image_binary_stream.write(chunk)
res_airgap = conn.set(
airgap_key,
run_image_binary_stream.getbuffer(),
ex=binary_exp_secs,
)
logging.info(
"DOCKER AIR GAP: result of set bin data to {}: {}".format(
airgap_key, res_airgap
)
)
)


def generate_benchmark_stream_request(
Expand Down
1 change: 1 addition & 0 deletions redis_benchmarks_specification/__cli__/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def trigger_tests_dockerhub_cli_command_logic(args, project_name, project_versio
)
build_stream_fields["github_repo"] = args.gh_repo
build_stream_fields["github_org"] = args.gh_org
build_stream_fields["restore_build_artifacts"] = "False"
server_name = args.gh_repo
if args.server_name is not None:
server_name = args.server_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ def restore_build_artifacts_from_test_details(
build_artifacts, conn, temporary_dir, testDetails
):
for build_artifact in build_artifacts:
buffer_key = testDetails["{}".format(build_artifact).encode()]
logging.info(
"Reading artifact binary {} from key {}".format(build_artifact, buffer_key)
)
buffer = bytes(conn.get(buffer_key))
artifact_fname = "{}/{}".format(temporary_dir, build_artifact)
with open(artifact_fname, "wb") as fd:
fd.write(buffer)
os.chmod(artifact_fname, 755)
# TODO: re-enable
# if build_artifact == "redis-server":
# redis_server_path = artifact_fname
build_artifact_key = "{}".format(build_artifact).encode()
if build_artifact_key in testDetails:
buffer_key = testDetails[build_artifact_key]
logging.info(
"Reading artifact binary {} from key {}".format(
build_artifact, buffer_key
)
)
buffer = bytes(conn.get(buffer_key))
artifact_fname = "{}/{}".format(temporary_dir, build_artifact)
with open(artifact_fname, "wb") as fd:
fd.write(buffer)
os.chmod(artifact_fname, 755)

logging.info(
"Successfully restored {} into {}".format(build_artifact, artifact_fname)
)
logging.info(
"Successfully restored {} into {}".format(
build_artifact, artifact_fname
)
)
Loading