-
Notifications
You must be signed in to change notification settings - Fork 603
[ENG-603] Fix caching in care backend build actions #3696
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
9d9a3ea
9a4b733
76ddd40
ba2e22f
7faf1f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/usr/bin/env python3 | ||
| import hashlib | ||
| import json | ||
| import os | ||
| import subprocess | ||
| import sys | ||
|
|
||
| plugs_raw = os.environ.get("ADDITIONAL_PLUGS", "[]") | ||
| try: | ||
| plugs = json.loads(plugs_raw) | ||
| except json.JSONDecodeError: | ||
| sys.stdout.write("no-plugins") | ||
| sys.exit(0) | ||
|
|
||
| if not plugs: | ||
| sys.stdout.write("no-plugins") | ||
| sys.exit(0) | ||
|
|
||
| resolved = [] | ||
| for p in plugs: | ||
| ver = p.get("version", "@main") | ||
| pkg = p.get("package_name") | ||
| if not pkg: | ||
| sys.stderr.write(f"plugin entry {p!r} is missing 'package_name'\n") | ||
| sys.exit(1) | ||
| if ver.startswith("@"): | ||
| ref = ver[1:] | ||
| git_url = pkg.removeprefix("git+") | ||
| try: | ||
| out = subprocess.run( # noqa: S603 | ||
| ["git", "ls-remote", git_url, ref], # noqa: S607 | ||
| check=False, | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=15, | ||
| ) | ||
| sha = out.stdout.split()[0] if out.stdout else ref | ||
| except Exception: | ||
| sha = ref | ||
| resolved.append(f"{pkg}@{sha}") | ||
| else: | ||
| resolved.append(f"{pkg}{ver}") | ||
|
Comment on lines
+26
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor 🧩 Analysis chain🏁 Script executed: python3 - <<'PY'
from pathlib import Path
p = Path('.github/scripts/resolve_plugins.py')
print(p.exists(), p)
print(p.read_text())
PYRepository: ohcnetwork/care Length of output: 1395 🏁 Script executed: python3 - <<'PY'
from pathlib import Path
p = Path('.github/scripts/resolve_plugins.py')
print(p.exists(), p)
print(p.read_text())
PYRepository: ohcnetwork/care Length of output: 1395 Avoid falling back to the raw ref here. When Also, 🧰 Tools🪛 ast-grep (0.44.0)[error] 29-35: Command coming from incoming request (subprocess-from-request) 🪛 Ruff (0.15.18)[warning] 38-38: Do not catch blind exception: (BLE001) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| h = hashlib.sha256(json.dumps(sorted(resolved)).encode()).hexdigest()[:16] | ||
| print(h, end="") # noqa: T201 | ||
Uh oh!
There was an error while loading. Please reload this page.