mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-10 19:42:58 +00:00
Properly generate wiki home page in forks (#2226)
* Properly generate wiki home page in forks * Better description
This commit is contained in:
3
.github/workflows/docker-wiki-update.yml
vendored
3
.github/workflows/docker-wiki-update.yml
vendored
@@ -3,7 +3,7 @@ name: Download build manifests from GitHub artifacts and push them to GitHub wik
|
|||||||
# This way we make sure we don't access wiki pages from several jobs simultaneously
|
# This way we make sure we don't access wiki pages from several jobs simultaneously
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PUSH_TO_REGISTRY: ${{ (github.repository_owner == 'jupyter' || github.repository_owner == 'mathbunnyru') && (github.ref == 'refs/heads/main' || github.event_name == 'schedule') }}
|
PUSH_TO_REGISTRY: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
@@ -44,6 +44,7 @@ jobs:
|
|||||||
--wiki-dir wiki/
|
--wiki-dir wiki/
|
||||||
--hist-lines-dir /tmp/jupyter/hist_lines/
|
--hist-lines-dir /tmp/jupyter/hist_lines/
|
||||||
--manifests-dir /tmp/jupyter/manifests/
|
--manifests-dir /tmp/jupyter/manifests/
|
||||||
|
--repository ${{ github.repository }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Push Wiki to GitHub 📤
|
- name: Push Wiki to GitHub 📤
|
||||||
|
8
.github/workflows/docker.yml
vendored
8
.github/workflows/docker.yml
vendored
@@ -463,7 +463,7 @@ jobs:
|
|||||||
- image: pytorch-notebook
|
- image: pytorch-notebook
|
||||||
variant: cuda12
|
variant: cuda12
|
||||||
needs: [aarch64-images-tag-push, x86_64-images-tag-push]
|
needs: [aarch64-images-tag-push, x86_64-images-tag-push]
|
||||||
if: (github.repository_owner == 'jupyter' || github.repository_owner == 'mathbunnyru') && !contains(github.event.pull_request.title, '[FAST_BUILD]')
|
if: ${{ !contains(github.event.pull_request.title, '[FAST_BUILD]') }}
|
||||||
|
|
||||||
merge-tags-fast:
|
merge-tags-fast:
|
||||||
uses: ./.github/workflows/docker-merge-tags.yml
|
uses: ./.github/workflows/docker-merge-tags.yml
|
||||||
@@ -478,19 +478,19 @@ jobs:
|
|||||||
image: [docker-stacks-foundation, base-notebook]
|
image: [docker-stacks-foundation, base-notebook]
|
||||||
variant: [default]
|
variant: [default]
|
||||||
needs: [aarch64-images-tag-push-fast, x86_64-images-tag-push-fast]
|
needs: [aarch64-images-tag-push-fast, x86_64-images-tag-push-fast]
|
||||||
if: (github.repository_owner == 'jupyter' || github.repository_owner == 'mathbunnyru') && contains(github.event.pull_request.title, '[FAST_BUILD]')
|
if: contains(github.event.pull_request.title, '[FAST_BUILD]')
|
||||||
|
|
||||||
wiki-update:
|
wiki-update:
|
||||||
uses: ./.github/workflows/docker-wiki-update.yml
|
uses: ./.github/workflows/docker-wiki-update.yml
|
||||||
needs: [aarch64-images-tag-push, x86_64-images-tag-push]
|
needs: [aarch64-images-tag-push, x86_64-images-tag-push]
|
||||||
if: github.repository_owner == 'jupyter' && !contains(github.event.pull_request.title, '[FAST_BUILD]')
|
if: ${{ !contains(github.event.pull_request.title, '[FAST_BUILD]') }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
wiki-update-fast:
|
wiki-update-fast:
|
||||||
uses: ./.github/workflows/docker-wiki-update.yml
|
uses: ./.github/workflows/docker-wiki-update.yml
|
||||||
needs: [aarch64-images-tag-push-fast, x86_64-images-tag-push-fast]
|
needs: [aarch64-images-tag-push-fast, x86_64-images-tag-push-fast]
|
||||||
if: github.repository_owner == 'jupyter' && contains(github.event.pull_request.title, '[FAST_BUILD]')
|
if: contains(github.event.pull_request.title, '[FAST_BUILD]')
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
|
27
tagging/Home.md
Normal file
27
tagging/Home.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Jupyter Docker Stacks build manifests
|
||||||
|
|
||||||
|
<!-- Note: this file is copied to wiki from the main repo, edits on wiki page will be overridden -->
|
||||||
|
|
||||||
|
Welcome!
|
||||||
|
Please see [the documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/) for help with
|
||||||
|
using, contributing to, and maintaining the Jupyter Docker stacks images.
|
||||||
|
|
||||||
|
## Build History
|
||||||
|
|
||||||
|
This is an auto-generated index of information from the build system.
|
||||||
|
In this index, you can find image tags, links to commits, and build manifests that describe the image.
|
||||||
|
All the builds are grouped by year and then month.
|
||||||
|
|
||||||
|
Note: we only store the last 4500 manifest files because of GitHub limits.
|
||||||
|
That's why old manifest files might not be available.
|
||||||
|
If you want to clone this repo and access the Git history, use the following command: `git clone git@github.com:{REPOSITORY}.wiki.git`
|
||||||
|
|
||||||
|
In the tables below, each line represents:
|
||||||
|
|
||||||
|
- `YYYY-MM`: link to a page with a list of images built
|
||||||
|
- `Builds`: # of times build workflow finished
|
||||||
|
- `Images`: # of single platform images pushed
|
||||||
|
- `Commits`: # of commits made and a GitHub link
|
||||||
|
|
||||||
|
<!-- Everything below is auto-generated, all manual changes will be erased -->
|
||||||
|
<!-- YEAR_MONTHLY_TABLES -->
|
@@ -13,6 +13,7 @@ from dateutil import relativedelta
|
|||||||
git = plumbum.local["git"]
|
git = plumbum.local["git"]
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
THIS_DIR = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
def calculate_monthly_stat(
|
def calculate_monthly_stat(
|
||||||
@@ -46,16 +47,16 @@ def calculate_monthly_stat(
|
|||||||
return builds, images, commits
|
return builds, images, commits
|
||||||
|
|
||||||
|
|
||||||
def regenerate_home_wiki_page(wiki_dir: Path) -> None:
|
def generate_home_wiki_page(wiki_dir: Path, repository: str) -> None:
|
||||||
YEAR_MONTHLY_TABLES = "<!-- YEAR_MONTHLY_TABLES -->\n"
|
YEAR_MONTHLY_TABLES = "<!-- YEAR_MONTHLY_TABLES -->\n"
|
||||||
|
|
||||||
wiki_home_file = wiki_dir / "Home.md"
|
wiki_home_content = (THIS_DIR / "Home.md").read_text()
|
||||||
wiki_home_content = wiki_home_file.read_text()
|
|
||||||
|
|
||||||
assert YEAR_MONTHLY_TABLES in wiki_home_content
|
assert YEAR_MONTHLY_TABLES in wiki_home_content
|
||||||
wiki_home_content = wiki_home_content[
|
wiki_home_content = wiki_home_content[
|
||||||
: wiki_home_content.find(YEAR_MONTHLY_TABLES) + len(YEAR_MONTHLY_TABLES)
|
: wiki_home_content.find(YEAR_MONTHLY_TABLES) + len(YEAR_MONTHLY_TABLES)
|
||||||
]
|
]
|
||||||
|
wiki_home_content = wiki_home_content.format(REPOSITORY=repository)
|
||||||
|
|
||||||
YEAR_TABLE_HEADER = """\
|
YEAR_TABLE_HEADER = """\
|
||||||
## {year}
|
## {year}
|
||||||
@@ -65,7 +66,7 @@ def regenerate_home_wiki_page(wiki_dir: Path) -> None:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
GITHUB_COMMITS_URL = (
|
GITHUB_COMMITS_URL = (
|
||||||
"[{}](https://github.com/jupyter/docker-stacks/commits/main/?since={}&until={})"
|
f"[{{}}](https://github.com/{repository}/commits/main/?since={{}}&until={{}})"
|
||||||
)
|
)
|
||||||
|
|
||||||
for year_dir in sorted((wiki_dir / "monthly-files").glob("*"), reverse=True):
|
for year_dir in sorted((wiki_dir / "monthly-files").glob("*"), reverse=True):
|
||||||
@@ -95,7 +96,7 @@ def regenerate_home_wiki_page(wiki_dir: Path) -> None:
|
|||||||
year_total_line = f"| **Total** | {year_builds: <6} | {year_images: <6} | {year_commits_url: <95} |\n"
|
year_total_line = f"| **Total** | {year_builds: <6} | {year_images: <6} | {year_commits_url: <95} |\n"
|
||||||
wiki_home_content += year_total_line
|
wiki_home_content += year_total_line
|
||||||
|
|
||||||
wiki_home_file.write_text(wiki_home_content)
|
(wiki_dir / "Home.md").write_text(wiki_home_content)
|
||||||
LOGGER.info("Updated Home page")
|
LOGGER.info("Updated Home page")
|
||||||
|
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ def update_wiki(
|
|||||||
wiki_dir: Path,
|
wiki_dir: Path,
|
||||||
hist_lines_dir: Path,
|
hist_lines_dir: Path,
|
||||||
manifests_dir: Path,
|
manifests_dir: Path,
|
||||||
|
repository: str,
|
||||||
allow_no_files: bool,
|
allow_no_files: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
LOGGER.info("Updating wiki")
|
LOGGER.info("Updating wiki")
|
||||||
@@ -185,7 +187,7 @@ def update_wiki(
|
|||||||
year_month = build_history_line[3:10]
|
year_month = build_history_line[3:10]
|
||||||
update_monthly_wiki_page(wiki_dir, year_month, build_history_line)
|
update_monthly_wiki_page(wiki_dir, year_month, build_history_line)
|
||||||
|
|
||||||
regenerate_home_wiki_page(wiki_dir)
|
generate_home_wiki_page(wiki_dir, repository)
|
||||||
remove_old_manifests(wiki_dir)
|
remove_old_manifests(wiki_dir)
|
||||||
|
|
||||||
|
|
||||||
@@ -211,6 +213,11 @@ if __name__ == "__main__":
|
|||||||
type=Path,
|
type=Path,
|
||||||
help="Directory with manifest files",
|
help="Directory with manifest files",
|
||||||
)
|
)
|
||||||
|
arg_parser.add_argument(
|
||||||
|
"--repository",
|
||||||
|
required=True,
|
||||||
|
help="Repository name on GitHub",
|
||||||
|
)
|
||||||
arg_parser.add_argument(
|
arg_parser.add_argument(
|
||||||
"--allow-no-files",
|
"--allow-no-files",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
Reference in New Issue
Block a user