-
Notifications
You must be signed in to change notification settings - Fork 810
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
Build: Prepare tooling for Gutenberg extensions in Jetpack #11639
Conversation
.svnignore
Outdated
@@ -42,3 +42,4 @@ docker | |||
bin/pre-commit-hook.js | |||
bin/travis_install.sh | |||
yarn-error.log | |||
extensions/**/*.{js,jsx,json,gif,png,css,jpg,jpeg,sass,scss} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying over #11639 (comment) for visibility:
To help future groking, I'd love for svnignore comments (I believe # preceding the line should work here too) to explain why these files are ignored. Someone new to JP development may be confused why we're ignoring jpg, css, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested by @dereksmart, could we do everything except php
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #11639 (comment):
I'd rather be explicit in svnignore as it can be really surprising. Something works great in GItHub and unless someone tests that explicit feature using a beta that was shipped in SVN we could have a pretty big gap in the production release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
svnignore
is not a real thing. Under the hood, this is relying on shell globbing:
jetpack/tools/build-jetpack.sh
Lines 70 to 75 in f8078c2
for file in $( cat "$TARGET_DIR/.svnignore" 2>/dev/null ); do | |
if [[ $file == "to-test.md" || $file == "docs/testing/testing-tips.md" ]]; then | |
continue | |
fi | |
rm -rf $TARGET_DIR/$file | |
done |
We should be extremely careful and keep that in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need to add the files here too:
jetpack/tools/build-release-branch.sh
Line 53 in 36a8543
# Add custom stuff to .gitignore release |
500 => 'modules/lazy-images/js/lazy-images.js', | ||
501 => 'modules/wpgroho.js', | ||
); | ||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done automatically during the release process.
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: April 2, 2019. |
Where do I check for presence of |
tools/build-release-branch.sh
Outdated
echo "/extensions/**/*.sass" >> .gitignore | ||
echo "/extensions/**/*.scss" >> .gitignore | ||
echo "/extensions/**/*.svg" >> .gitignore | ||
echo "__snapshots__/" >> .gitignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the .gitignore
party, but would a (semi-)whitelist-based approach (i.e. using negation) work? Something like
echo "/extensions/" >> .gitignore
echo "!/extensions/**/*.php" >> .gitignore
See e.g. https://www.atlassian.com/git/tutorials/saving-changes/gitignore#git-ignore-patterns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would likely work, but would be harder to keep in sync with the .svnignore
which is really a list of files to pass to rm -fr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need a .svnignore
again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used in several places around the build/deploy tooling:
jetpack/tools/build-jetpack.sh
Lines 70 to 75 in f8078c2
for file in $( cat "$TARGET_DIR/.svnignore" 2>/dev/null ); do | |
if [[ $file == "to-test.md" || $file == "docs/testing/testing-tips.md" ]]; then | |
continue | |
fi | |
rm -rf $TARGET_DIR/$file | |
done |
jetpack/tools/build-release-branch.sh
Lines 228 to 235 in 58ec303
for file in $( cat "$DIR/.svnignore" 2>/dev/null ); do | |
# We want to commit changes to to-test.md as well as the testing tips. | |
if [[ $file == "to-test.md" || $file == "docs/testing/testing-tips.md" ]] | |
then | |
continue; | |
fi | |
rm -rf TMP_LOCAL_BUILT_VERSION/$file | |
done |
jetpack/tools/deploy-to-master-stable-branch.sh
Lines 67 to 73 in f8078c2
for file in $( cat "$JETPACK_GIT_DIR/.svnignore" 2>/dev/null ); do | |
# We want to commit changes to to-test.md as well as the testing tips. | |
if [ $file == "to-test.md" || $file == "docs/testing/testing-tips.md" ]; then | |
continue; | |
fi | |
rm -rf $JETPACK_TMP_DIR_2/$file | |
done |
jetpack/tools/deploy-to-svn.sh
Lines 72 to 74 in cadfa61
for file in $( cat "$JETPACK_GIT_DIR/.svnignore" 2>/dev/null ); do | |
rm -rf $JETPACK_SVN_DIR/trunk/$file | |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but I wonder if we could de-dupe sources of truth (i.e. use .gitifnore
where we're now using .svnignore
) in the long run... 🤔
tools/build-release-branch.sh
Outdated
|
||
git rm -r --cached . | ||
git add . | ||
git commit -m ".gitignore cleanup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make the commit msg more explicit here? Like Remove files based on .gitignore contents
?
tools/build-release-branch.sh
Outdated
modify_svnignore | ||
|
||
git rm -r --cached . | ||
git add . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this line? Not seeing anything added by that commit 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic here is
- Remove everything
- Add everything (respecting our new .gitignore)
This is the way we're able to filter out versioned files that are newly added to the gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few minor (non-blocking) suggestions. Overall, this is looking great and working well AFAICT!
🚢 at will!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this appears to work for now, I have some reservations about the latest changes; they can potentially be dangerous in that you can end up committing things you did not mean to.
I've added fdaeab9 and 327218f to address the latest review. |
After a call with @kraftbj and @dereksmart representing @Automattic/jetpack-crew, I've rolled back the changes that were intended to remove many files from extensions in release branches. Part of the reasoning is that other unbuilt source is already included in release branches so including source in beta branches is not a regression and not something that needs to be addressed in this PR. Thanks everyone, reviews appreciated 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work as described and expected 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm cautious about the additions in .svnignore
and wanting to make sure they work as expected, so this will be an area of heavy testing in the next couple of days.
Adds files from Jetpack Gutenberg extensions folder (about to be merged in #11633) to ignore lists relevant for the packaged version of the plugin.
Changes proposed in this Pull Request:
Testing instructions:
Together with #11633 (
git merge --squash --no-commit origin/add/jetpack-blocks-src
) — does the build ignore assets in/extensions/*
but still sees*.php
files?yarn build-production
php bin/build-asset-cdn-json.php
An alternative way of testing this would be to:
git merge --squash --no-commit origin/add/jetpack-blocks-src
jetpack/tools/build-release-branch.sh
Line 102 in e450f01
You can apply this patch:
https://gist.github.com/sirreal/2245987078998c2b6b9f95ba45d93d61#file-tooling-patch
git add -A && git commit -am 'DROPME: testing changes'
)tools/build-release-branch.sh -n
.gitignore
should include the new lines.Proposed changelog entry for your changes: