Skip to content
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
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ updates:
# both.
- package-ecosystem: "gomod"
directories:
- "/src/agent_env/computers/artifacts/ubuntu-24.04/egress"
- "/src/agent_env/computers/artifacts/ubuntu-24.04-browser/egress"
- "/src/agent_env/utils/egress_proxy"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
Expand Down
35 changes: 29 additions & 6 deletions .github/scripts/infra_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@
import platform
import posixpath
import re
import shutil
import subprocess
import sys
import tempfile
import time
import tomllib
from collections.abc import Callable
from pathlib import Path

REGISTRY = "ghcr.io/scaleapi"
REPO = Path(__file__).resolve().parents[2]
# What an image's shared_sources.toml names is under here, as agent_env.utils.paths.SOURCES is.
SOURCES = REPO / "src" / "agent_env"
# Each image agent-env ships, by name, and the Dockerfile it's built from, with its folder as the context.
IMAGES = {
"agentenv-gateway": "src/agent_env/env/gateway/Dockerfile",
Expand Down Expand Up @@ -226,12 +230,31 @@ def _build(entry: str, arch: str) -> int:
for arg, value in {"ROOTFS": rootfs, "TOOLS": args["TOOLS"], "SIZE_GB": args["SIZE_GB"],
"ROOTFS_CONFIG": _config(rootfs)}.items():
build_args += ["--build-arg", f"{arg}={value}"]
command = ["docker", "build", "--platform", target, "--provenance=false", "-f", image["dockerfile"],
"-t", f"{_ref(image)}-{arch}", *build_args,
"--label", f"org.opencontainers.image.source=https://github.com/{os.environ['GITHUB_REPOSITORY']}",
"--label", f"org.opencontainers.image.revision={os.environ['GITHUB_SHA']}",
"--label", f"io.agentenv.source-tag={image['tag']}", image["context"]]
return _tried_again(lambda: _streamed(command)).returncode
with tempfile.TemporaryDirectory(prefix="agentenv-context-") as staged:
context, dockerfile = image["context"], image["dockerfile"]
if (Path(context) / "shared_sources.toml").is_file():
context = _staged(image["context"], staged)
dockerfile = os.path.join(context, os.path.relpath(image["dockerfile"], image["context"]))
command = ["docker", "build", "--platform", target, "--provenance=false", "-f", dockerfile,
"-t", f"{_ref(image)}-{arch}", *build_args,
"--label", f"org.opencontainers.image.source=https://github.com/{os.environ['GITHUB_REPOSITORY']}",
"--label", f"org.opencontainers.image.revision={os.environ['GITHUB_SHA']}",
"--label", f"io.agentenv.source-tag={image['tag']}", context]
return _tried_again(lambda: _streamed(command)).returncode


def _staged(context: str, staged: str) -> str:
"""``context`` copied into ``staged`` with what its ``shared_sources.toml`` takes from agent-env's sources, each at
the name it gives, as agent-env's build contexts send it (``agent_env.utils.docker.context``)."""
shutil.copytree(context, staged, dirs_exist_ok=True)
declared = Path(context) / "shared_sources.toml"
for name, source in (tomllib.loads(declared.read_text()) if declared.is_file() else {}).items():
path = SOURCES / source
if path.is_dir():
shutil.copytree(path, Path(staged) / name)
else:
shutil.copy2(path, Path(staged) / name)
return staged


def _publish(missing: str) -> int:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Clock gates

# agent-env's libfaketime (src/agent_env/computers/artifacts/ubuntu-24.04/clock), the library every computer's session programs load to read
# agent-env's libfaketime (src/agent_env/utils/faketime_clock), the library every computer's session programs load to read
# universe time, built with stock 0.9.12 beside it in an Ubuntu 24.04 image and run through tst/clock's gates on x86_64
# and arm64: every wait API in C, Python, Java and Node at several rates, jumps, cancelled waits, timerfd duplicates,
# condvar and semaphore stress, the waits again with futex_waitv refused, a stalled writer and a dead one, torn page
Expand All @@ -10,7 +10,7 @@ name: Clock gates
on:
pull_request:
paths:
- "src/agent_env/computers/artifacts/ubuntu-24.04/clock/**"
- "src/agent_env/utils/faketime_clock/**"
- "src/agent_env/browsers/envs/chromium/chromium.py"
- "tst/clock/**"
- ".github/workflows/clock.yml"
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.AGENTENV_TEST_CLOCK_CACHE }}
key: clock-downloads-${{ matrix.arch }}-${{ hashFiles('src/agent_env/browsers/envs/chromium/chromium.py', 'src/agent_env/computers/artifacts/ubuntu-24.04/clock/build.sh', 'tst/clock/conftest.py') }}
key: clock-downloads-${{ matrix.arch }}-${{ hashFiles('src/agent_env/browsers/envs/chromium/chromium.py', 'src/agent_env/utils/faketime_clock/build.sh', 'tst/clock/conftest.py') }}
- name: Clock gates
run: .venv/bin/python -m pytest tst/clock -rA --timeout=2400 --junitxml=junit-clock-${{ matrix.arch }}.xml
- name: No skips
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/local-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"

jobs:
# The base computer's egress proxy (src/agent_env/computers/artifacts/ubuntu-24.04/egress/): gofmt, go vet and its
# The base computer's egress proxy (src/agent_env/utils/egress_proxy/): gofmt, go vet and its
# tests under the race detector, in the Go image its Dockerfile builds with, so a failing Go test fails here rather
# than as a broken base image in the slow tier.
egress:
Expand Down
Loading
Loading