Skip to content

Commit 3838be5

Browse files
Update protos and add builder shim version in Package.swift (#176)
This PR updates the protos to match the recent changes in apple/container-builder-shim#15. This PR additionally adds the builder shim version as a variable in Package.swift. This allows us to be consistent with the builder tag used for the builder shim image and when building protobuf files. Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
1 parent 97d4ed6 commit 3838be5

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

Package.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ if let path = ProcessInfo.processInfo.environment["CONTAINERIZATION_PATH"] {
3232

3333
let releaseVersion = ProcessInfo.processInfo.environment["RELEASE_VERSION"] ?? "0.0.0"
3434
let gitCommit = ProcessInfo.processInfo.environment["GIT_COMMIT"] ?? "unspecified"
35+
let builderShimVersion = "0.2.0"
3536

3637
let package = Package(
3738
name: "container",
@@ -309,6 +310,7 @@ let package = Package(
309310
.define("CZ_VERSION", to: "\"\(scVersion)\""),
310311
.define("GIT_COMMIT", to: "\"\(gitCommit)\""),
311312
.define("RELEASE_VERSION", to: "\"\(releaseVersion)\""),
313+
.define("BUILDER_SHIM_VERSION", to: "\"\(builderShimVersion)\"")
312314
]
313315
),
314316
]

Protobuf.Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ LOCAL_DIR := $(ROOT_DIR)/.local
1717
LOCALBIN := $(LOCAL_DIR)/bin
1818

1919
BUILDER_SHIM_REPO ?= https://github.com/apple/container-builder-shim.git
20+
2021
## Versions
22+
BUILDER_SHIM_VERSION ?= $(shell sed -n 's/let builderShimVersion *= *"\(.*\)"/\1/p' Package.swift)
2123
PROTOC_VERSION=26.1
2224

2325
# protoc binary installation
@@ -41,7 +43,7 @@ protoc-gen-swift:
4143
protos: $(PROTOC) protoc-gen-swift protoc_gen_grpc_swift
4244
@echo Generating protocol buffers source code...
4345
@mkdir -p $(LOCAL_DIR)
44-
@cd $(LOCAL_DIR) && git clone $(BUILDER_SHIM_REPO)
46+
@cd $(LOCAL_DIR) && git clone --branch $(BUILDER_SHIM_VERSION) --depth 1 $(BUILDER_SHIM_REPO)
4547
@$(PROTOC) $(LOCAL_DIR)/container-builder-shim/pkg/api/Builder.proto \
4648
--plugin=protoc-gen-grpc-swift=$(BUILD_BIN_DIR)/protoc-gen-grpc-swift \
4749
--plugin=protoc-gen-swift=$(BUILD_BIN_DIR)/protoc-gen-swift \

Sources/CVersion/Version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ const char* get_release_version() {
4242
const char* get_swift_containerization_version() {
4343
return CZ_VERSION;
4444
}
45+
46+
const char* get_container_builder_shim_version() {
47+
return BUILDER_SHIM_VERSION;
48+
}

Sources/CVersion/include/Version.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@
4040
#define RELEASE_VERSION "0.0.0"
4141
#endif
4242

43+
#ifndef BUILDER_SHIM_VERSION
44+
#define BUILDER_SHIM_VERSION "0.0.0"
45+
#endif
46+
4347
const char* get_git_commit();
4448

4549
const char* get_release_version();
4650

4751
const char* get_swift_containerization_version();
52+
53+
const char* get_container_builder_shim_version();

Sources/ContainerBuild/Builder.grpc.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import SwiftProtobuf
3333
/// To perform a build:
3434
///
3535
/// 1. CreateBuild to create a new build
36-
/// 2. StartBuild to start the build exection where client and server
36+
/// 2. StartBuild to start the build execution where client and server
3737
/// both have a stream for exchanging data during the build.
3838
///
3939
/// The client may send:
@@ -96,7 +96,7 @@ import SwiftProtobuf
9696
/// source path, and empty data
9797
/// 2. server archives the data at source path, and starts to send chunks to
9898
/// the client
99-
/// 3. server coninues to send all chunks until last chunk, which server
99+
/// 3. server continues to send all chunks until last chunk, which server
100100
/// will send with
101101
/// 'complete' set to true
102102
/// 4. client starts to receive the data and stream to a temporary file
@@ -263,7 +263,7 @@ public struct Com_Apple_Container_Build_V1_BuilderNIOClient: Com_Apple_Container
263263
/// To perform a build:
264264
///
265265
/// 1. CreateBuild to create a new build
266-
/// 2. StartBuild to start the build exection where client and server
266+
/// 2. StartBuild to start the build execution where client and server
267267
/// both have a stream for exchanging data during the build.
268268
///
269269
/// The client may send:
@@ -326,7 +326,7 @@ public struct Com_Apple_Container_Build_V1_BuilderNIOClient: Com_Apple_Container
326326
/// source path, and empty data
327327
/// 2. server archives the data at source path, and starts to send chunks to
328328
/// the client
329-
/// 3. server coninues to send all chunks until last chunk, which server
329+
/// 3. server continues to send all chunks until last chunk, which server
330330
/// will send with
331331
/// 'complete' set to true
332332
/// 4. client starts to receive the data and stream to a temporary file
@@ -526,7 +526,7 @@ public enum Com_Apple_Container_Build_V1_BuilderClientMetadata {
526526
/// To perform a build:
527527
///
528528
/// 1. CreateBuild to create a new build
529-
/// 2. StartBuild to start the build exection where client and server
529+
/// 2. StartBuild to start the build execution where client and server
530530
/// both have a stream for exchanging data during the build.
531531
///
532532
/// The client may send:
@@ -589,7 +589,7 @@ public enum Com_Apple_Container_Build_V1_BuilderClientMetadata {
589589
/// source path, and empty data
590590
/// 2. server archives the data at source path, and starts to send chunks to
591591
/// the client
592-
/// 3. server coninues to send all chunks until last chunk, which server
592+
/// 3. server continues to send all chunks until last chunk, which server
593593
/// will send with
594594
/// 'complete' set to true
595595
/// 4. client starts to receive the data and stream to a temporary file
@@ -673,7 +673,7 @@ extension Com_Apple_Container_Build_V1_BuilderProvider {
673673
/// To perform a build:
674674
///
675675
/// 1. CreateBuild to create a new build
676-
/// 2. StartBuild to start the build exection where client and server
676+
/// 2. StartBuild to start the build execution where client and server
677677
/// both have a stream for exchanging data during the build.
678678
///
679679
/// The client may send:
@@ -736,7 +736,7 @@ extension Com_Apple_Container_Build_V1_BuilderProvider {
736736
/// source path, and empty data
737737
/// 2. server archives the data at source path, and starts to send chunks to
738738
/// the client
739-
/// 3. server coninues to send all chunks until last chunk, which server
739+
/// 3. server continues to send all chunks until last chunk, which server
740740
/// will send with
741741
/// 'complete' set to true
742742
/// 4. client starts to receive the data and stream to a temporary file

Sources/ContainerClient/Core/ClientDefaults.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ extension ClientDefaults.Keys {
6363
case .defaultKernelBinaryPath:
6464
return "opt/kata/share/kata-containers/vmlinux-6.12.28-153"
6565
case .defaultBuilderImage:
66-
return "ghcr.io/apple/container-builder-shim/builder:0.1.0"
66+
let tag = String(cString: get_container_builder_shim_version())
67+
return "ghcr.io/apple/container-builder-shim/builder:\(tag)"
6768
case .defaultDNSDomain:
6869
return "test"
6970
case .defaultRegistryDomain:

0 commit comments

Comments
 (0)