Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecr-reg-val #142

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"bin": {
"cyv": "./index.js"
},
"version": "0.29.0",
"version": "0.30.0",
"main": "./validator.js",
"scripts": {
"test": "jest --coverage --runInBand",
Expand Down
19 changes: 18 additions & 1 deletion schema/1.0/validations/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ const validate = function (step,
}
}

const integrationDefinedProvider = (_.find(context.registries, reg => reg.name === registry) || {}).provider;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

outside the if block cause used also in accountId validation


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`,
Expand Down Expand Up @@ -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 };
};

Expand Down