Commit Graph

219 Commits

Author SHA1 Message Date
Sidhartha Mani 3c71bdc98d [Build] update builder shim to 0.3.0 (#288) 2025-07-01 16:39:56 -07:00
Aditya Ramani 5dd8f0f1c1 Cleanups for CI (#287)
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
2025-07-01 16:08:33 -07:00
Sidhartha Mani 6d804620a5 [Build] Disable rosetta during builds with a UserDefault (#273)
Fixes https://github.com/apple/container/issues/103
2025-07-01 14:52:41 -07:00
J Logan 75e92853e3 Assigns default nameserver in sandbox service. (#276)
* Closes #148.
* Storing the default nameserver in the bundle config means that DNS
won't work if the container stops and then restarts later when the
subnet address has changed.
2025-07-01 10:03:23 -07:00
Eliseo Martelli 48db62376d Use enum for ClientHealthCheck namespace (#225)
Switch `ClientHealthCheck` from a `struct` to an `enum` to prevent
instantiation.
2025-07-01 12:55:49 -04:00
Aditya Ramani 4bfa6c29ec Add unpack strategy to SnapshotStore (#274)
Define a `UnpackStrategy` function type in the `SnapshotStore` to give
more control over how an image is unpacked.

Previously, we were creating a 512 GB sparse block file for the initial
file system of a container, which is overkill.

With this change, the vminit image is unpacked to a smaller block file,
while container images are unpacked to the 512 GB block

Follows the same pattern as
https://github.com/apple/container/blob/main/Sources/Helpers/RuntimeLinux/RuntimeLinuxHelper.swift#L71

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
2025-07-01 11:22:22 -04:00
Aditya Ramani 9a14630623 Docs for shell completion (#275)
Closes https://github.com/apple/container/issues/93

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
2025-07-01 11:12:21 -04:00
J Logan 5450c9bc50 Adds next step link for building the project. (#278)
* Closes #277.
2025-06-30 20:41:21 -07:00
Dmitry Kovba 9eb2f860fc Use a consistent capitalization in a bug report template (#269) 2025-06-27 15:51:31 -07:00
J Logan 3b5c253059 Adds container network for macOS 26. (#243)
See discussion below for example. For multiple network interfaces in a
single container we'll want to integrate against a containerization that
includes apple/containerization#156.

The change bumps the containerization dependency to 0.2.0 and addresses
the breaking API changes.

```console
% container network
OVERVIEW: Manage container networks

USAGE: container network <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  create                  Create a new network
  delete, rm              Delete one or more networks
  list, ls                List networks
  inspect                 Display information about one or more networks

  See 'container help network <subcommand>' for detailed help.
```
0.2.0
2025-06-27 14:12:29 -07:00
Kathryn Baldauf 3fcd0dda67 Add version info to package installer (#249)
Fixes https://github.com/apple/container/issues/203

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-27 13:50:37 -07:00
Kathryn Baldauf 00aa883a83 Remove use of triage label (#262)
Tags on the repo should be a way to classify an item instead of denoting
workflow or status of the item. Remove the addition of the triage label
on bug and feature issues.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-27 14:07:53 -04:00
Eliseo Martelli b5589f7f8c Improve error handling in answerHost (#226)
Refactor `answerHost` to throw descriptive `DNSResolverError` instances
instead of returning nil when IP allocation or parsing fails.
2025-06-27 10:29:25 -07:00
Dmitry Kovba de2be705de Remove the support for CURRENT_SDK (#251)
This PR removes the no longer needed support for `CURRENT_SDK`.
2025-06-26 10:40:34 -04:00
Kathryn Baldauf e693139ab9 Move github issues to use feature and bug Types instead of Labels (#258)
Github now has a "Type" feature for issues. Types are set at the
organization level and can be used for consistent classification of
issues across an organization. We'd like to switch to using these to
classify if an issue is a bug or feature instead of labels. Labels will
be used for more granular classification within a repo.

See [github
docs](https://docs.github.com/en/issues/tracking-your-work-with-issues/configuring-issues/managing-issue-types-in-an-organization)
for more information about GitHub Issue Types.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-25 16:40:21 -07:00
Sidhartha Mani c7c88c2e34 [Build] Do not use unbounded DispatchIO readers for tar tranfers (#257)
- Addresses https://github.com/apple/container/issues/166
- Memory utilization explodes since there is no mechanism for
backpressure
- Using a synchronous buffered reader seem to provide similar
performance without the memory explosion issue
- 4MB buffer seems to provide the best results

| Metric | 1MB Buffer | 4MB Buffer | Unbounded Zero-Copy |

|--------------------------|------------|------------|---------------------|
| Build Time | 149.33s | 138.57s | 139.79s |
| Max RAM Used | 2.16 GB | 3.02 GB | 3.52 GB |
| Peak Memory Footprint | 8.30 GB | 8.17 GB | 10.21 GB |
| Page Reclaims | 1,085,559 | 1,039,677 | 1,619,943 |
| Page Faults | 115 | 148 | 143 |
| CPU Usage (User+Sys) | 53.71s | 53.12s | 60.44s |
2025-06-25 13:51:51 -07:00
Kathryn Baldauf 4a6a1f15d8 Add test that we replace meta args in builder correctly (#255)
Depends on https://github.com/apple/container-builder-shim/pull/24 

Related to https://github.com/apple/container/issues/252

---------

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-24 13:25:58 -07:00
Dmitry Kovba 5d36134b96 Regenerate documentation on make docs (#246)
This PR allows using `make docs` without manually removing the existing
`_site` folder.
2025-06-24 12:46:50 -07:00
Dmitry Kovba aa71809da6 Remove @unchecked Sendable (#250)
This PR removes `@unchecked Sendable` from the tests.
2025-06-24 10:45:21 -07:00
John Spurlock 90083956c2 Fix typo in technical-overview.md (#253) 2025-06-24 10:08:16 -07:00
Dmitry Kovba 65e173333b Redirect to the documentation from the homepage (#245)
This PR fixes the homepage at https://apple.github.io/container/
2025-06-23 10:19:44 -07:00
Joseph Heck 8e892be2b0 limit build and test for runners to Apple repository (#228)
constrains build to run on apple/container

fixes #209
2025-06-20 15:28:17 -07:00
Renee Chang a69ed78484 Add socket publishing functionality (#236)
Signed-off-by: renee chang <rchang25@apple.com>
2025-06-20 09:00:47 -07:00
Spencer Heywood a262d8fc6a provide suggestion if xpc 'Connection invalid' error encountered (#179)
Closes https://github.com/apple/container/issues/80

Adds the following help message if you try to run `container` against a
host that hasn't started the container system:

```
❯ /usr/local/bin/container list
Error: internalError: "failed to list containers" (cause: "interrupted: "Connection invalid: ensure container system has been started with `container system start`"")

❯ /usr/local/bin/container run -it --rm docker.io/alpine
Error: interrupted: "Connection invalid: ensure container system has been started with `container system start`"
```
2025-06-19 00:12:57 -07:00
Ramsyana 21cfebb475 Fix Race Condition in Container Removal (#130) (#218)
This PR resolves a race condition when removing a container immediately
after stopping it, caused by the `stop` command returning before the
container fully transitions to the stopped state (#130).

**Changes:**
- Enhanced `TestCLIRmRace.swift` with robust test logic and helper
methods (`containerExists`, `safeRemove`).
- Improved error handling to distinguish race conditions from successful
removals.
- Added exponential backoff retry logic for cleanup operations.
- Updated `CLITest.swift` with missing `doRemove` method.
- Fixed `BuilderStart.swift` to handle `.stopping` case.
- Improved error messages with container ID for better debugging.

**Testing:**
-  All tests pass (`make test`, `make integration`).
-  Verified on macOS 26.
-  Race condition test validates success and failure scenarios.
-  Code formatted (`make fmt`).

Hopefully, this will pass the integration tests on GitHub.

Signed-off-by: ramsyana <47033578+ramsyana@users.noreply.github.com>
2025-06-16 23:19:46 -07:00
Danny Canter 37c9732c4c makefile: Change build_bin_dir to be lazily evaluated (#221)
The bin directory for placing built binaries to should be lazily
evaluated, as we change BUILD_CONFIGURATION during `make release`.
2025-06-16 23:11:58 -07:00
Dmitry Kovba 0535d36929 Fix warnings in make docs (#220) 2025-06-16 17:55:48 -07:00
Aditya Ramani 4c171d4641 Wait for IO streams to complete before a process exits (#198)
Implements a way for the CLI to wait until the IO streams from the
SandboxService have been drained before closing them.

Follows the same pattern as
https://github.com/apple/containerization/pull/110

This change also performs some cleanup in the
`SandboxService.startProcess` method - splitting the code paths to
handle the init process and an exec'd process into two different private
methods to make easier reading

---------

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
2025-06-16 13:41:56 -07:00
Kathryn Baldauf 157bacf6a4 Make test suites run sequentially with respect to other test suites (#200)
Right now swift testing does not have finer grain test parallelization
controls. As a result our easy options are either to have ALL tests in
ALL test suites run sequentially or have tests within a given test suite
run sequentially while other test suites are run at the same time.

This has been problematic for our CI since we opted for the second
option above, where, for examples, the tests in the builder test suite
run sequentially, but the builder test suite runs at the same time as
the container run test suite. When this happens, a lot of different
tests try to pull the necessary images for testing at the same time,
causing some tests to timeout.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-16 12:38:55 -07:00
Dmitry Kovba 009ce93b4a Require having a Mac with Apple silicon and Xcode 26 beta (#125)
This PR requires installing Xcode 26 beta until we resolve
https://github.com/apple/containerization/issues/66.
2025-06-16 12:35:14 -07:00
Michael Crosby 011e6764f7 use rotatingAllocator for ipam (#217)
Signed-off-by: crosbymichael <michael_crosby@apple.com>
2025-06-16 11:03:57 -07:00
Josh Soref 4a4ad40d74 Spelling (#207)
This PR corrects misspellings identified by the [check-spelling
action](https://github.com/marketplace/actions/check-spelling)

The misspellings have been reported at
https://github.com/jsoref/container/actions/runs/15662939575/attempts/1
The action reports that the changes in this PR would make it happy:
https://github.com/jsoref/container/actions/runs/15662939742/attempts/1#summary-44123289718

---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-06-16 10:49:03 -07:00
Danny Canter 4d6f7037f3 Plugins: Remove unused devnull var (#214)
We actually use the output (both stderr and stdout) of the command.
2025-06-16 08:11:25 -07:00
Dmitry Kovba 555dbfc9fa Adds a warning when running a debug build (#201)
This PR adds a warning that the performance may be degraded when running
a debug build.

Debug build:
```
% bin/container run -it --rm alpine:latest date
Warning! Running debug build. Performance may be degraded.
Fri Jun 13 18:10:35 PDT 2025
```

Release build:
```
% bin/container run -it --rm alpine:latest date
Fri Jun 13 18:10:35 PDT 2025
```
2025-06-13 19:48:59 -07:00
Dmitry Kovba 51c1b879d2 Update to Swift 6.2 (#195)
This PR updates to Swift 6.2 and resolves a build error after updating
to Swift 6.2-snapshot in
https://github.com/apple/containerization/pull/94.
2025-06-13 17:27:50 -07:00
Eliseo Martelli 84798601cd Throw errors in ServiceManager (#188) 2025-06-13 17:07:55 -07:00
Dmitry Kovba 05798f38a1 Update the names of Xcode and macOS (#123)
This PR updates the names of Xcode and macOS to the official names used
in https://developer.apple.com/download/applications/.
2025-06-13 16:58:28 -07:00
Noritaka Kobayashi 098021fc5b refactor: fix typos (#77)
fix typos
2025-06-13 16:42:07 -07:00
Kathryn Baldauf a84389e517 Remove editor specific git ignore rules (#197)
These should be up to users to maintain, as trying to add everyones
editor of choice config directories here isn't ideal.

Matches https://github.com/apple/containerization/pull/106

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-13 14:47:16 -07:00
Satyam Singh 24730167da fix(common.yml): globalize CURRENT_SDK, improve shell safety and imp… (#178)
## 🔧 Improvements Summary

This PR introduces three improvements focused on safety,
maintainability, and readability of the GitHub Actions workflow.

---

### 1. Define Global Environment Variable

**Before:**

Environment variable `CURRENT_SDK` was defined repeatedly in multiple
steps.

**After:**

 Declared in gloabally one time. 

#### Why This Matters:

-  Eliminates duplication across steps.
-  Makes it easier to update or remove the variable in the future.
-  Still allows per-step override when necessary.

### 2. Fix Unsafe Shell Conditional on inputs.release
- Using **[[ ... ]]** **instea**d of **[ ... ]** for conditionals.
- Adding **double quotes** around inputs and refs to **avoid**
evaluation issues.
**PREVIOUSLY FIXED** Containerization project.
[https://github.com/apple/containerization/pull/68](url)
  
 ### 3.  Removed EXCLUSION AND TODO comment.
  #### Affected Steps:

 `check Formatting`

`make proto`

### Improvements:

Now that the repositories are public, we no longer need to exclude files
like Package.swift and Package.resolved from formatting and proto
checks.

- Removed EXCLUDES logic
- Removed related TODO comments
- Updated git diff checks to include all files

@wlan0 @katiewasnothere
2025-06-13 13:47:24 -07:00
Aditya Ramani c5392e838f Remove the system restart command (#196)
Closes https://github.com/apple/container/issues/175

Also does some housekeeping - update availability checks and fix a typo

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
2025-06-13 13:45:25 -07:00
Danny Canter e6b7a29e9d README: Add project status (#192)
Just as Containerization does, we should advertise the status of the
project and source/tool stability guarantees for version numbers.
2025-06-13 12:03:59 -07:00
Patrick Stöckle 84edaa20db Fix typos (#122)
Hi there,

some small typos I fixed using
[`typos`](https://github.com/crate-ci/typos).

Cheers,
Patrick
2025-06-13 11:07:07 -07:00
Satyam Singh 2364f33cc6 Fix release workflow: tag regex, artifact validation, and token usage (#187)
## 🔧 Summary
This PR improves the release.yml GitHub Actions workflow by addressing
several critical issues to ensure consistent and reliable behavior
during tag-based releases.

##  Changes Included
### 1. Fixed tag trigger regex
- Escaped dots in the tag regex ([0-9]+\\.[0-9]+\\.[0-9]+) to ensure
only semantic version tags like 1.2.3 trigger the workflow.
#####  Explanation
- Old **Regex** is incorrect because . matches **any character**, so it
matched:

`1-2-3`, `1_2_3`, even `1a2b3`, which is invalid for versioning.

 - Fixed **Regex** is strict — matches only 1.2.3.
 #### Find attached tested SCREEN SHOT BELOW .
**Bad Match with Old Regex:**

![proofwithBadMatch](https://github.com/user-attachments/assets/6dbec50d-6ffb-4338-a258-7b3629b08e24)


**Proper Match with Fixed Regex:**

![withfixedbadstring](https://github.com/user-attachments/assets/1c9b6315-074b-4db4-a911-6493a76b4b64)
---
### 💬 Note: If you're planning to adopt alternate version tag formats in
the future — such as:

 - v1.0.2 (semantic with prefix)

- release-1.0.2 or rel-1.0.2

- 1.0.2-beta, 1.0.2-rc.1 (prereleases with suffixes)

 - x1.0.2x (custom wrapping formats)

**…feel free to reach out. I'm happy to help extend the workflow to
support those formats reliably and safely.**
---
### 2. Added strict release job guard
- Prevented **accidental release runs** on non-tag events using if:
startsWith(github.ref, 'refs/tags/').

### 3. Explicit artifact validation
- **Introduced a shell check** using ls and test to ensure .zip and .pkg
files exist before attempting release. This gives early, clear failure
instead of a **vague error** from `action-gh-release`.

### 4. Clarified GitHub token usage
- Switched from ${{ secrets.GITHUB_TOKEN }} to ${{ github.token }} for
better readability and consistency with GitHub Actions best practices.

@katiewasnothere @wlan0
2025-06-13 10:43:59 -07:00
Kathryn Baldauf 878ebbda2e Add default year for hawkeye formatting (#180)
This adds a default year to use when a file does not yet have git
attributes (aka for a newly created file).

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-13 09:50:05 -07:00
Dmitry Kovba c0433bec15 Update issue templates (#184)
Please see commits for the list of changes.
2025-06-13 09:11:32 -07:00
Alexey Makhov 2a12f01d32 container registry login host:port error fix (#170)
Fixes #121

Gets port from the given registry server URL and use it in a
RegistryClient.

Signed-off-by: Alexey Makhov <makhov.alex@gmail.com>
2025-06-13 07:33:05 -07:00
Dmitry Kovba 206f3cc07c Improve accuracy of progress updates (#144)
This PR resolves the problem of dropped progress updates and ensures the
accuracy of the information provided in the progress bar. Additionally,
it adds the displaying of the finished state to the progress bar.
Requires merging and tagging
https://github.com/apple/containerization/pull/91.
2025-06-12 23:36:38 -07:00
Yibo Zhuang 8f2d4d7300 Fix: consolidate UserDefaults service name (#161)
This change consolidates the UserDefaults service name
`com.apple.container.defaults` to a single constant under the extension
file and also renamed the extension file.

Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
2025-06-12 21:28:24 -07:00
J Logan 9d75932017 Adds Swift Package Index crawler metadata. (#181) 2025-06-12 17:29:07 -07:00