diff --git a/package.json b/package.json index 2abeecd7..b4bb9a02 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "bin": { "cyv": "./index.js" }, - "version": "0.29.0", + "version": "0.30.0", "main": "./validator.js", "scripts": { "test": "jest --coverage --runInBand", diff --git a/schema/1.0/validations/registry.js b/schema/1.0/validations/registry.js index 5897a101..65069089 100644 --- a/schema/1.0/validations/registry.js +++ b/schema/1.0/validations/registry.js @@ -231,8 +231,9 @@ const validate = function (step, } } + const integrationDefinedProvider = (_.find(context.registries, reg => reg.name === registry) || {}).provider; + if (step.region) { - const integrationDefinedProvider = (_.find(context.registries, reg => reg.name === registry) || {}).provider; if (!AWS_REGIONS.find(currentRegion => currentRegion === step.region)) { errors.push(ErrorBuilder.buildError({ message: `aws region is invalid`, @@ -260,6 +261,22 @@ const validate = function (step, } } + if (step.accountId) { + if (integrationDefinedProvider !== 'ecr') { + errors.push(ErrorBuilder.buildError({ + message: `Unable to specify accountId with a registry of type: ${integrationDefinedProvider} `, + name, + yaml, + code: 206, + type: ErrorType.Error, + docsLink: _.get(DocumentationLinks, step.type, docBaseUrl), + errorPath, + key, + actionItems: 'Cross-account pushes are currently supported only for ECR', + })); + } + } + return { errors, warnings }; };