Skip to content

Commit b5eed43

Browse files
authored
Merge branch 'master' into epolon/remove-invalid-test-from-regression
2 parents baf39dd + 9e81dc7 commit b5eed43

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

packages/@aws-cdk/pipelines/lib/codepipeline/_codebuild-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function generateInputArtifactLinkCommands(artifacts: ArtifactMap, inputs: FileS
333333
return inputs.map(input => {
334334
const fragments = [];
335335

336-
fragments.push(`[[ ! -d "${input.directory}" ]] || { echo 'additionalInputs: "${input.directory}" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.'; exit 1; }`);
336+
fragments.push(`[ ! -d "${input.directory}" ] || { echo 'additionalInputs: "${input.directory}" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.'; exit 1; }`);
337337

338338
const parentDirectory = path.dirname(input.directory);
339339
if (!['.', '..'].includes(parentDirectory)) {

packages/@aws-cdk/pipelines/test/codepipeline/codebuild-step.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test('additionalinputs creates the right commands', () => {
3434
phases: {
3535
install: {
3636
commands: [
37-
'[[ ! -d "some/deep/directory" ]] || { echo \'additionalInputs: "some/deep/directory" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.\'; exit 1; } && mkdir -p -- "some/deep" && ln -s -- "$CODEBUILD_SRC_DIR_test2_test2_Source" "some/deep/directory"',
37+
'[ ! -d "some/deep/directory" ] || { echo \'additionalInputs: "some/deep/directory" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.\'; exit 1; } && mkdir -p -- "some/deep" && ln -s -- "$CODEBUILD_SRC_DIR_test2_test2_Source" "some/deep/directory"',
3838
],
3939
},
4040
},

packages/@aws-cdk/pipelines/test/compliance/synths.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,8 @@ behavior('Multiple input sources in side-by-side directories', (suite) => {
947947
phases: {
948948
install: {
949949
commands: [
950-
'[[ ! -d "../sibling" ]] || { echo \'additionalInputs: "../sibling" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.\'; exit 1; } && ln -s -- "$CODEBUILD_SRC_DIR_foo_bar_Source" "../sibling"',
951-
'[[ ! -d "sub" ]] || { echo \'additionalInputs: "sub" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.\'; exit 1; } && ln -s -- "$CODEBUILD_SRC_DIR_Prebuild_Output" "sub"',
950+
'[ ! -d "../sibling" ] || { echo \'additionalInputs: "../sibling" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.\'; exit 1; } && ln -s -- "$CODEBUILD_SRC_DIR_foo_bar_Source" "../sibling"',
951+
'[ ! -d "sub" ] || { echo \'additionalInputs: "sub" must not exist yet. If you want to merge multiple artifacts, use a "cp" command.\'; exit 1; } && ln -s -- "$CODEBUILD_SRC_DIR_Prebuild_Output" "sub"',
952952
],
953953
},
954954
build: {

packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,18 @@ async function isEc2Instance() {
177177
let instance = false;
178178
if (process.platform === 'win32') {
179179
// https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/identify_ec2_instances.html
180-
const result = await util.promisify(child_process.exec)('wmic path win32_computersystemproduct get uuid', { encoding: 'utf-8' });
181-
// output looks like
182-
// UUID
183-
// EC2AE145-D1DC-13B2-94ED-01234ABCDEF
184-
const lines = result.stdout.toString().split('\n');
185-
instance = lines.some(x => matchesRegex(/^ec2/i, x));
180+
try {
181+
const result = await util.promisify(child_process.exec)('wmic path win32_computersystemproduct get uuid', { encoding: 'utf-8' });
182+
// output looks like
183+
// UUID
184+
// EC2AE145-D1DC-13B2-94ED-01234ABCDEF
185+
const lines = result.stdout.toString().split('\n');
186+
instance = lines.some(x => matchesRegex(/^ec2/i, x));
187+
} catch (e) {
188+
// Modern machines may not have wmic.exe installed. No reason to fail, just assume it's not an EC2 instance.
189+
debug(`Checking using WMIC failed, assuming NOT an EC2 instance: ${e.message} (pass --ec2creds to force)`);
190+
instance = false;
191+
}
186192
} else {
187193
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html
188194
const files: Array<[string, RegExp]> = [

0 commit comments

Comments
 (0)