From 4a6a1f15d83f1584e97a5600fb49d4e2d9eff3fa Mon Sep 17 00:00:00 2001 From: Kathryn Baldauf Date: Tue, 24 Jun 2025 13:25:58 -0700 Subject: [PATCH] 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 --- Package.swift | 2 +- Sources/ContainerBuild/Builder.grpc.swift | 8 ++++---- .../CLITests/Subcommands/Build/CLIBuilderTest.swift | 13 +++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index 8fa4ba08..cc2e0376 100644 --- a/Package.swift +++ b/Package.swift @@ -32,7 +32,7 @@ if let path = ProcessInfo.processInfo.environment["CONTAINERIZATION_PATH"] { let releaseVersion = ProcessInfo.processInfo.environment["RELEASE_VERSION"] ?? "0.0.0" let gitCommit = ProcessInfo.processInfo.environment["GIT_COMMIT"] ?? "unspecified" -let builderShimVersion = "0.2.0" +let builderShimVersion = "0.2.1" let package = Package( name: "container", diff --git a/Sources/ContainerBuild/Builder.grpc.swift b/Sources/ContainerBuild/Builder.grpc.swift index e742b955..33d5eee2 100644 --- a/Sources/ContainerBuild/Builder.grpc.swift +++ b/Sources/ContainerBuild/Builder.grpc.swift @@ -110,7 +110,7 @@ import SwiftProtobuf /// /// /// NOTE: the client should close the send stream once it has finished -/// receiving the build output or abadon the current build due to error. +/// receiving the build output or abandon the current build due to error. /// Server should keep the stream open until it receives the EOF that client /// has closed the stream, which the server should then close its send stream. /// @@ -340,7 +340,7 @@ public struct Com_Apple_Container_Build_V1_BuilderNIOClient: Com_Apple_Container /// /// /// NOTE: the client should close the send stream once it has finished -/// receiving the build output or abadon the current build due to error. +/// receiving the build output or abandon the current build due to error. /// Server should keep the stream open until it receives the EOF that client /// has closed the stream, which the server should then close its send stream. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -603,7 +603,7 @@ public enum Com_Apple_Container_Build_V1_BuilderClientMetadata { /// /// /// NOTE: the client should close the send stream once it has finished -/// receiving the build output or abadon the current build due to error. +/// receiving the build output or abandon the current build due to error. /// Server should keep the stream open until it receives the EOF that client /// has closed the stream, which the server should then close its send stream. /// @@ -750,7 +750,7 @@ extension Com_Apple_Container_Build_V1_BuilderProvider { /// /// /// NOTE: the client should close the send stream once it has finished -/// receiving the build output or abadon the current build due to error. +/// receiving the build output or abandon the current build due to error. /// Server should keep the stream open until it receives the EOF that client /// has closed the stream, which the server should then close its send stream. /// diff --git a/Tests/CLITests/Subcommands/Build/CLIBuilderTest.swift b/Tests/CLITests/Subcommands/Build/CLIBuilderTest.swift index 26247192..b557699f 100644 --- a/Tests/CLITests/Subcommands/Build/CLIBuilderTest.swift +++ b/Tests/CLITests/Subcommands/Build/CLIBuilderTest.swift @@ -113,6 +113,19 @@ extension TestCLIBuildBase { #expect(try self.inspectImage(imageName) == imageName, "expected to have successfully built \(imageName)") } + @Test func testBuildArg() throws { + let tempDir: URL = try createTempDir() + let dockerfile: String = + """ + ARG TAG=unknown + FROM ghcr.io/linuxcontainers/alpine:${TAG} + """ + try createContext(tempDir: tempDir, dockerfile: dockerfile) + let imageName: String = "registry.local/build-arg:\(UUID().uuidString)" + try self.build(tag: imageName, tempDir: tempDir, args: ["TAG=3.20"]) + #expect(try self.inspectImage(imageName) == imageName, "expected to have successfully built \(imageName)") + } + @Test func testBuildNetworkAccess() throws { let tempDir: URL = try createTempDir() let dockerfile: String =