Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Build.py improvement #16976

Merged
merged 2 commits into from
Jan 16, 2020
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
6 changes: 3 additions & 3 deletions ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ def load_docker_cache(tag, docker_registry) -> None:


def log_environment():
instance_id = ec2_instance_id_hostname()
if instance_id:
logging.info("EC2 Instance id: %s", instance_id)
instance_info = ec2_instance_info()
if instance_info:
logging.info("EC2: %s", instance_info)
pp = pprint.PrettyPrinter(indent=4)
logging.debug("Build environment: %s", pp.pformat(dict(os.environ)))

Expand Down
1 change: 1 addition & 0 deletions ci/safe_docker_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def run(self, *args, **kwargs) -> int:
logging.info("Executed command for reproduction:\n\n%s\n", " ".join(sys.argv))
else:
logging.info("Container exited with success 👍")
logging.info("Executed command for reproduction:\n\n%s\n", " ".join(sys.argv))
except Exception as err:
logging.exception(err)
return 150
Expand Down
5 changes: 4 additions & 1 deletion ci/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ def under_ci() -> bool:
return 'JOB_NAME' in os.environ


def ec2_instance_id_hostname() -> str:
def ec2_instance_info() -> str:
import requests
if under_ci():
result = []
try:
r = requests.get("http://instance-data/latest/meta-data/instance-type")
if r.status_code == 200:
result.append(r.content.decode())
r = requests.get("http://instance-data/latest/meta-data/instance-id")
if r.status_code == 200:
result.append(r.content.decode())
Expand Down