7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-07 00:20:49 +00:00

Add images build --pull option to pull base images on build

This will be useful in CI, where we want to automatically update base
images as soon as a security fix comes out.
This commit is contained in:
Régis Behmo 2021-03-17 16:02:46 +01:00
parent b8394471ec
commit 914dbc53be
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Feature] Add `images build --pull` option to update base images.
- [Improvement] Annotate types all over the Tutor code base.
- [Bugfix] Fix parsing of YAML CLI arguments that include equal "=" signs.
- [Bugfix] Fix minor edge case in `long_to_base64` utility function.

View File

@ -52,6 +52,12 @@ def images_command() -> None:
"--target",
help="Set the target build stage to build.",
)
@click.option(
"--pull",
"pull_base_images",
is_flag=True,
help="Always attempt to pull a newer version of the base images",
)
@click.pass_obj
def build(
context: Context,
@ -60,6 +66,7 @@ def build(
build_args: List[str],
add_hosts: List[str],
target: str,
pull_base_images: bool,
) -> None:
config = tutor_config.load(context.root)
command_args = []
@ -71,6 +78,8 @@ def build(
command_args += ["--add-host", add_host]
if target:
command_args += ["--target", target]
if pull_base_images:
command_args.append("--pull")
for image in image_names:
build_image(context.root, config, image, *command_args)