@@ -51,6 +51,7 @@ struct AWSLambdaPackager: CommandPlugin {
51
51
toolsProvider: { name in try context. tool ( named: name) . path } ,
52
52
outputDirectory: configuration. outputDirectory,
53
53
baseImage: configuration. baseDockerImage,
54
+ disableDockerImageUpdate: configuration. disableDockerImageUpdate,
54
55
buildConfiguration: configuration. buildConfiguration,
55
56
verboseLogging: configuration. verboseLogging
56
57
)
@@ -77,6 +78,7 @@ struct AWSLambdaPackager: CommandPlugin {
77
78
toolsProvider: ( String ) throws -> Path ,
78
79
outputDirectory: Path ,
79
80
baseImage: String ,
81
+ disableDockerImageUpdate: Bool ,
80
82
buildConfiguration: PackageManager . BuildConfiguration ,
81
83
verboseLogging: Bool
82
84
) throws -> [ LambdaProduct : Path ] {
@@ -86,13 +88,15 @@ struct AWSLambdaPackager: CommandPlugin {
86
88
print ( " building \" \( packageIdentity) \" in docker " )
87
89
print ( " ------------------------------------------------------------------------- " )
88
90
89
- // update the underlying docker image, if necessary
90
- print ( " updating \" \( baseImage) \" docker image " )
91
- try self . execute (
92
- executable: dockerToolPath,
93
- arguments: [ " pull " , baseImage] ,
94
- logLevel: . output
95
- )
91
+ if !disableDockerImageUpdate {
92
+ // update the underlying docker image, if necessary
93
+ print ( " updating \" \( baseImage) \" docker image " )
94
+ try self . execute (
95
+ executable: dockerToolPath,
96
+ arguments: [ " pull " , baseImage] ,
97
+ logLevel: . output
98
+ )
99
+ }
96
100
97
101
// get the build output path
98
102
let buildOutputPathCommand = " swift build -c \( buildConfiguration. rawValue) --show-bin-path "
@@ -290,6 +294,7 @@ private struct Configuration: CustomStringConvertible {
290
294
public let buildConfiguration : PackageManager . BuildConfiguration
291
295
public let verboseLogging : Bool
292
296
public let baseDockerImage : String
297
+ public let disableDockerImageUpdate : Bool
293
298
294
299
public init (
295
300
context: PluginContext ,
@@ -302,6 +307,7 @@ private struct Configuration: CustomStringConvertible {
302
307
let configurationArgument = argumentExtractor. extractOption ( named: " configuration " )
303
308
let swiftVersionArgument = argumentExtractor. extractOption ( named: " swift-version " )
304
309
let baseDockerImageArgument = argumentExtractor. extractOption ( named: " base-docker-image " )
310
+ let disableDockerImageUpdateArgument = argumentExtractor. extractFlag ( named: " disable-docker-image-update " ) > 0
305
311
306
312
self . verboseLogging = verboseArgument
307
313
@@ -345,6 +351,8 @@ private struct Configuration: CustomStringConvertible {
345
351
let swiftVersion = swiftVersionArgument. first ?? . none // undefined version will yield the latest docker image
346
352
self . baseDockerImage = baseDockerImageArgument. first ?? " swift: \( swiftVersion. map { $0 + " - " } ?? " " ) amazonlinux2 "
347
353
354
+ self . disableDockerImageUpdate = disableDockerImageUpdateArgument
355
+
348
356
if self . verboseLogging {
349
357
print ( " ------------------------------------------------------------------------- " )
350
358
print ( " configuration " )
@@ -360,6 +368,7 @@ private struct Configuration: CustomStringConvertible {
360
368
products: \( self . products. map ( \. name) )
361
369
buildConfiguration: \( self . buildConfiguration)
362
370
baseDockerImage: \( self . baseDockerImage)
371
+ disableDockerImageUpdate: \( self . disableDockerImageUpdate)
363
372
}
364
373
"""
365
374
}
0 commit comments