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

Create intermediate symlink for switching between build and launch modules #373

Merged
merged 1 commit into from
Jul 14, 2022

Conversation

thitch97
Copy link
Contributor

@thitch97 thitch97 commented Jul 13, 2022

Summary

Avoids changing /workspace permissions, creating instead a symlink in /tmp which points to build modules during build and launch modules at launch. The /tmp symlink is pointed to by the node_modules symlink in /workspace (i.e. /workspace/node_modules -> /tmp/node_modules -> {build, launch}-modules layer).

The exec.d script is now only run when node_modules is required for both build and launch.

Use Cases

This should resolve paketo-buildpacks/nodejs#602, while still conforming to the Secure Runtime RFC requirements.

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@thitch97 thitch97 requested a review from a team as a code owner July 13, 2022 22:44
@thitch97 thitch97 added the semver:patch A change requiring a patch version bump label Jul 13, 2022
@thitch97
Copy link
Contributor Author

It's worth capturing here that Angular apps have been observed to fail on stacks with distinct build and run uids as the CLI attempts to create/modify a cache in /workspace. This can be rectified by setting the cache path in the project's configuration (angular.json).

@ryanmoran
Copy link
Member

ryanmoran commented Jul 13, 2022

The exec.d script is now only run when node_modules is required for both build and launch.

@thitch97 Can you explain this choice? What happens if only launch is specified?

@thitch97
Copy link
Contributor Author

thitch97 commented Jul 14, 2022

Can you explain this choice? What happens if only launch is specified?

@ryanmoran My thinking here is that if the setup-symlinks exec.d script is solely responsible for ensuring that /workspace/node_modules points to /layers/.../launch-modules/node_modules instead of /layers/.../build-modules/node_modules at launch, then there should be no need to run it if only build OR launch is specified. If only launch is specified, for example, /workspace/node_modules will already point to /layers/.../launch-modules/node_modules at runtime (the build-modules layer wouldn't even exist).

@ryanmoran
Copy link
Member

@thitch97 thanks for including that context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch A change requiring a patch version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chmod workspace fails on kpack
2 participants