3

I have some symlinks in my github repo.

When I have a Codebuild project that clones directly from github, symlinks are preserved.

I switched so that Codepipeline listens for changes in my dev branch in github, and passes the artifacts to codebuild.

Since making this switch, Codebuild can't see the symlinks anymore.

Is this by design, or am I perhaps missing something in how my codepipeline is configured?

maafk
  • 6,176
  • 5
  • 35
  • 58

3 Answers3

9

I was running into a symlinks issue deploying a node Elastic Beanstalk app. Looks like symlinks is now supported for artifacts. Check out the docs

artifacts:
  enable-symlinks: yes

Adding this to the buildspec.yml file solved my issue

Tim
  • 181
  • 2
  • 5
  • 1
    Thanks Tim, this solved my problem when deploying a NestJS app via AWS Code Pipeline > Code Builder > Elastic Beanstalk. I was getting errors like: `Cannot find module '../commands' node_modules/.bin/nest` – Andy Mar 06 '23 at 08:30
5

Up to now, AWS CodePipeline doesn't support symlinks in source. Refer to Source artifact doesn't properly handle symlinks or file modes in discussion forums, we can see

We've got a pipeline setup with an initial "Source" stage coming from a private repo on GitHub. The repo contents get zipped up and end up as the first input artifact for the pipeline.

I've noticed a couple of issues with the zip artifact:

1.) Symlinks don't come through as proper symlinks but rather text files with the content being the location that the symlink points to.

Maybe AWS CodePipeline team will fix it in the future.

Community
  • 1
  • 1
LiuChang
  • 739
  • 6
  • 13
2

For anybody visiting this again, there is a way to do this now. You need to use github connector v2 on your source action, then select "git clone mode". This will let codebuild clone your repository directly instead of it getting passed through an artifact.

You also need to add the following permissions

Pipeline Role:

  • codestar-connections:UseConnection.

Codebuild Role:

  • codestar-connections:UseConnection
  • codecommit:GitPull