-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply stack tags to the stacks deployed using CDK Pipelines. Fixes #9260.
- Loading branch information
Showing
11 changed files
with
156 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"5.0.0"} | ||
{"version":"6.0.0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as cxschema from '@aws-cdk/cloud-assembly-schema'; | ||
import * as cxapi from '../lib'; | ||
import { rimraf } from './util'; | ||
|
||
let builder: cxapi.CloudAssemblyBuilder; | ||
beforeEach(() => { | ||
builder = new cxapi.CloudAssemblyBuilder(); | ||
}); | ||
|
||
afterEach(() => { | ||
rimraf(builder.outdir); | ||
}); | ||
|
||
test('read tags', () => { | ||
// GIVEN | ||
builder.addArtifact('Stack', { | ||
type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, | ||
environment: 'aws://1222344/us-east-1', | ||
properties: { | ||
templateFile: 'bla.json', | ||
tags: { | ||
foo: 'bar', | ||
}, | ||
}, | ||
}); | ||
|
||
// WHEN | ||
const assembly = builder.buildAssembly(); | ||
|
||
// THEN | ||
expect(assembly.getStackByName('Stack').tags).toEqual({ foo: 'bar' }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
/** | ||
* rm -rf reimplementation, don't want to depend on an NPM package for this | ||
*/ | ||
export function rimraf(fsPath: string) { | ||
try { | ||
const isDir = fs.lstatSync(fsPath).isDirectory(); | ||
|
||
if (isDir) { | ||
for (const file of fs.readdirSync(fsPath)) { | ||
rimraf(path.join(fsPath, file)); | ||
} | ||
fs.rmdirSync(fsPath); | ||
} else { | ||
fs.unlinkSync(fsPath); | ||
} | ||
} catch (e) { | ||
// We will survive ENOENT | ||
if (e.code !== 'ENOENT') { throw e; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters