@@ -207,7 +207,12 @@ func (d *detector) checkApplication(ctx context.Context, app *model.Application,
207
207
}
208
208
d .logger .Info (fmt .Sprintf ("application %s has a live function manifest" , app .Id ))
209
209
210
- ignoreAndSortParameters (& headManifest .Spec )
210
+ clonedSpec := ignoreAndSortParameters (headManifest .Spec )
211
+ head := provider.FunctionManifest {
212
+ Kind : headManifest .Kind ,
213
+ APIVersion : headManifest .APIVersion ,
214
+ Spec : clonedSpec ,
215
+ }
211
216
212
217
// WithIgnoreAddingMapKeys option ignores all of followings:
213
218
// - default value of Architecture
@@ -216,7 +221,7 @@ func (d *detector) checkApplication(ctx context.Context, app *model.Application,
216
221
// - tags added in live states, including pipecd managed tags
217
222
result , err := provider .Diff (
218
223
liveManifest ,
219
- headManifest ,
224
+ head ,
220
225
diff .WithEquateEmpty (),
221
226
diff .WithIgnoreAddingMapKeys (),
222
227
diff .WithCompareNumberAndNumericString (),
@@ -238,22 +243,31 @@ func (d *detector) checkApplication(ctx context.Context, app *model.Application,
238
243
// sorts: (Lambda sorts them in liveSpec)
239
244
// - Architectures in headSpec
240
245
// - SubnetIDs in headSpec
241
- func ignoreAndSortParameters (headSpec * provider.FunctionManifestSpec ) {
246
+ func ignoreAndSortParameters (headSpec provider.FunctionManifestSpec ) provider.FunctionManifestSpec {
247
+ cloneSpec := headSpec
242
248
// We cannot compare SourceCode and S3 packaging because live states do not have them.
243
- headSpec .SourceCode = provider.SourceCode {}
244
- headSpec .S3Bucket = ""
245
- headSpec .S3Key = ""
246
- headSpec .S3ObjectVersion = ""
249
+ cloneSpec .SourceCode = provider.SourceCode {}
250
+ cloneSpec .S3Bucket = ""
251
+ cloneSpec .S3Key = ""
252
+ cloneSpec .S3ObjectVersion = ""
247
253
248
254
// Architectures, Environments, SubnetIDs, and Tags are sorted in live states.
249
255
if len (headSpec .Architectures ) > 1 {
250
- sort .Slice (headSpec .Architectures , func (i , j int ) bool {
251
- return strings .Compare (headSpec .Architectures [i ].Name , headSpec .Architectures [j ].Name ) < 0
256
+ cloneSpec .Architectures = slices .Clone (headSpec .Architectures )
257
+ sort .Slice (cloneSpec .Architectures , func (i , j int ) bool {
258
+ return strings .Compare (cloneSpec .Architectures [i ].Name , cloneSpec .Architectures [j ].Name ) < 0
252
259
})
253
260
}
254
261
if headSpec .VPCConfig != nil && len (headSpec .VPCConfig .SubnetIDs ) > 1 {
255
- slices .Sort (headSpec .VPCConfig .SubnetIDs )
262
+ cloneSubnets := slices .Clone (headSpec .VPCConfig .SubnetIDs )
263
+ slices .Sort (cloneSubnets )
264
+ cloneSpec .VPCConfig = & provider.VPCConfig {
265
+ SecurityGroupIDs : headSpec .VPCConfig .SecurityGroupIDs ,
266
+ SubnetIDs : cloneSubnets ,
267
+ }
256
268
}
269
+
270
+ return cloneSpec
257
271
}
258
272
259
273
func (d * detector ) loadHeadFunctionManifest (app * model.Application , repo git.Repo , headCommit git.Commit ) (provider.FunctionManifest , error ) {
0 commit comments