mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-07 10:04:03 +00:00
Write correct manifests in forks
This commit is contained in:
@@ -101,6 +101,7 @@ jobs:
|
||||
--variant ${{ inputs.variant }}
|
||||
--hist-lines-dir /tmp/jupyter/hist_lines/
|
||||
--manifests-dir /tmp/jupyter/manifests/
|
||||
--repository ${{ github.repository }}
|
||||
shell: bash
|
||||
- name: Upload manifest file 💾
|
||||
uses: actions/upload-artifact@v4
|
||||
|
4
Makefile
4
Makefile
@@ -77,6 +77,7 @@ linkcheck-docs: ## check broken links
|
||||
|
||||
|
||||
hook/%: VARIANT?=default
|
||||
hook/%: REPOSITORY?=$(OWNER)/docker-stacks
|
||||
hook/%: ## run post-build hooks for an image
|
||||
python3 -m tagging.apps.write_tags_file \
|
||||
--registry "$(REGISTRY)" \
|
||||
@@ -90,7 +91,8 @@ hook/%: ## run post-build hooks for an image
|
||||
--short-image-name "$(notdir $@)" \
|
||||
--variant "$(VARIANT)" \
|
||||
--hist-lines-dir /tmp/jupyter/hist_lines/ \
|
||||
--manifests-dir /tmp/jupyter/manifests/
|
||||
--manifests-dir /tmp/jupyter/manifests/ \
|
||||
--repository "$(REPOSITORY)"
|
||||
python3 -m tagging.apps.apply_tags \
|
||||
--registry "$(REGISTRY)" \
|
||||
--owner "$(OWNER)" \
|
||||
|
@@ -32,6 +32,7 @@ def write_build_history_line(
|
||||
hist_lines_dir: Path,
|
||||
filename: str,
|
||||
all_tags: list[str],
|
||||
repository: str,
|
||||
) -> None:
|
||||
LOGGER.info("Appending build history line")
|
||||
|
||||
@@ -42,8 +43,8 @@ def write_build_history_line(
|
||||
commit_hash = GitHelper.commit_hash()
|
||||
links_column = MARKDOWN_LINE_BREAK.join(
|
||||
[
|
||||
f"[Git diff](https://github.com/jupyter/docker-stacks/commit/{commit_hash})",
|
||||
f"[Dockerfile](https://github.com/jupyter/docker-stacks/blob/{commit_hash}/images/{short_image_name}/Dockerfile)",
|
||||
f"[Git diff](https://github.com/{repository}/commit/{commit_hash})",
|
||||
f"[Dockerfile](https://github.com/{repository}/blob/{commit_hash}/images/{short_image_name}/Dockerfile)",
|
||||
f"[Build manifest](./{filename})",
|
||||
]
|
||||
)
|
||||
@@ -61,12 +62,19 @@ def write_manifest_file(
|
||||
filename: str,
|
||||
manifests: list[ManifestInterface],
|
||||
container: Container,
|
||||
repository: str,
|
||||
) -> None:
|
||||
manifest_names = [manifest.__class__.__name__ for manifest in manifests]
|
||||
LOGGER.info(f"Using manifests: {manifest_names}")
|
||||
|
||||
markdown_pieces = [
|
||||
ManifestHeader.create_header(short_image_name, registry, owner, BUILD_TIMESTAMP)
|
||||
ManifestHeader.create_header(
|
||||
registry=registry,
|
||||
owner=owner,
|
||||
short_image_name=short_image_name,
|
||||
build_timestamp=BUILD_TIMESTAMP,
|
||||
repository=repository,
|
||||
)
|
||||
] + [manifest.markdown_piece(container) for manifest in manifests]
|
||||
markdown_content = "\n\n".join(markdown_pieces) + "\n"
|
||||
|
||||
@@ -82,6 +90,7 @@ def write_manifest(
|
||||
variant: str,
|
||||
hist_lines_dir: Path,
|
||||
manifests_dir: Path,
|
||||
repository: str,
|
||||
) -> None:
|
||||
LOGGER.info(f"Creating manifests for image: {short_image_name}")
|
||||
taggers, manifests = get_taggers_and_manifests(short_image_name)
|
||||
@@ -104,6 +113,7 @@ def write_manifest(
|
||||
hist_lines_dir=hist_lines_dir,
|
||||
filename=filename,
|
||||
all_tags=all_tags,
|
||||
repository=repository,
|
||||
)
|
||||
write_manifest_file(
|
||||
registry=registry,
|
||||
@@ -113,6 +123,7 @@ def write_manifest(
|
||||
filename=filename,
|
||||
manifests=manifests,
|
||||
container=container,
|
||||
repository=repository,
|
||||
)
|
||||
|
||||
|
||||
@@ -127,6 +138,11 @@ if __name__ == "__main__":
|
||||
hist_lines_dir=True,
|
||||
manifests_dir=True,
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--repository",
|
||||
required=True,
|
||||
help="Repository name on GitHub",
|
||||
)
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
LOGGER.info(f"Current build timestamp: {BUILD_TIMESTAMP}")
|
||||
|
@@ -12,7 +12,11 @@ class ManifestHeader:
|
||||
|
||||
@staticmethod
|
||||
def create_header(
|
||||
short_image_name: str, registry: str, owner: str, build_timestamp: str
|
||||
registry: str,
|
||||
owner: str,
|
||||
short_image_name: str,
|
||||
build_timestamp: str,
|
||||
repository: str,
|
||||
) -> str:
|
||||
commit_hash = GitHelper.commit_hash()
|
||||
commit_hash_tag = GitHelper.commit_hash_tag()
|
||||
@@ -36,7 +40,7 @@ class ManifestHeader:
|
||||
- Build timestamp: {build_timestamp}
|
||||
- Docker image: `{registry}/{owner}/{short_image_name}:{commit_hash_tag}`
|
||||
- Docker image size: {image_size}
|
||||
- Git commit SHA: [{commit_hash}](https://github.com/jupyter/docker-stacks/commit/{commit_hash})
|
||||
- Git commit SHA: [{commit_hash}](https://github.com/{repository}/commit/{commit_hash})
|
||||
- Git commit message:
|
||||
|
||||
```text
|
||||
|
Reference in New Issue
Block a user