Upgrade to pants 2.13 and remove sendwave-pants-docker dependency#16
Upgrade to pants 2.13 and remove sendwave-pants-docker dependency#16jeancochrane wants to merge 3 commits intocompyman:mainfrom
Conversation
…favor of first-party backend
As of 2.10, this option is no longer necessary because pants sets it automatically based on the amount of concurrency available in the environment: https://www.pantsbuild.org/v2.10/docs/reference-python#section-resolver-jobs
| @@ -1 +1 @@ | |||
| python_requirements() | |||
| python_requirements(name="reqs") | |||
There was a problem hiding this comment.
I couldn't find this in the changelog, but after updating to 2.13 pants started complaining that names are required for root-level targets:
$ ./pants dependencies ::
14:19:33.73 [ERROR] 1 Exception encountered:
MappingError: Failed to parse ./BUILD:
Targets in root-level BUILD files must be named explicitly.
|
|
||
| * Changelog | ||
| * 1.2.0 | ||
| TBD |
There was a problem hiding this comment.
We can set this when we're ready to cut a release! And if we want to use this PR for the release we can just add it via commit before merging.
| [python] | ||
| # Limit the maximum number of concurrent jobs used to resolve third | ||
| # party dependencies. The max level of parallelism will be | ||
| # `process_execution_local_parallelism x resolver_jobs`, but | ||
| # often you will have one resolve process at a time. | ||
| resolver_jobs = 2 | ||
|
|
There was a problem hiding this comment.
As of 2.10, pants sets the number of concurrent jobs automatically based on the environment: https://www.pantsbuild.org/v2.10/docs/reference-python#section-resolver-jobs
| [docker] | ||
| build_verbose = true |
There was a problem hiding this comment.
This option prints build output to the console (you have to scroll up to see it though):
| @rule | ||
| async def node_project_docker(field_set: NodeProjectFieldSet) -> DockerComponent: | ||
| """Build a node_package target into a DockerComponent. | ||
|
|
||
| This allows files generated by the node process to be included in | ||
| the docker image. | ||
| """ | ||
| package = await Get(Digest, NodeProjectFieldSet, field_set) | ||
| return DockerComponent(sources=package, commands=[]) |
There was a problem hiding this comment.
I spent some time trying to replace this with built-in Docker components, but after deciding to try leaving it out it seems like it works. I think this is probably because the Docker backend builds the context automatically based on the target dependencies but I am not totally sure!
| search_paths = StrListOption( | ||
| "--search-paths", | ||
| default=["/bin", "/usr/bin/"], | ||
| help="Directories in which to search for node binaries.'", | ||
| ) | ||
| use_nvm = BoolOption( | ||
| "--use-nvm", | ||
| default=True, | ||
| help="If true, the value of $NVM_BIN will be " | ||
| "appended to the front of the search path.", | ||
| ) |
There was a problem hiding this comment.
Subsystem.register_options is now deprecated in favor of the more declarative Option syntax: https://github.com/pantsbuild/pants/blob/main/src/python/pants/notes/2.11.x.md#plugin-api-changes-1
| name="docker_with_webpack_bundle", | ||
| instructions=[ | ||
| "FROM python:3.9.1-slim-buster", | ||
| "COPY public /public", |
There was a problem hiding this comment.
I think this is not exactly the same as the previous source inference based on node_package.artifact_paths but it seems like perhaps it gets us where we need to go?
This PR upgrades the plugin to the most recent stable version of pants (2.13).
As of pants 2.10, pants now has first-class support for Docker as a backend, so this PR also removes the dependency on our custom Docker plugin and refactors to use the pants-maintained backend.