mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-07 10:04:03 +00:00
Move tagging/utils/config to tagging/apps/config
This commit is contained in:
@@ -6,7 +6,7 @@ import logging
|
||||
import plumbum
|
||||
|
||||
from tagging.apps.common_cli_arguments import common_arguments_parser
|
||||
from tagging.utils.config import Config
|
||||
from tagging.apps.config import Config
|
||||
from tagging.utils.get_prefix import get_file_prefix_for_platform
|
||||
|
||||
docker = plumbum.local["docker"]
|
||||
|
@@ -3,7 +3,7 @@
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from tagging.utils.config import Config
|
||||
from tagging.apps.config import Config
|
||||
from tagging.utils.get_platform import unify_aarch64
|
||||
|
||||
|
||||
|
@@ -6,7 +6,7 @@ import logging
|
||||
import plumbum
|
||||
|
||||
from tagging.apps.common_cli_arguments import common_arguments_parser
|
||||
from tagging.utils.config import Config
|
||||
from tagging.apps.config import Config
|
||||
from tagging.utils.get_platform import ALL_PLATFORMS
|
||||
from tagging.utils.get_prefix import get_file_prefix_for_platform
|
||||
|
||||
|
@@ -7,10 +7,10 @@ import logging
|
||||
from docker.models.containers import Container
|
||||
|
||||
from tagging.apps.common_cli_arguments import common_arguments_parser
|
||||
from tagging.apps.config import Config
|
||||
from tagging.hierarchy.get_manifests import get_manifests
|
||||
from tagging.hierarchy.get_taggers import get_taggers
|
||||
from tagging.manifests.build_info import BuildInfo
|
||||
from tagging.utils.config import Config
|
||||
from tagging.manifests.build_info import BuildInfo, BuildInfoConfig
|
||||
from tagging.utils.docker_runner import DockerRunner
|
||||
from tagging.utils.get_prefix import get_file_prefix, get_tag_prefix
|
||||
from tagging.utils.git_helper import GitHelper
|
||||
@@ -67,9 +67,17 @@ def get_manifest(config: Config, commit_hash_tag: str, container: Container) ->
|
||||
manifest_names = [manifest.__class__.__name__ for manifest in manifests]
|
||||
LOGGER.info(f"Using manifests: {manifest_names}")
|
||||
|
||||
build_info_config = BuildInfoConfig(
|
||||
registry=config.registry,
|
||||
owner=config.owner,
|
||||
image=config.image,
|
||||
repository=config.repository,
|
||||
build_timestamp=BUILD_TIMESTAMP,
|
||||
)
|
||||
|
||||
markdown_pieces = [
|
||||
f"# Build manifest for image: {config.image}:{commit_hash_tag}",
|
||||
BuildInfo.markdown_piece(config, BUILD_TIMESTAMP).get_str(),
|
||||
BuildInfo.markdown_piece(build_info_config).get_str(),
|
||||
*(manifest.markdown_piece(container).get_str() for manifest in manifests),
|
||||
]
|
||||
markdown_content = "\n\n".join(markdown_pieces) + "\n"
|
||||
|
@@ -4,8 +4,8 @@
|
||||
import logging
|
||||
|
||||
from tagging.apps.common_cli_arguments import common_arguments_parser
|
||||
from tagging.apps.config import Config
|
||||
from tagging.hierarchy.get_taggers import get_taggers
|
||||
from tagging.utils.config import Config
|
||||
from tagging.utils.docker_runner import DockerRunner
|
||||
from tagging.utils.get_prefix import get_file_prefix, get_tag_prefix
|
||||
|
||||
|
@@ -1,21 +1,35 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
import textwrap
|
||||
from dataclasses import dataclass
|
||||
|
||||
import plumbum
|
||||
|
||||
from tagging.manifests.manifest_interface import MarkdownPiece
|
||||
from tagging.utils.config import Config
|
||||
from tagging.utils.git_helper import GitHelper
|
||||
|
||||
docker = plumbum.local["docker"]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BuildInfoConfig:
|
||||
registry: str
|
||||
owner: str
|
||||
image: str
|
||||
|
||||
repository: str
|
||||
|
||||
build_timestamp: str
|
||||
|
||||
def full_image(self) -> str:
|
||||
return f"{self.registry}/{self.owner}/{self.image}"
|
||||
|
||||
|
||||
class BuildInfo:
|
||||
"""BuildInfo doesn't fall under common interface, and we run it separately"""
|
||||
|
||||
@staticmethod
|
||||
def markdown_piece(config: Config, build_timestamp: str) -> MarkdownPiece:
|
||||
def markdown_piece(config: BuildInfoConfig) -> MarkdownPiece:
|
||||
commit_hash = GitHelper.commit_hash()
|
||||
commit_hash_tag = GitHelper.commit_hash_tag()
|
||||
commit_message = GitHelper.commit_message()
|
||||
@@ -32,7 +46,7 @@ class BuildInfo:
|
||||
|
||||
build_info = textwrap.dedent(
|
||||
f"""\
|
||||
- Build timestamp: {build_timestamp}
|
||||
- Build timestamp: {config.build_timestamp}
|
||||
- Docker image: `{config.full_image()}:{commit_hash_tag}`
|
||||
- Docker image size: {image_size}
|
||||
- Git commit SHA: [{commit_hash}](https://github.com/{config.repository}/commit/{commit_hash})
|
||||
|
Reference in New Issue
Block a user