-
-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In order to keep the BUILD files DRY, support picking up the Docker image version to be built, from other sources rather than require a hard coded value in the BUILD file. First up is support for looking at the `Dockerfile` FROM commands to glean possible version tags from them. Example: ```python docker_image(name="myimage", version="{baseimage.tag}") ``` ```Dockerfile FROM upstream:1.2-feat ... ``` This would then produce `myimage:1.2-feat`. As more format strings are introduced, so is the potential for users to shot them selves in the foot. So I've added some improved error feedback in case the version or image name template format strings blow up, that should help pinpoint the mistake and present possible solutions. ```python docker_image( name="test-example", version="1.2.5-{typo}", dependencies=["testprojects/src/python/hello/main"], ) ``` ```shell $ ./pants --no-print-stacktrace package testprojects/src/python/docker:test-example 12:09:17.29 [INFO] Initialization options changed: reinitializing scheduler... 12:09:17.99 [INFO] Scheduler initialized. 12:09:22.38 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError) [...] pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered: DockerBuildError: Error in testprojects/src/python/docker:test-example: Invalid format string for the `docker_image(version)` field: '1.2.5-{typo}'. The key 'typo' is unknown. Try with one of: baseimage, stage0. ``` [ci skip-rust] [ci skip-build-wheels]
- Loading branch information
Showing
8 changed files
with
314 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.