Skip to content

Commit 9e81dc7

Browse files
authored
fix(pipelines): additionalInputs not working (#17279)
The rendering of `additionalInputs` was using a bashism that is not supported by CodeBuild by default. Turn ``` [[ ! -d "directory" ]] ``` into ``` [ ! -d "directory" ] ``` Fixes #17224 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 332ce4d commit 9e81dc7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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: {

0 commit comments

Comments
 (0)