mirror of
https://github.com/openai/codex.git
synced 2026-05-21 19:45:26 +00:00
release/npm: bundle standalone bwrap on Linux (#21257)
This commit is contained in:
@@ -596,6 +596,10 @@ install_release() {
|
||||
cp "$vendor_root/path/rg" "$stage_release/codex-resources/rg"
|
||||
chmod 0755 "$stage_release/codex"
|
||||
chmod 0755 "$stage_release/codex-resources/rg"
|
||||
if [ -f "$vendor_root/codex-resources/bwrap" ]; then
|
||||
cp "$vendor_root/codex-resources/bwrap" "$stage_release/codex-resources/bwrap"
|
||||
chmod 0755 "$stage_release/codex-resources/bwrap"
|
||||
fi
|
||||
|
||||
if [ -e "$release_dir" ] || [ -L "$release_dir" ]; then
|
||||
rm -rf "$release_dir"
|
||||
@@ -611,7 +615,11 @@ release_dir_is_complete() {
|
||||
[ -d "$release_dir" ] &&
|
||||
[ -x "$release_dir/codex" ] &&
|
||||
[ -x "$release_dir/codex-resources/rg" ] &&
|
||||
[ "$(basename "$release_dir")" = "$expected_version-$expected_target" ]
|
||||
[ "$(basename "$release_dir")" = "$expected_version-$expected_target" ] &&
|
||||
case "$expected_target" in
|
||||
*linux*) [ -x "$release_dir/codex-resources/bwrap" ] ;;
|
||||
*) true ;;
|
||||
esac
|
||||
}
|
||||
|
||||
update_current_link() {
|
||||
|
||||
@@ -58,6 +58,16 @@ def parse_args() -> argparse.Namespace:
|
||||
action="store_true",
|
||||
help="Retain temporary staging directories instead of deleting them.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--allow-missing-native-component",
|
||||
dest="allow_missing_native_components",
|
||||
action="append",
|
||||
default=[],
|
||||
help=(
|
||||
"Native component that may be absent from reused workflow artifacts. "
|
||||
"Intended for CI compatibility only; release staging should not use this."
|
||||
),
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -147,6 +157,8 @@ def main() -> int:
|
||||
|
||||
packages = expand_packages(list(args.packages))
|
||||
native_components = collect_native_components(packages)
|
||||
allow_missing_native_components = set(args.allow_missing_native_components)
|
||||
native_components_to_install = native_components - allow_missing_native_components
|
||||
|
||||
vendor_temp_root: Path | None = None
|
||||
vendor_src: Path | None = None
|
||||
@@ -155,12 +167,12 @@ def main() -> int:
|
||||
final_messages = []
|
||||
|
||||
try:
|
||||
if native_components:
|
||||
if native_components_to_install:
|
||||
workflow_url, resolved_head_sha = resolve_workflow_url(
|
||||
args.release_version, args.workflow_url
|
||||
)
|
||||
vendor_temp_root = Path(tempfile.mkdtemp(prefix="npm-native-", dir=runner_temp))
|
||||
install_native_components(workflow_url, native_components, vendor_temp_root)
|
||||
install_native_components(workflow_url, native_components_to_install, vendor_temp_root)
|
||||
vendor_src = vendor_temp_root / "vendor"
|
||||
|
||||
if resolved_head_sha:
|
||||
@@ -185,6 +197,9 @@ def main() -> int:
|
||||
if vendor_src is not None:
|
||||
cmd.extend(["--vendor-src", str(vendor_src)])
|
||||
|
||||
for component in sorted(allow_missing_native_components):
|
||||
cmd.extend(["--allow-missing-native-component", component])
|
||||
|
||||
try:
|
||||
run_command(cmd)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user