mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-05 23:20:40 +00:00
Merge branch 'master' into nightly
This commit is contained in:
commit
c152578783
@ -3,6 +3,8 @@
|
|||||||
Note: Breaking changes between versions are indicated by "💥".
|
Note: Breaking changes between versions are indicated by "💥".
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- 💥[Improvement] Fail on incorrect image name argument in `images build/pull/push/printtag` commands.
|
||||||
- [Bugfix] Remove trailing slashes in docker-compose files for [compatibility with docker-compose v2 in WSL](https://github.com/docker/compose/issues/8558).
|
- [Bugfix] Remove trailing slashes in docker-compose files for [compatibility with docker-compose v2 in WSL](https://github.com/docker/compose/issues/8558).
|
||||||
- [Improvement] `settheme` now works with preview domain.
|
- [Improvement] `settheme` now works with preview domain.
|
||||||
- [Feature] Allow specifying extra pip packages through config.yml.
|
- [Feature] Allow specifying extra pip packages through config.yml.
|
||||||
|
@ -108,35 +108,64 @@ def push(context: Context, image_names: List[str]) -> None:
|
|||||||
def printtag(context: Context, image_names: List[str]) -> None:
|
def printtag(context: Context, image_names: List[str]) -> None:
|
||||||
config = tutor_config.load(context.root)
|
config = tutor_config.load(context.root)
|
||||||
for image in image_names:
|
for image in image_names:
|
||||||
|
to_print = []
|
||||||
for _img, tag in iter_images(config, image, BASE_IMAGE_NAMES):
|
for _img, tag in iter_images(config, image, BASE_IMAGE_NAMES):
|
||||||
print(tag)
|
to_print.append(tag)
|
||||||
for _plugin, _img, tag in iter_plugin_images(config, image, "build-image"):
|
for _plugin, _img, tag in iter_plugin_images(config, image, "build-image"):
|
||||||
|
to_print.append(tag)
|
||||||
|
|
||||||
|
if not to_print:
|
||||||
|
raise ImageNotFoundError(image)
|
||||||
|
|
||||||
|
for tag in to_print:
|
||||||
print(tag)
|
print(tag)
|
||||||
|
|
||||||
|
|
||||||
def build_image(root: str, config: Config, image: str, *args: str) -> None:
|
def build_image(root: str, config: Config, image: str, *args: str) -> None:
|
||||||
|
to_build = []
|
||||||
|
|
||||||
# Build base images
|
# Build base images
|
||||||
for img, tag in iter_images(config, image, BASE_IMAGE_NAMES):
|
for img, tag in iter_images(config, image, BASE_IMAGE_NAMES):
|
||||||
images.build(tutor_env.pathjoin(root, "build", img), tag, *args)
|
to_build.append((tutor_env.pathjoin(root, "build", img), tag, args))
|
||||||
|
|
||||||
# Build plugin images
|
# Build plugin images
|
||||||
for plugin, img, tag in iter_plugin_images(config, image, "build-image"):
|
for plugin, img, tag in iter_plugin_images(config, image, "build-image"):
|
||||||
images.build(
|
to_build.append(
|
||||||
tutor_env.pathjoin(root, "plugins", plugin, "build", img), tag, *args
|
(tutor_env.pathjoin(root, "plugins", plugin, "build", img), tag, args)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not to_build:
|
||||||
|
raise ImageNotFoundError(image)
|
||||||
|
|
||||||
|
for path, tag, build_args in to_build:
|
||||||
|
images.build(path, tag, *args)
|
||||||
|
|
||||||
|
|
||||||
def pull_image(config: Config, image: str) -> None:
|
def pull_image(config: Config, image: str) -> None:
|
||||||
|
to_pull = []
|
||||||
for _img, tag in iter_images(config, image, all_image_names(config)):
|
for _img, tag in iter_images(config, image, all_image_names(config)):
|
||||||
images.pull(tag)
|
to_pull.append(tag)
|
||||||
for _plugin, _img, tag in iter_plugin_images(config, image, "remote-image"):
|
for _plugin, _img, tag in iter_plugin_images(config, image, "remote-image"):
|
||||||
|
to_pull.append(tag)
|
||||||
|
|
||||||
|
if not to_pull:
|
||||||
|
raise ImageNotFoundError(image)
|
||||||
|
|
||||||
|
for tag in to_pull:
|
||||||
images.pull(tag)
|
images.pull(tag)
|
||||||
|
|
||||||
|
|
||||||
def push_image(config: Config, image: str) -> None:
|
def push_image(config: Config, image: str) -> None:
|
||||||
|
to_push = []
|
||||||
for _img, tag in iter_images(config, image, BASE_IMAGE_NAMES):
|
for _img, tag in iter_images(config, image, BASE_IMAGE_NAMES):
|
||||||
images.push(tag)
|
to_push.append(tag)
|
||||||
for _plugin, _img, tag in iter_plugin_images(config, image, "remote-image"):
|
for _plugin, _img, tag in iter_plugin_images(config, image, "remote-image"):
|
||||||
|
to_push.append(tag)
|
||||||
|
|
||||||
|
if not to_push:
|
||||||
|
raise ImageNotFoundError(image)
|
||||||
|
|
||||||
|
for tag in to_push:
|
||||||
images.push(tag)
|
images.push(tag)
|
||||||
|
|
||||||
|
|
||||||
@ -177,6 +206,11 @@ def vendor_image_names(config: Config) -> List[str]:
|
|||||||
return vendor_images
|
return vendor_images
|
||||||
|
|
||||||
|
|
||||||
|
class ImageNotFoundError(exceptions.TutorError):
|
||||||
|
def __init__(self, image_name: str):
|
||||||
|
super().__init__("Image '{}' could not be found".format(image_name))
|
||||||
|
|
||||||
|
|
||||||
images_command.add_command(build)
|
images_command.add_command(build)
|
||||||
images_command.add_command(pull)
|
images_command.add_command(pull)
|
||||||
images_command.add_command(push)
|
images_command.add_command(push)
|
||||||
|
Loading…
Reference in New Issue
Block a user