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
4 changes: 3 additions & 1 deletion container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ The image contains the `copilot` binary from the matching GitHub release, which

## Building locally

The smoke test requires a Unix environment (Linux or macOS), Python 3, and Docker configured to run Linux containers. Native Windows Python is not supported because the bind-mounted Git check uses Unix UID/GID APIs (`os.getuid()` and `os.getgid()`). On Windows, run the commands below from a Linux environment such as WSL 2.

Build from the repository root with the release version, without the leading `v`:

```sh
docker build -f container/Dockerfile --build-arg COPILOT_VERSION=1.0.105 -t copilot-cli:local .
python3 container/smoke_test.py copilot-cli:local --version 1.0.105
```

The smoke test needs only Python 3 and Docker. It checks the container's configuration and a real client handshake with the running server. Add `--platform linux/arm64` or `--platform linux/amd64` to test a build for another architecture.
The smoke test checks the container's configuration, Git access to a bind-mounted repository owned by the host user, and a real client handshake with the running server. Add `--platform linux/arm64` or `--platform linux/amd64` to test a build for another architecture.

## Publishing

Expand Down
13 changes: 10 additions & 3 deletions container/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,21 @@ def check_runtime_environment(target):

def check_git_workspace(target):
with tempfile.TemporaryDirectory(prefix="copilot-git-safe-") as workspace:
# The runtime UID needs access, while the host must own the files for cleanup.
os.chmod(workspace, 0o755)
volume = "%s:/home/copilot/workspace" % workspace
initialized = run_to_completion(
target,
["--user", "0:0", "--volume", volume, "--entrypoint", "git"],
["init", "--quiet", "/home/copilot/workspace"],
[
"--user", "%d:%d" % (os.getuid(), os.getgid()),
"--volume", "%s:/tmp/workspace" % workspace,
"--workdir", "/tmp/workspace",
"--entrypoint", "git",
],
["init", "--quiet"],
)
if initialized.returncode != 0:
raise Failure("could not initialize a root-owned workspace repository: %s" % initialized.stderr.strip())
raise Failure("could not initialize a host-owned workspace repository: %s" % initialized.stderr.strip())

result = run_to_completion(
target,
Expand Down