bitfab 0.64.0 → 0.64.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bitfab/cloudReplay.py +5 -24
- data/lib/bitfab/replay_cli.rb +14 -1
- data/lib/bitfab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ab2d1343a1244985917d2edfa99de8df18e81ae9d8983ce5762d0edb1dc5251
|
|
4
|
+
data.tar.gz: bebef60f9652ad4de1a4880483d084a33e8c6da41b0a8dbb34f81bc6577a4613
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a207fc06c32414a7a85e9f676b4108009da4b4cd86ad2778772b078ab8f73d7f4694a7f017f32177e5a57a2fa106be3a9d3a0374a3c2d889b1011775153b593
|
|
7
|
+
data.tar.gz: e6e2b45e084896320e1dbbacab2119b3492e38134aff9b820840667bae01a081f438e0e77b17ff936c223135ad7054e7b91387b7230d766fd4fd3e1ae9c0767d
|
data/lib/bitfab/cloudReplay.py
CHANGED
|
@@ -413,7 +413,7 @@ def configure_secrets(argv):
|
|
|
413
413
|
*(["--env", environment] if environment else []),
|
|
414
414
|
],
|
|
415
415
|
input=values.get(name, values.get(targets[name])),
|
|
416
|
-
env=
|
|
416
|
+
env={**os.environ, "GH_TOKEN": token},
|
|
417
417
|
)
|
|
418
418
|
result["set"] = [targets[name] for name in found]
|
|
419
419
|
if missing or empty:
|
|
@@ -425,8 +425,9 @@ def configure_secrets(argv):
|
|
|
425
425
|
def github_access():
|
|
426
426
|
if shutil.which("gh") is not None:
|
|
427
427
|
with contextlib.suppress(RuntimeError, OSError, subprocess.SubprocessError):
|
|
428
|
-
command(["gh", "auth", "
|
|
429
|
-
|
|
428
|
+
token = command(["gh", "auth", "token", "--hostname", "github.com"])
|
|
429
|
+
if token:
|
|
430
|
+
return {"source": "the GitHub CLI", "token": token}
|
|
430
431
|
for name in ("GH_TOKEN", "GITHUB_TOKEN"):
|
|
431
432
|
if os.environ.get(name):
|
|
432
433
|
return {"source": name, "token": os.environ[name]}
|
|
@@ -467,26 +468,6 @@ def api(repo, suffix, *, method="GET", payload=None, raw=False):
|
|
|
467
468
|
path = f"repos/{repo}" + (f"/{suffix}" if suffix else "")
|
|
468
469
|
access = github_access()
|
|
469
470
|
data = None if payload is None else json.dumps(payload)
|
|
470
|
-
if access["token"] is None:
|
|
471
|
-
result = command(
|
|
472
|
-
[
|
|
473
|
-
"gh",
|
|
474
|
-
"api",
|
|
475
|
-
"--hostname",
|
|
476
|
-
"github.com",
|
|
477
|
-
"-H",
|
|
478
|
-
f"X-GitHub-Api-Version: {API_VERSION}",
|
|
479
|
-
*([] if raw else ["--jq", "tojson"]),
|
|
480
|
-
path,
|
|
481
|
-
"--method",
|
|
482
|
-
method,
|
|
483
|
-
*(["--input", "-"] if data is not None else []),
|
|
484
|
-
],
|
|
485
|
-
input=data,
|
|
486
|
-
)
|
|
487
|
-
if raw:
|
|
488
|
-
return result
|
|
489
|
-
return json.loads(result) if result else None
|
|
490
471
|
request = urllib.request.Request(
|
|
491
472
|
f"https://api.github.com/{path}",
|
|
492
473
|
method=method,
|
|
@@ -512,7 +493,7 @@ def api(repo, suffix, *, method="GET", payload=None, raw=False):
|
|
|
512
493
|
raise CommandError(
|
|
513
494
|
"Python cannot verify GitHub's certificate because it has no certificate store. "
|
|
514
495
|
"On a python.org install, run Install Certificates.command from its Applications folder, "
|
|
515
|
-
"set SSL_CERT_FILE to a certificate bundle
|
|
496
|
+
"or set SSL_CERT_FILE to a certificate bundle"
|
|
516
497
|
) from None
|
|
517
498
|
raise CommandError(f"Could not reach api.github.com: {reason}") from None
|
|
518
499
|
if raw:
|
data/lib/bitfab/replay_cli.rb
CHANGED
|
@@ -54,7 +54,11 @@ module Bitfab
|
|
|
54
54
|
|
|
55
55
|
def load_registry(path)
|
|
56
56
|
container = Module.new
|
|
57
|
-
|
|
57
|
+
begin
|
|
58
|
+
container.module_eval(File.read(path), path)
|
|
59
|
+
rescue LoadError => error
|
|
60
|
+
raise ArgumentError, "#{error.message}\n\n#{registry_import_hint(path)}"
|
|
61
|
+
end
|
|
58
62
|
registry = container.const_get(:REGISTRY, false) if container.const_defined?(:REGISTRY, false)
|
|
59
63
|
unless registry.is_a?(ReplayRegistry)
|
|
60
64
|
raise ArgumentError,
|
|
@@ -63,5 +67,14 @@ module Bitfab
|
|
|
63
67
|
|
|
64
68
|
registry
|
|
65
69
|
end
|
|
70
|
+
|
|
71
|
+
def registry_import_hint(path)
|
|
72
|
+
[
|
|
73
|
+
"The replay registry '#{path}' could not load one of its requires.",
|
|
74
|
+
"A registry belongs in the app that builds the traced method's call and already depends on everything it requires (its tools, clients, and config), and bitfab-replay runs from that app's directory with its bundle.",
|
|
75
|
+
"When the traced method lives in a lower-level gem that an app calls, put the registry in the app and add bitfab to its Gemfile. Copying the app's dependencies into the gem is the wrong fix.",
|
|
76
|
+
"See \"When the traced method needs the app's dependencies\" at https://docs.bitfab.ai/ruby-sdk."
|
|
77
|
+
].join("\n")
|
|
78
|
+
end
|
|
66
79
|
end
|
|
67
80
|
end
|
data/lib/bitfab/version.rb
CHANGED