Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/plugins/aws/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ class AwsProvider {
buildArgs: { type: 'object', additionalProperties: { type: 'string' } },
cacheFrom: { type: 'array', items: { type: 'string' } },
platform: { type: 'string' },
provenance: { type: 'string' },
},
additionalProperties: false,
},
Expand Down Expand Up @@ -2214,6 +2215,7 @@ Object.defineProperties(
buildArgs,
cacheFrom,
platform,
provenance,
scanOnPush,
}) {
const imageProgress = progress.get(`containerImage:${imageName}`);
Expand Down Expand Up @@ -2262,6 +2264,7 @@ Object.defineProperties(

// This is an optional argument, so we only append to the arguments if "platform" is specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can update the comment as well (like it's done on serverless v4)

if (platform !== '') buildDockerArgs.push(`--platform=${platform}`);
if (provenance !== '') buildDockerArgs.push(`--provenance=${provenance}`)

let imageSha;
try {
Expand Down Expand Up @@ -2396,6 +2399,7 @@ Object.defineProperties(
const defaultCacheFrom = [];
const defaultScanOnPush = false;
const defaultPlatform = '';
const defaultProvenance = ''

if (imageUri) {
return await this.resolveImageUriAndShaFromUri(imageUri);
Expand Down Expand Up @@ -2450,6 +2454,12 @@ Object.defineProperties(
'ECR_IMAGE_BOTH_URI_AND_PLATFORM_DEFINED_ERROR'
);
}
if (imageDefinedInProvider.uri && imageDefinedInProvider.provenance) {
throw new ServerlessError(
`The "provenance" property cannot be used with "uri" property "${imageName}"`,
'ECR_IMAGE_BOTH_URI_AND_PROVENANCE_DEFINED_ERROR',
)
}
if (imageDefinedInProvider.path) {
return await this.resolveImageUriAndShaFromPath({
imageName,
Expand All @@ -2458,6 +2468,7 @@ Object.defineProperties(
buildArgs: imageDefinedInProvider.buildArgs || defaultBuildArgs,
cacheFrom: imageDefinedInProvider.cacheFrom || defaultCacheFrom,
platform: imageDefinedInProvider.platform || defaultPlatform,
provenance: imageDefinedInProvider.provenance || defaultProvenance,
scanOnPush: imageScanDefinedInProvider,
});
}
Expand All @@ -2473,6 +2484,7 @@ Object.defineProperties(
buildArgs: imageDefinedInProvider.buildArgs || defaultBuildArgs,
cacheFrom: imageDefinedInProvider.cacheFrom || defaultCacheFrom,
platform: imageDefinedInProvider.platform || defaultPlatform,
provenance: imageDefinedInProvider.provenance || defaultProvenance,
scanOnPush: imageScanDefinedInProvider,
});
},
Expand Down
Loading