-
Notifications
You must be signed in to change notification settings - Fork 805
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
Adding a docker-based dev env #40934
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
This comment was marked as outdated.
This comment was marked as outdated.
…unless specified to the dev container, like build-image
1be7f76
to
4391224
Compare
1541a10
to
4391224
Compare
…in the docker/data dir
…ther other containers
I wanted to test this from a fresh computer, so I tried to start from a computer running Ubuntu, where nothing was installed yet. Unfortunately, I run into an error when I run
I'm not sure what's causing this, and I'm not familiar enough with Ubuntu to debug this I'm afraid. |
…up, down, stop, clean
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.
Gave it a quick once-over.
In addition to testing on my two production Apple Silicon (M1, M2) devices, I tested it on a clear Intel Mac using |
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.
Other than all the doc changes to point at the new jp
command and hide jetpack
, I don't see anything that will impact use of jetpack
anymore at a quick read-through.
…ink} commands within monorepo env
This reverts commit 4a74468.
Random thought: Would it be more or less confusing to also name this tool
|
TBH, my original thought was this would be the "new" But I didn't move on that to try not to add too many areas that could break things at once -- as in, today in theory, you can use one or the other. If you use "existing" tl;dr: I'm open to this becoming the |
@anomiex Would you mind reviewing this for merging with the blocking criteria being things that would break the existing I would say the |
Personally I'd rather keep using the existing non-Docker |
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 inline suggestions, but from the perspective of "shouldn't break existing monorepo stuff" this LGTM. The suggestions could even be left for a followup.
@@ -1,5 +1,6 @@ | |||
packages: | |||
- 'projects/*/*' | |||
- '!projects/js-packages/jetpack-cli' |
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.
🤔 Interesting...
This means it won't be runnable directly from a monorepo checkout. But maybe you could somehow point npm -g
at the monorepo checkout as a source when testing?
And hopefully eslint doesn't get confused by missing imports, although I suppose we could probably just disable the relevant rules.
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.
Nod, with having it in the workspace, pnpm cli-setup
would pick up on it and globally link jp
to the copy in that monorepo. Then, when you nerf node_modules
(or delete that checkout totally) and want to use jp init
to start again, no joy.
It might be something we can adjust in another way, but if we keep jp
to be relatively stable (most everything it does fires code within the monorepo's pnpm install), it might not be horrible to have it be annoying to test changes within the monorepo? Or, you can npm install
within the projects/js-packages/jetpack-cli
dir and run node projects/js-packages/jetpack-cli/bin/jp.js [cmd]
(how I did most of my testing).
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 wasn't too worried about the potential difficulty in testing. But documenting how to test it in the js-package's README.md might be a good idea.
"test-js": [ | ||
"echo 'no tests yet'" | ||
] |
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.
Probably no tests ever, since installing jest
won't be possible with it being excluded from pnpm-workspace.yaml
.
In which case, again, deleting this so CI will be able to skip it entirely might be good.
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.
Might be worth deleting this placeholder file.
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.
Might be worth deleting this placeholder file.
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.
As mentioned above, with this project being excluded from pnpm-workspace.yaml
, you won't be able to have jest
installed so having a jest
config is probably useless.
Thanks! I'll clean up those placeholders in the next PR. |
#40934 (comment) above discusses it. In short: If we rename this But doing all that at once seems risky, so let's take it in some steps. |
Two things that are on my mind:
I'm going to write a p2 post today to announce is as a public beta asking a12s to let us know anything unexpected about it. I haven't tried every |
Testing moving development commands to within docker to avoid local variances or require specific versions of things to be installed locally.
Proposed changes:
Other information:
Jetpack product discussion
None yet.
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
Testing the new CLI
wordpress
container can't reachwordpress.org
, haven't dug into that]. Restart Docker if applicable.npm i -g @automattic/jetpack-cli
cd /tmp
(or somewhere else without Jetpack)jp -v
(confirm it is installed, 1.0.0-beta1 is the current version)jp --help
-- it should report it can't find a monorepo checkout and invite you to usejp init
jp init
-- follow promptscd jetpack
(or whatever dir)git checkout try/dev-in-docker
to get on this branch.jp --help
-- this should pull the new dev container (I manually pushed it to docker hub for the sake of testing)jp build plugins/jetpack --with-deps
(does it work?)jp docker up -d
-- the CLI output will not be the expected "visit localhost". it'll say it's done before it's ready (need to fix).localhost
ensure it is the WP install.jp docker install
-- should run the usual install process, localhost should show a regular site.jp docker down
Testing the existing setup.
jetpack
commands work.jetpack --help
,jetpack build plugins/jetpack --with-deps
jetpack docker up -d
node_modules
dir. If you want to go back and forth between the two, you'll need to nuke thenode_modules
each time you switch.Does everything still work as expected? If not, does clearing the docker containers/images resolve it? Please note that.
The intent of the PR as this point is create a new, rough, beta way to dev within docker without impacting the existing
jetpack
commands running locally for devs who have things working. I hope to quickly iterate to the dev-in-docker is a reliable way for anyone to jump into, but the local way of doing it should still work too (and for the foreseeable future).Known issue: Git Hooks do not work on a fresh install using only
jp
for dev. It'll commit, push, etc without running the hooks.