Skip to content

Commit a2b02e3

Browse files
committed
Revert "TDD: add ComposeUp makeRunArgs helper and tests"\n\nThis reverts commit 8b1a7ad.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 376f381 commit a2b02e3

5 files changed

Lines changed: 7 additions & 205 deletions

File tree

FORK_CHANGES.md

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -57,84 +57,12 @@ Additional upstream PRs of interest (not exhaustive):
5757

5858
Notes and suggested next steps:
5959

60-
- Upstream apple/container v0.10.0 already includes many of the core engine changes referenced above (notably: ClientContainer rework [#1139], runtime flag for create/run [#1109], --init and --init-image support [#1244, #937], container export/commit [#1172], support for multiple network plugins [#1151], build --pull [#844], named-volume auto-create warning [#1108], memory validation [#1208], and related CLI/output changes such as a --format option for system status [#1237]).
61-
62-
- Items present in this fork but NOT included in apple/container v0.10.0 (should be tracked or upstreamed):
63-
- Remove RuntimeStatus type (commit: c509a2f)
64-
- Fix incorrect waiting when container is already running (commit: 8a4e5bb)
65-
- Remove unnecessary 30s timeout when container already started (commit: eeddb26)
66-
- dnsSearch / dns_search support for service name resolution (commit: d509f8a)
67-
- Multi-stage build target support (build.target) (commit: 02ca646)
68-
- Debug output showing the exact container CLI command being executed (commit: 4968a86)
69-
- Ensure --entrypoint is passed before image name in run (commit: 84201f9)
70-
- Named-volume full-destination-path preservation and regression test (commits: b1badf8, 8edb8a9)
71-
- Fork-specific CI/release workflow additions (commits: 3f20dbf, 98b7fc4, 1d284fb)
72-
73-
- Recommended actions:
74-
1. Update this FORK_CHANGES.md and add a short CHANGELOG.md that clearly separates what was upstreamed in apple/container@0.10.0 and what remains unique to this fork.
75-
2. Update README and CLI --help strings for fork-only features (dns_search, build.target, entrypoint behavior, named-volume handling) and add migration notes where appropriate.
76-
3. For each fork-only item, decide whether to upstream as a PR against apple/container or keep it as a fork patch; open PRs for items that are broadly useful (dns_search, build.target, entrypoint fix, named-volume behavior).
60+
- Convert each bullet above into a CHANGELOG section with short user-facing notes and example usage (e.g., how to use the new build target, how to set dns_search).
61+
- Update CLI --help and README to document new/changed flags and behaviors (dnsSearch/dns_search, build.target, named-volume behavior, entrypoint handling).
62+
- Where possible, link to the full upstream PR discussions for context (links provided above for the main PRs found).
7763

7864
TODOs:
79-
- Create a detailed CHANGELOG.md entry describing user-facing changes and migration notes, split into "Upstream in container@0.10.0" and "Fork-only changes".
80-
- Update README and CLI --help strings to reflect fork capabilities and any CLI differences.
81-
- Audit tests that depend on fork-only behavior and mark or adapt them for upstream compatibility.
65+
- Create a detailed CHANGELOG.md entry describing user-facing changes and migration notes.
66+
- Update README and CLI --help strings to reflect fork capabilities.
8267

83-
(Generated by repository inspection against apple/container v0.10.0.)
84-
85-
---
86-
87-
Proposed features to target for the next Apple Containers release
88-
89-
Based on the active development in the apple/container main branch (post-0.9.0), several high-impact features are landing that the Container-Compose fork is uniquely positioned to capitalize on. To stay ahead of the next release, focus development and testing on the following areas.
90-
91-
### 1. Robust Service Lifecycle (Restart Policies)
92-
93-
The Change: PR #1258 adds a native `--restart` policy to the `container run` command.
94-
95-
- Compose Feature to Add: Implement the `restart: always`, `restart: on-failure`, and `restart: unless-stopped` keys in docker-compose.yaml so the fork maps those keys to the new engine `--restart` flag.
96-
- Testing Priority: Test "zombie" container cleanup. Since the engine is adding native restart support, ensure that `container-compose down` correctly stops and removes containers that the engine might be trying to restart automatically.
97-
98-
### 2. High-Performance Host-Container File Transfer
99-
100-
The Change: PR #1190 introduces a native `container cp` command.
101-
102-
- Compose Feature to Add: Use this to implement a "Sync" or "Hot Reload" feature that programmatically moves files into a running service container as an alternative to bind mounts for improved performance.
103-
- Testing Priority: Verify large file transfers and directory structures. This is a significant improvement over the current "mount-only" storage strategy in 0.9.0.
104-
105-
### 3. Native "Init" Process Management
106-
107-
The Change: PR #1244 adds an `--init` flag to `run/create`.
108-
109-
- Compose Feature to Add: Add an `init: true` boolean to the service definition that maps to the engine `--init` flag when starting containers.
110-
- Testing Priority: Test applications that spawn many child processes (Node.js, Python with workers). Using the native `--init` flag will prevent orphan processes from remaining in the micro-VM after the service stops.
111-
112-
### 4. Advanced Networking & Multi-Plugin Support
113-
114-
The Change: PR #1151 and #1227 enable multiple network plugins and loading configurations from files.
115-
116-
- Compose Feature to Add: Support complex `networks:` definitions in Compose to allow combinations of bridge, host-only, and routed networks for services within the same stack.
117-
- Testing Priority: IPv6 connectivity. PR #1174 adds IPv6 gateway support — validate IPv6 addressing, routing, and DNS resolution across custom networks.
118-
119-
### 5. "Snapshot-based" Deployments
120-
121-
The Change: PR #1172 adds `container commit` (exporting a container to an image).
122-
123-
- Compose Feature to Add: Implement a `container-compose checkpoint <service>` command that commits a running container to a local image for future `up` commands or for fast rollbacks.
124-
- Testing Priority: Validate database checkpoints and restore flows; ensure image metadata and layers are handled consistently across commits.
125-
126-
### Suggested Testing Matrix for the Fork
127-
128-
| Feature | Target PR | Test Case |
129-
| --- | --- | --- |
130-
| **Persistence** | #1108 / #1190 | Verify that named volumes aren't "lost" and `cp` works across them. |
131-
| **Security** | #1152 / #1166 | Ensure Compose-generated containers respect the new SELinux-off-by-default boot. |
132-
| **Reliability** | #1208 | Launch a Compose stack with `mem_limit: 128mb` and verify the CLI surfaces validation errors correctly. |
133-
134-
### Strategic Recommendation
135-
136-
The most valuable addition would be **Auto-Start support**. With Apple adding `LaunchAgent` support (#1176) and a `--system-start` flag (#1201), the fork could introduce a `container-compose install-service` command that generates macOS LaunchAgents to auto-start stacks on boot.
137-
138-
---
139-
140-
Would you like help drafting the Swift logic to map `restart: always` and related Compose keys to the engine `--restart` flag? (Can produce a focused patch for Sources/Container-Compose/Commands/ComposeUp.swift.)
68+
(Generated by repo inspection and upstream PR search.)

Sources/Container-Compose/Codable Structs/Service.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ public struct Service: Codable, Hashable {
8686
/// Platform architecture for the service
8787
public let platform: String?
8888

89-
/// Native init flag to request an init process (maps to container --init)
90-
public let `init`: Bool?
91-
9289
/// Service-specific config usage (primarily for Swarm)
9390
public let configs: [ServiceConfig]?
9491

@@ -110,7 +107,7 @@ public struct Service: Codable, Hashable {
110107
// Defines custom coding keys to map YAML keys to Swift properties
111108
enum CodingKeys: String, CodingKey {
112109
case image, build, deploy, restart, healthcheck, volumes, environment, env_file, ports, command, depends_on, user,
113-
container_name, networks, hostname, entrypoint, privileged, read_only, working_dir, configs, secrets, stdin_open, tty, platform, `init`, dns_search
110+
container_name, networks, hostname, entrypoint, privileged, read_only, working_dir, configs, secrets, stdin_open, tty, platform, dns_search
114111
}
115112

116113
/// Public memberwise initializer for testing
@@ -226,9 +223,6 @@ public struct Service: Codable, Hashable {
226223
stdin_open = try container.decodeIfPresent(Bool.self, forKey: .stdin_open)
227224
tty = try container.decodeIfPresent(Bool.self, forKey: .tty)
228225
platform = try container.decodeIfPresent(String.self, forKey: .platform)
229-
// Decode optional init flag (YAML key: init)
230-
`init` = try container.decodeIfPresent(Bool.self, forKey: .`init`)
231-
232226
dns_search = try container.decodeIfPresent(String.self, forKey: .dns_search)
233227
}
234228

Sources/Container-Compose/Commands/ComposeUp.swift

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -745,60 +745,6 @@ public struct ComposeUp: AsyncParsableCommand, @unchecked Sendable {
745745
}
746746

747747
// MARK: CommandLine Functions
748-
749-
/// Helper for building the `container run` argument list for a service. Used by tests.
750-
public static func makeRunArgs(service: Service, serviceName: String, dockerCompose: DockerCompose, projectName: String, detach: Bool, cwd: String, environmentVariables: [String: String]) throws -> [String] {
751-
var runArgs: [String] = []
752-
753-
// Add detach flag if specified
754-
if detach {
755-
runArgs.append("-d")
756-
}
757-
758-
// Determine container name
759-
let containerName: String
760-
if let explicit = service.container_name {
761-
containerName = explicit
762-
} else {
763-
containerName = "\(projectName)-\(serviceName)"
764-
}
765-
runArgs.append("--name")
766-
runArgs.append(containerName)
767-
768-
// Map restart policy if present
769-
if let restart = service.restart {
770-
runArgs.append("--restart")
771-
runArgs.append(restart)
772-
}
773-
774-
// Map init flag if present (support both explicit Bool and optional presence)
775-
// Note: Service may not include an `init` field; this helper will check for a computed property on Service via KeyedDecoding.
776-
if let mirrorInit = Mirror(reflecting: service).children.first(where: { $0.label == "init" }), let value = mirrorInit.value as? Bool, value {
777-
runArgs.append("--init")
778-
}
779-
780-
// Ensure entrypoint flag is placed before the image name when provided
781-
let imageToRun = service.image ?? "\(serviceName):latest"
782-
if let entrypointParts = service.entrypoint, let entrypointCmd = entrypointParts.first {
783-
runArgs.append("--entrypoint")
784-
runArgs.append(entrypointCmd)
785-
// image follows flags
786-
runArgs.append(imageToRun)
787-
// append any remaining entrypoint args or command after image
788-
if entrypointParts.count > 1 {
789-
runArgs.append(contentsOf: entrypointParts.dropFirst())
790-
} else if let commandParts = service.command {
791-
runArgs.append(contentsOf: commandParts)
792-
}
793-
} else {
794-
runArgs.append(imageToRun)
795-
if let commandParts = service.command {
796-
runArgs.append(contentsOf: commandParts)
797-
}
798-
}
799-
800-
return runArgs
801-
}
802748
extension ComposeUp {
803749

804750
/// Runs a command, streams stdout and stderr via closures, and completes when the process exits.

Tests/Container-Compose-StaticTests/ComposeUpMappingTests.swift

Lines changed: 0 additions & 56 deletions
This file was deleted.

docs/FORK_README_UPDATE.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)