Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pipelines] SimpleSynthAction with subdirectory prop specified produces a wrong buildspec #11424

Closed
tomas-mazak opened this issue Nov 11, 2020 · 4 comments · Fixed by #11464
Closed
Assignees
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@tomas-mazak
Copy link
Contributor

tomas-mazak commented Nov 11, 2020

SimpleSynthAction uses path.join() function to render path to artifacts. It seems that buildspec requires the path to use forward-slash as a path separator (probably as the synth action runs on Linux), however, path.join() produces a path with backslashes when synthesis is run on Windows. This should hence be hardcoded to join by forward slash (/).

I believe the bug is here:

https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/pipelines/lib/synths/simple-synth-action.ts#L376

Reproduction Steps

Instantiate a CdkPipeline with following synthAction:

const synthAction = cdkpipelines.SimpleSynthAction.standardNpmSynth({
  sourceArtifact,
  cloudAssemblyArtifact,
  subdirectory: 'cdk',
});

Run cdk synth on Windows machine.

What did you expect to happen?

In synth action CodeBuild project's buildspec, the following should be present:

{
  "artifacts": {
    "base-directory": "cdk/cdk.out",
    "files": "**/*"
  }
}

What actually happened?

If synthetized on Windows machine, result is as follows:

{
  "artifacts": {
    "base-directory": "cdk\\cdk.out",
    "files": "**/*"
  }
}

This causes the artifact to be packaged incorrectly and the subsequent UpdatePipeline action fails as it cannot find the cloud assembly in the expected path.

Environment

  • **CDK CLI Version : 1.73.0 (build eb6f3a9)
  • **Framework Version : 1.72.0
  • **Node.js Version : v10.16.3
  • **OS : Windows 10 Enterprise 1909
  • **Language (Version): Typescript 3.9.7

Other

I will raise a PR to fix this shortly.


This is 🐛 Bug Report

@tomas-mazak tomas-mazak added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 11, 2020
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Nov 11, 2020
@hoegertn
Copy link
Contributor

Shouldn't this be solved by the first mutation as the synth is running on Linux too in the CodePipeline synthesize step?

@tomas-mazak
Copy link
Contributor Author

Shouldn't this be solved by the first mutation as the synth is running on Linux too in the CodePipeline synthesize step?

@hoegertn, That very first mutation fails already because of this bug:

Error: ENOENT: no such file or directory, open 'manifest.json'

@hoegertn
Copy link
Contributor

Got it. Can you provide a PullRequest with a fix? Should be straight forward.

@mergify mergify bot closed this as completed in #11464 Nov 15, 2020
mergify bot pushed a commit that referenced this issue Nov 15, 2020
Pipelines generates path references based on the local system's
file tree, and uses `path.join()` (etc) to build those.

On a Windows machine, those would use a `\\` as a path separator,
but the path separator for CodePipeline and the Linux CodeBuild image
we use should be a `/`.

Translate them.

Fixes #11359, fixes #11405, fixes #11424.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants