Skip to content

Commit dcf33be

Browse files
authored
Merge branch 'main' into main
2 parents cb60c44 + 8adb215 commit dcf33be

File tree

188 files changed

+32603
-649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+32603
-649
lines changed

.github/ISSUE_TEMPLATE/01-bug.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Bug report
22
description: File a bug report.
33
title: "[Bug]: "
4-
labels: ["bug", "triage"]
4+
type: "Bug"
55
body:
66
- type: markdown
77
attributes:
@@ -34,7 +34,7 @@ body:
3434
- type: textarea
3535
id: expected
3636
attributes:
37-
label: Expected Behavior
37+
label: Expected behavior
3838
description: A concise description of what you expected to happen.
3939
validations:
4040
required: true

.github/ISSUE_TEMPLATE/02-feature.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Feature or enhancement request
22
description: File a request for a feature or enhancement
33
title: "[Request]: "
4-
labels: ["feature", "triage"]
4+
type: "Feature"
55
body:
66
- type: markdown
77
attributes:

.github/workflows/common.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ on:
1111
jobs:
1212
buildAndTest:
1313
name: Build and test the project
14+
if: github.repository == 'apple/container'
1415
timeout-minutes: 60
1516
runs-on: [self-hosted, macos, sequoia, ARM64]
1617
permissions:
1718
contents: read
1819
packages: read
19-
env:
20-
CURRENT_SDK: y
2120
steps:
2221
- name: Checkout repository
2322
uses: actions/checkout@v4
@@ -44,7 +43,7 @@ jobs:
4443
false
4544
fi
4645
env:
47-
DEVELOPER_DIR: "/Applications/Xcode_26.b1.app/Contents/Developer"
46+
DEVELOPER_DIR: "/Applications/Xcode-latest.app/Contents/Developer"
4847

4948
- name: Set build configuration
5049
run: |
@@ -58,7 +57,7 @@ jobs:
5857
make container dsym docs
5958
tar cfz _site.tgz _site
6059
env:
61-
DEVELOPER_DIR: "/Applications/Xcode_26.b1.app/Contents/Developer"
60+
DEVELOPER_DIR: "/Applications/Xcode-latest.app/Contents/Developer"
6261

6362
- name: Create package
6463
run: |
@@ -71,8 +70,7 @@ jobs:
7170
launchctl setenv HTTP_PROXY $HTTP_PROXY
7271
make test cleancontent install-kernel integration
7372
env:
74-
DEVELOPER_DIR: "/Applications/Xcode_26.b1.app/Contents/Developer"
75-
CURRENT_SDK: y # explicitly repeated due to local env block
73+
DEVELOPER_DIR: "/Applications/Xcode-latest.app/Contents/Developer"
7674

7775
- name: Save documentation artifact
7876
uses: actions/upload-artifact@v4

.spi.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
version: 1
22
builder:
33
configs:
4-
- documentation_targets:
5-
- ContainerSandboxService
6-
- ContainerNetworkService
7-
- ContainerImagesService
8-
- ContainerClient
9-
- ContainerLog
10-
- ContainerPlugin
11-
- ContainerXPC
12-
- TerminalProgress
4+
-
5+
documentation_targets:
6+
- ContainerSandboxService
7+
- ContainerNetworkService
8+
- ContainerImagesService
9+
- ContainerClient
10+
- ContainerLog
11+
- ContainerPlugin
12+
- ContainerXPC
13+
- TerminalProgress
14+
swift_version: '6.2'

BUILDING.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ To build the `container` project, you need:
66
- macOS 15 minimum, macOS 26 beta recommended
77
- Xcode 26 beta, set as the [active developer directory](https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-HOW_DO_I_SELECT_THE_DEFAULT_VERSION_OF_XCODE_TO_USE_FOR_MY_COMMAND_LINE_TOOLS_)
88

9+
> [!IMPORTANT]
10+
> There is a bug in the `vmnet` framework on macOS 26 beta that causes network creation to fail if the `container` helper applications are located under your `Documents` or `Desktop` directories. If you use `make install`, you can simply run the `container` binary in `/usr/local`. If you prefer to use the binaries that `make all` creates in your project `bin` and `libexec` directories, locate your project elsewhere, such as `~/projects/container`, until this issue is resolved.
11+
912
## Compile and test
1013

1114
Build `container` and the background services from source, and run basic and integration tests:
@@ -20,6 +23,13 @@ Copy the binaries to `/usr/local/bin` and `/usr/local/libexec` (requires enterin
2023
make install
2124
```
2225

26+
Or to install a release build, with better performance than the debug build:
27+
28+
```bash
29+
BUILD_CONFIGURATION=release make all test integration
30+
BUILD_CONFIGURATION=release make install
31+
```
32+
2333
## Compile protobufs
2434

2535
`container` uses gRPC to communicate to the builder virtual machine that creates images from `Dockerfile`s, and depends on specific versions of `grpc-swift` and `swift-protobuf`. If you make changes to the gRPC APIs in the [container-builder-shim](https://github.com/apple/container-builder-shim) project, install the tools and re-generate the gRPC code in this project using:
@@ -38,58 +48,60 @@ to prepare your build environment.
3848

3949
2. In your development shell, go to the `container` project directory.
4050

41-
```
51+
```bash
4252
cd container
4353
```
4454

4555
3. If the `container` services are already running, stop them.
4656

47-
```
57+
```bash
4858
bin/container system stop
4959
```
5060

51-
4. Configure the environment variable `CONTAINERIZATION_PATH` to refer to your Containerization project, and update your `Package.resolved` file.
52-
53-
```
54-
export CONTAINERIZATION_PATH=../containerization
55-
swift package update containerization
56-
```
57-
58-
5. Build the init filesystem for your local copy of the Containerization project.
61+
4. Use the Swift package manager to configure use your local `containerization` package and update your `Package.resolved` file.
5962

60-
```
61-
(cd ${CONTAINERIZATION_PATH} && make clean all)
63+
```bash
64+
/usr/bin/swift package edit --path ../containerization containerization
65+
/usr/bin/swift package update containerization
6266
```
6367

64-
6. Build `container`.
68+
> [!IMPORTANT]
69+
> If you are using Xcode, you will need to temporarily modify `Package.swift` instead of using `swift package edit`, using a path dependency in place of the versioned `container` dependency:
70+
>
71+
> ```swift
72+
> .package(path: "../containerization"),
73+
> ```
74+
5. Build `container`.
6575

6676
```
6777
make clean all
6878
```
6979

70-
7. Start the `container` services.
80+
6. Restart the `container` services.
7181

7282
```
83+
bin/container system stop
7384
bin/container system start
7485
```
7586

7687
To revert to using the Containerization dependency from your `Package.swift`:
7788

78-
1. Unset your `CONTAINERIZATION_PATH` environment variable, and update `Package.resolved`.
89+
1. Use the Swift package manager to restore the normal `containerization` dependency and update your `Package.resolved` file. If you are using Xcode, revert your `Package.swift` change instead of using `swift package unedit`.
7990

80-
```
81-
unset CONTAINERIZATION_PATH
82-
swift package update containerization
91+
```bash
92+
/usr/bin/swift package unedit containerization
93+
/usr/bin/swift package update containerization
8394
```
8495

8596
2. Rebuild `container`.
8697

87-
```
98+
```bash
8899
make clean all
89100
```
90101

91102
3. Restart the `container` services.
92103

93-
```
94-
bin/container system restart
104+
```bash
105+
bin/container system stop
106+
bin/container system start
95107
```

Makefile

Lines changed: 56 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ DSYM_DIR := bin/$(BUILD_CONFIGURATION)/bundle/container-dSYM
2828
DSYM_PATH := bin/$(BUILD_CONFIGURATION)/bundle/container-dSYM.zip
2929
CODESIGN_OPTS ?= --force --sign - --timestamp=none
3030

31-
ifeq (,$(CURRENT_SDK))
32-
CURRENT_SDK_ARGS :=
33-
else
34-
CURRENT_SDK_ARGS := -Xswiftc -DCURRENT_SDK
35-
endif
36-
3731
MACOS_VERSION := $(shell sw_vers -productVersion)
3832
MACOS_MAJOR := $(shell echo $(MACOS_VERSION) | cut -d. -f1)
3933

@@ -49,13 +43,12 @@ all: init-block
4943
.PHONY: build
5044
build:
5145
@echo Building container binaries...
52-
@#Remove this when the updated macOS SDK is available publicly
53-
$(SWIFT) build -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) ; \
46+
@$(SWIFT) build -c $(BUILD_CONFIGURATION)
5447

5548
.PHONY: container
56-
container: build
57-
@# Install binaries under project directory
58-
@"$(MAKE)" BUILD_CONFIGURATION=$(BUILD_CONFIGURATION) DESTDIR=$(ROOT_DIR)/ SUDO= install
49+
# Install binaries under project directory
50+
container: build
51+
@"$(MAKE)" BUILD_CONFIGURATION=$(BUILD_CONFIGURATION) DESTDIR="$(ROOT_DIR)/" SUDO= install
5952

6053
.PHONY: release
6154
release: BUILD_CONFIGURATION = release
@@ -67,93 +60,94 @@ init-block:
6760

6861
.PHONY: install
6962
install: installer-pkg
70-
@echo Installing container installer package
63+
@echo Installing container installer package
7164
@if [ -z "$(SUDO)" ] ; then \
7265
temp_dir=$$(mktemp -d) ; \
7366
xar -xf $(PKG_PATH) -C $${temp_dir} ; \
74-
(cd $${temp_dir} && tar -xf Payload -C $(DESTDIR)) ; \
67+
(cd $${temp_dir} && tar -xf Payload -C "$(DESTDIR)") ; \
7568
rm -rf $${temp_dir} ; \
7669
else \
7770
$(SUDO) installer -pkg $(PKG_PATH) -target / ; \
78-
fi
79-
80-
$(STAGING_DIR):
81-
@echo Installing container binaries from $(BUILD_BIN_DIR) into $(STAGING_DIR)...
82-
@rm -rf $(STAGING_DIR)
83-
@mkdir -p $(join $(STAGING_DIR), bin)
84-
@mkdir -p $(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/bin)
85-
@mkdir -p $(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/bin)
86-
@mkdir -p $(join $(STAGING_DIR), libexec/container/plugins/container-core-images/bin)
87-
88-
@install $(BUILD_BIN_DIR)/container $(join $(STAGING_DIR), bin/container)
89-
@install $(BUILD_BIN_DIR)/container-apiserver $(join $(STAGING_DIR), bin/container-apiserver)
90-
@install $(BUILD_BIN_DIR)/container-runtime-linux $(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/bin/container-runtime-linux)
91-
@install config/container-runtime-linux-config.json $(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/config.json)
92-
@install $(BUILD_BIN_DIR)/container-network-vmnet $(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/bin/container-network-vmnet)
93-
@install config/container-network-vmnet-config.json $(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/config.json)
94-
@install $(BUILD_BIN_DIR)/container-core-images $(join $(STAGING_DIR), libexec/container/plugins/container-core-images/bin/container-core-images)
95-
@install config/container-core-images-config.json $(join $(STAGING_DIR), libexec/container/plugins/container-core-images/config.json)
71+
fi
72+
73+
$(STAGING_DIR):
74+
@echo Installing container binaries from "$(BUILD_BIN_DIR)" into "$(STAGING_DIR)"...
75+
@rm -rf "$(STAGING_DIR)"
76+
@mkdir -p "$(join $(STAGING_DIR), bin)"
77+
@mkdir -p "$(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/bin)"
78+
@mkdir -p "$(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/bin)"
79+
@mkdir -p "$(join $(STAGING_DIR), libexec/container/plugins/container-core-images/bin)"
80+
81+
@install "$(BUILD_BIN_DIR)/container" "$(join $(STAGING_DIR), bin/container)"
82+
@install "$(BUILD_BIN_DIR)/container-apiserver" "$(join $(STAGING_DIR), bin/container-apiserver)"
83+
@install "$(BUILD_BIN_DIR)/container-runtime-linux" "$(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/bin/container-runtime-linux)"
84+
@install config/container-runtime-linux-config.json "$(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/config.json)"
85+
@install "$(BUILD_BIN_DIR)/container-network-vmnet" "$(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/bin/container-network-vmnet)"
86+
@install config/container-network-vmnet-config.json "$(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/config.json)"
87+
@install "$(BUILD_BIN_DIR)/container-core-images" "$(join $(STAGING_DIR), libexec/container/plugins/container-core-images/bin/container-core-images)"
88+
@install config/container-core-images-config.json "$(join $(STAGING_DIR), libexec/container/plugins/container-core-images/config.json)"
9689

9790
@echo Install uninstaller script
98-
@install scripts/uninstall-container.sh $(join $(STAGING_DIR), bin/uninstall-container.sh)
91+
@install scripts/uninstall-container.sh "$(join $(STAGING_DIR), bin/uninstall-container.sh)"
9992

10093
.PHONY: installer-pkg
10194
installer-pkg: $(STAGING_DIR)
10295
@echo Signing container binaries...
103-
@codesign $(CODESIGN_OPTS) --identifier com.apple.container.cli $(join $(STAGING_DIR), bin/container)
104-
@codesign $(CODESIGN_OPTS) --identifier com.apple.container.apiserver $(join $(STAGING_DIR), bin/container-apiserver)
105-
@codesign $(CODESIGN_OPTS) --prefix=com.apple.container. $(join $(STAGING_DIR), libexec/container/plugins/container-core-images/bin/container-core-images)
106-
@codesign $(CODESIGN_OPTS) --prefix=com.apple.container. --entitlements=signing/container-runtime-linux.entitlements $(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/bin/container-runtime-linux)
107-
@codesign $(CODESIGN_OPTS) --prefix=com.apple.container. --entitlements=signing/container-network-vmnet.entitlements $(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/bin/container-network-vmnet)
96+
@codesign $(CODESIGN_OPTS) --identifier com.apple.container.cli "$(join $(STAGING_DIR), bin/container)"
97+
@codesign $(CODESIGN_OPTS) --identifier com.apple.container.apiserver "$(join $(STAGING_DIR), bin/container-apiserver)"
98+
@codesign $(CODESIGN_OPTS) --prefix=com.apple.container. "$(join $(STAGING_DIR), libexec/container/plugins/container-core-images/bin/container-core-images)"
99+
@codesign $(CODESIGN_OPTS) --prefix=com.apple.container. --entitlements=signing/container-runtime-linux.entitlements "$(join $(STAGING_DIR), libexec/container/plugins/container-runtime-linux/bin/container-runtime-linux)"
100+
@codesign $(CODESIGN_OPTS) --prefix=com.apple.container. --entitlements=signing/container-network-vmnet.entitlements "$(join $(STAGING_DIR), libexec/container/plugins/container-network-vmnet/bin/container-network-vmnet)"
108101

109102
@echo Creating application installer
110-
@pkgbuild --root $(STAGING_DIR) --identifier com.apple.container-installer --install-location /usr/local $(PKG_PATH)
111-
@rm -rf $(STAGING_DIR)
103+
@pkgbuild --root "$(STAGING_DIR)" --identifier com.apple.container-installer --install-location /usr/local --version ${RELEASE_VERSION} $(PKG_PATH)
104+
@rm -rf "$(STAGING_DIR)"
112105

113106
.PHONY: dsym
114107
dsym:
115108
@echo Copying debug symbols...
116-
@rm -rf $(DSYM_DIR)
117-
@mkdir -p $(DSYM_DIR)
118-
@cp -a $(BUILD_BIN_DIR)/container-runtime-linux.dSYM $(DSYM_DIR)
119-
@cp -a $(BUILD_BIN_DIR)/container-network-vmnet.dSYM $(DSYM_DIR)
120-
@cp -a $(BUILD_BIN_DIR)/container-core-images.dSYM $(DSYM_DIR)
121-
@cp -a $(BUILD_BIN_DIR)/container-apiserver.dSYM $(DSYM_DIR)
122-
@cp -a $(BUILD_BIN_DIR)/container.dSYM $(DSYM_DIR)
109+
@rm -rf "$(DSYM_DIR)"
110+
@mkdir -p "$(DSYM_DIR)"
111+
@cp -a "$(BUILD_BIN_DIR)/container-runtime-linux.dSYM" "$(DSYM_DIR)"
112+
@cp -a "$(BUILD_BIN_DIR)/container-network-vmnet.dSYM" "$(DSYM_DIR)"
113+
@cp -a "$(BUILD_BIN_DIR)/container-core-images.dSYM" "$(DSYM_DIR)"
114+
@cp -a "$(BUILD_BIN_DIR)/container-apiserver.dSYM" "$(DSYM_DIR)"
115+
@cp -a "$(BUILD_BIN_DIR)/container.dSYM" "$(DSYM_DIR)"
123116

124117
@echo Packaging the debug symbols...
125-
@(cd $(dir $(DSYM_DIR)) ; zip -r $(notdir $(DSYM_PATH)) $(notdir $(DSYM_DIR)))
118+
@(cd "$(dir $(DSYM_DIR))" ; zip -r $(notdir $(DSYM_PATH)) $(notdir $(DSYM_DIR)))
126119

127120
.PHONY: test
128121
test:
129-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --skip TestCLI
122+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --skip TestCLI
130123

131124
.PHONY: install-kernel
132125
install-kernel:
133126
@bin/container system stop || true
134-
@bin/container system start --enable-kernel-install
127+
@bin/container system start --enable-kernel-install
135128

136129
.PHONY: integration
137130
integration: init-block
138131
@echo Ensuring apiserver stopped before the CLI integration tests...
139-
@bin/container system stop
140-
@scripts/ensure-container-stopped.sh
132+
@bin/container system stop && sleep 3 && scripts/ensure-container-stopped.sh
141133
@echo Running the integration tests...
142134
@bin/container system start
143135
@echo "Removing any existing containers"
144136
@bin/container rm --all
145137
@echo "Starting CLI integration tests"
146-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIRunLifecycle
147-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIExecCommand
148-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIRunCommand
149-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIImagesCommand
150-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIRunBase
151-
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIBuildBase
138+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLINetwork
139+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIRunLifecycle
140+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIExecCommand
141+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLICreateCommand
142+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIRunCommand
143+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIImagesCommand
144+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIRunBase
145+
@$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIBuildBase
152146
@echo Ensuring apiserver stopped after the CLI integration tests...
153147
@scripts/ensure-container-stopped.sh
154148

155149
.PHONY: fmt
156-
fmt: swift-fmt update-licenses
150+
fmt: swift-fmt update-licenses
157151

158152
.PHONY: swift-fmt
159153
SWIFT_SRC = $(shell find . -type f -name '*.swift' -not -path "*/.*" -not -path "*.pb.swift" -not -path "*.grpc.swift" -not -path "*/checkouts/*")
@@ -182,12 +176,10 @@ serve-docs:
182176
@python3 -m http.server --bind 127.0.0.1 --directory ./_serve
183177

184178
.PHONY: docs
185-
docs: _site
186-
187-
_site:
179+
docs:
188180
@echo Updating API documentation...
189-
rm -rf $@
190-
@scripts/make-docs.sh $@ container
181+
@rm -rf _site
182+
@scripts/make-docs.sh _site container
191183

192184
.PHONY: cleancontent
193185
cleancontent:
@@ -197,7 +189,7 @@ cleancontent:
197189

198190
.PHONY: clean
199191
clean:
200-
@echo Cleaning the build files...
192+
@echo Cleaning build files...
201193
@rm -rf bin/ libexec/
202194
@rm -rf _site _serve
203195
@$(SWIFT) package clean

0 commit comments

Comments
 (0)