Skip to content

Commit 1897382

Browse files
committed
fix: validate pipeline name length (max 28) and format
OSIS pipeline names are limited to 28 characters. IAM role suffixes add up to 20 more characters. Validate upfront to prevent cryptic AWS API errors downstream. Signed-off-by: Kyle Hounslow <kylhouns@amazon.com>
1 parent e7753b9 commit 1897382

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

aws/cli-installer/src/cli.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ export function validateConfig(cfg) {
196196
const errors = [];
197197

198198
if (!cfg.pipelineName) errors.push('--pipeline-name is required');
199+
if (cfg.pipelineName && cfg.pipelineName.length > 28) {
200+
errors.push(`--pipeline-name must be 28 characters or fewer (got ${cfg.pipelineName.length}). This limit is imposed by OSIS pipeline naming.`);
201+
}
202+
if (cfg.pipelineName && !/^[a-z][a-z0-9-]*$/.test(cfg.pipelineName)) {
203+
errors.push('--pipeline-name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens');
204+
}
199205
if (!cfg.region) errors.push('--region is required');
200206

201207
if (cfg.osAction === 'reuse' && !cfg.opensearchEndpoint) {

0 commit comments

Comments
 (0)