From ddee1d4db750c71dccc7572337155a54097c0303 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Thu, 24 Oct 2024 18:59:34 +0200 Subject: [PATCH] chore: notice for https://github.com/aws/aws-cdk/issues/31885 --- data/notices.json | 12 ++++++++++++ src/construct-info.ts | 2 ++ src/notice.ts | 6 +++--- test/schema.test.ts | 3 +++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/data/notices.json b/data/notices.json index 4fe1387a..80048b68 100644 --- a/data/notices.json +++ b/data/notices.json @@ -679,6 +679,18 @@ } ], "schemaVersion": "1" + }, + { + "title": "(cli): Bootstrap stack outdated", + "issueNumber": 31885, + "overview": "The bootstrap stack in {resolve:ENVIRONMENTS} is outdated. We recommend at least version 21, distributed with CDK CLI 2.149.0 or higher. Please rebootstrap your environment by runing 'cdk bootstrap aws:///'", + "components": [ + { + "name": "bootstrap", + "version": "<21" + } + ], + "schemaVersion": "1" } ] } diff --git a/src/construct-info.ts b/src/construct-info.ts index d9e38522..4a7bee23 100644 --- a/src/construct-info.ts +++ b/src/construct-info.ts @@ -1,3 +1,5 @@ +export const SPECIAL_COMPONENTS = ['bootstrap']; + export const CONSTRUCT_INFO = [ 'aws-cdk-lib.aws_elasticsearch', '@aws-cdk/aws-appconfig-alpha', diff --git a/src/notice.ts b/src/notice.ts index 8260cd9e..8dc84e50 100644 --- a/src/notice.ts +++ b/src/notice.ts @@ -1,5 +1,5 @@ import * as semver from 'semver'; -import { CONSTRUCT_INFO } from './construct-info'; +import { CONSTRUCT_INFO, SPECIAL_COMPONENTS } from './construct-info'; const MAX_TITLE_LENGTH = 100; @@ -66,7 +66,7 @@ export function validateNotice(notice: Notice): void { if (!CONSTRUCT_INFO.includes(module)) { throw new Error(`Invalid fully qualified name of an experimental construct ${component.name}.`); } - } else if (names.length == 1 && !CONSTRUCT_INFO.includes(names[0])) { + } else if (names.length == 1 && !CONSTRUCT_INFO.includes(names[0]) && !SPECIAL_COMPONENTS.includes(names[0])) { throw new Error(`Invalid component name ${component.name}.`); } } @@ -74,4 +74,4 @@ export function validateNotice(notice: Notice): void { if (!semver.validRange(notice.schemaVersion)) { throw new Error(`Schema version ${notice.schemaVersion} is not a valid semver range`); } -} +} \ No newline at end of file diff --git a/test/schema.test.ts b/test/schema.test.ts index 335b95f0..1549d109 100644 --- a/test/schema.test.ts +++ b/test/schema.test.ts @@ -3,6 +3,7 @@ import { IncomingMessage } from 'http'; import https from 'https'; import * as path from 'path'; import * as semver from 'semver'; +import { SPECIAL_COMPONENTS } from '../src/construct-info'; import { Notice, validateNotice } from '../src/notice'; describe('Notices file is valid', () => { @@ -40,6 +41,8 @@ describe('Notices file is valid', () => { test('v2 version ranges must be bounded at the bottom', () => { for (const component of notice.components) { if (component.version === '1.*') { continue; } // Special range that we allow + if (SPECIAL_COMPONENTS.includes(component.name)) { continue; } // Not subject to v1/v2 ranges + if (semver.intersects(component.version, '2', { includePrerelease: true }) && !semver.subset(component.version, '2', { includePrerelease: true })) { throw new Error(`${component.version} should have an upper bound in v1 range, or a lower bound in v2 range (version should look like "^2.3.4 <2.5.6")`);