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

fix: invalidate installed npm repositories correctly (#1200) #1205

Merged

Conversation

JaredNeil
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #1200

What is the new behavior?

Repository is always copied when lock file changes.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information


bzlFile += `def install_${workspace}():
_maybe(
copy_repository,
name = "${workspace}",
marker_file = "@${WORKSPACE}//_workspaces/${workspace}:_bazel_workspace_marker",
# Ensure that changes to the node_modules cause the copy to re-execute
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this doesn't actually work, so we need to force it by including the hash of the lock file.

Copy link
Collaborator

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JaredNeil. This looks like a good fix. I wonder if something has changed in Bazel as the lock_file attribute worked 7 months ago when @alexeagle added it to fix the same issue.

Can you rebase to head? This will fix the examples/worker CI failure as it was missing the yarn.lock file which is now checked in.

Can you also remove the now unused lock_file attribute in internal/copy_repository/copy_repository.bzl?

Copy link
Collaborator

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gregmagolan
Copy link
Collaborator

Fixes #1200

@alexeagle
Copy link
Collaborator

Awesome thank you!! This was a nasty bug

@alexeagle alexeagle merged commit 0312800 into bazel-contrib:master Oct 2, 2019
Toxicable pushed a commit to Toxicable/rules_nodejs that referenced this pull request Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants