-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement build system using self-hosted aarch64 runners, GitHub needs
jobs feature and reusable workflows
#1703
Merged
mathbunnyru
merged 137 commits into
jupyter:master
from
mathbunnyru:asalikhov/new_build_system
Jul 5, 2022
Merged
Changes from 90 commits
Commits
Show all changes
137 commits
Select commit
Hold shift + click to select a range
c1a91ff
Completely refactor build system
mathbunnyru fa266fc
Add shell
mathbunnyru 7304556
Move shell before run
mathbunnyru 49f9c0e
Try composite action
mathbunnyru c078abe
Actually build image and uplad as artifact
mathbunnyru 74b5903
Add icon
mathbunnyru 33fdc63
Better dependencies
mathbunnyru f90de5e
Fix naming
mathbunnyru 611c51f
Temporarily remove build space maximize
mathbunnyru 157a980
Test the image
mathbunnyru ba90957
Remove old workflows
mathbunnyru f116921
Add build-push action
mathbunnyru 8e27841
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru e68eaea
Remove permissions
mathbunnyru dfbe591
Add test-image action
mathbunnyru 748dca4
Add missing shell
mathbunnyru 48518b5
Add parent image support
mathbunnyru b7342e8
Implement reusable workflow for build
mathbunnyru 5d57376
Fix reuseable workflow
mathbunnyru e51de12
Remove description
mathbunnyru b5a53e5
Fix
mathbunnyru 45d4501
Add typing
mathbunnyru e70bebe
Implement test-image as a reusable workflow
mathbunnyru 75feb62
Fix
mathbunnyru 7c3e802
Add missing things
mathbunnyru ea35ff1
Build minimal notebook as well
mathbunnyru dbb9762
Add missing needs statement
mathbunnyru be2873c
Start adding platform support
mathbunnyru c9c9c46
Fix
mathbunnyru 4b2904b
Type: choice is not yet supported
mathbunnyru 58ffbfa
Add arm64 build jobs
mathbunnyru f1826e7
Fix build image platform choosing
mathbunnyru 457225f
Fix
mathbunnyru a45feec
Better dependencies
mathbunnyru b2d3ba8
Increase test timeout
mathbunnyru 82e5b2d
Increase test timeout
mathbunnyru dfb158a
Increase test timeout
mathbunnyru 291950d
Try no to use buildx
mathbunnyru 60263a1
Remove QEMU as well
mathbunnyru dcc00b4
Revert
mathbunnyru 2fe3100
Try to use simple docker commands
mathbunnyru dea81a8
Fix
mathbunnyru ddb993a
Fix
mathbunnyru 5b03f3a
Better build
mathbunnyru 539159f
Add amd64 images tagging and push to DockerHub
mathbunnyru 35bff63
Fix
mathbunnyru a8a7314
Better naming
mathbunnyru 739003d
Refactor github workflows
mathbunnyru f7bc1c1
Fix
mathbunnyru a936129
Fix
mathbunnyru ec841b9
Better workflow name
mathbunnyru 91b70a8
Better push workflow
mathbunnyru 6322b79
Fix
mathbunnyru c5c38f9
Fix
mathbunnyru 6ce871a
Fix
mathbunnyru edc115c
Refactor
mathbunnyru 8e11fcd
Add tags prefix support
mathbunnyru b9e294c
Small refactor
mathbunnyru 1170727
Rename workflows
mathbunnyru 5ff0ecd
Upload manifests in workflow
mathbunnyru 3bd4714
Fix
mathbunnyru 3389922
Add args to call write_manifests
mathbunnyru f80d45c
Run only on base-notebook
mathbunnyru 38eddd8
Fix
mathbunnyru 4407e14
Fix hist lines dir
mathbunnyru f534a62
Add docker wiki workflow
mathbunnyru b5bfa8b
Fix
mathbunnyru 616069d
Fix double tagging
mathbunnyru e6c598f
Run command from root
mathbunnyru a5203d8
Fix update_wiki_page.py
mathbunnyru 36319f9
Wiki update fixes
mathbunnyru 944664e
Fix typo
mathbunnyru 0487c99
Cleanup docs about multi platform builds
mathbunnyru dbd5325
Improve wiki page update
mathbunnyru cfb7fd6
[TMP] Add test to check if image is freshly built
mathbunnyru b6e25f3
Enable minimal-notebook build
mathbunnyru 3ce4312
Test all amd64 images
mathbunnyru 940767e
Fix typo
mathbunnyru 4b22cb0
Revert timeout increase because we don't use QEMU as now
mathbunnyru 6ad55a3
Fix typo in docs
mathbunnyru 6844487
Use better rglob to prevent future problems
mathbunnyru 2db847f
Add docker build options
mathbunnyru 25a82e5
Download only manifest files
mathbunnyru 4f1d8a6
Fix paths
mathbunnyru 7a37943
Set retention days on uploaded artifacts
mathbunnyru cd178aa
Move accidentally deleted file back
mathbunnyru ffe33b1
Better python code
mathbunnyru 7543e49
Minor fixes
mathbunnyru 26951ef
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru 3ef0cf8
Remove downloaded file and do not maximize build space
mathbunnyru cd61560
Update .github/actions/load-image/action.yml
mathbunnyru bf7e7fd
Update .github/workflows/docker-build-upload.yml
mathbunnyru f2c4550
Update .github/workflows/docker-build-upload.yml
mathbunnyru 927cbf8
Update .github/workflows/docker-build-upload.yml
mathbunnyru 1936d73
Apply suggestions from code review
mathbunnyru 14ee8ff
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru 7dd4a5f
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru 3081997
Unify yaml quotes style
mathbunnyru 0602872
Update codestyle
mathbunnyru 4e91cc9
Test in the same step as build
mathbunnyru 4ce4d0c
Add docs
mathbunnyru 911b4c1
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru 9818511
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru 42d30ff
Bump actions/setup-python
mathbunnyru 2b844b3
Try to use aarch64 self-hosted runner
mathbunnyru 459b311
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru b06c797
Fix style
mathbunnyru d52b8dd
Add artifacts cleanup
mathbunnyru 515404a
Add downloading aarch64 artifacts
mathbunnyru a350070
Better wording
mathbunnyru 23f0eb9
Always run cleanup steps
mathbunnyru aad4f22
Always doesn't respect other conditions
mathbunnyru ad4670b
Add docs to setup aarch64 runner
mathbunnyru febc1ff
Add always() where needed
mathbunnyru 56f172e
Fixes
mathbunnyru ed40afb
Better style
mathbunnyru c71c79e
Add copying authorized_keys
mathbunnyru 625e60b
Better docs
mathbunnyru c0d3b81
Better docs
mathbunnyru 1be103d
Better docs
mathbunnyru cc6fb74
Fix linkcheck-docs error
mathbunnyru 500e1a8
Fix linkcheck-docs error
mathbunnyru 171c6c3
Some fixes for push step
mathbunnyru 2cafcc1
More simple README.md
mathbunnyru 44d3104
Remove export G_SLICE=always-malloc
mathbunnyru c2d33a0
Merge branch 'master' into asalikhov/new_build_system
mathbunnyru b40de11
Better docs
mathbunnyru a1e6393
Use ARM64 tag for self-hosted runners
mathbunnyru 6e53601
Better filenames for manifests and hist lines
mathbunnyru 57f882f
Better docs
mathbunnyru dd646ad
Add --upgrade to pip requirements to have environment identical to fr…
mathbunnyru e78c8aa
Better docs
mathbunnyru 04f8bd5
Better docs
mathbunnyru 7c4f3bd
Remove unit_check_file
mathbunnyru 1c2a91e
Better docs
mathbunnyru 85daab3
Update url
mathbunnyru 65e0467
Better docs
mathbunnyru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "Build environment" | ||
description: "Create build environment" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set Up Python 🐍 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Install Dev Dependencies 📦 | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: "Download manifests" | ||
description: "Download all manifests and history lines" | ||
|
||
# Unfortunately, `actions/download-artifact` doesn't support wildcard download | ||
# To make this workflow fast, we manually download all manifests and history lines | ||
# https://github.com/actions/download-artifact/issues/6 | ||
|
||
inputs: | ||
histLineDir: | ||
description: "Directory to store history lines" | ||
required: true | ||
type: string | ||
manifestDir: | ||
description: "Directory to store manifest files" | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: base-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: minimal-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: scipy-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: r-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: tensorflow-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: datascience-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: pyspark-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: all-spark-notebook-amd64-history_line | ||
path: ${{ inputs.histLineDir }} | ||
|
||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: base-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: minimal-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: scipy-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: r-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: tensorflow-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: datascience-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: pyspark-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} | ||
- name: Download artifact 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: all-spark-notebook-amd64-manifest | ||
path: ${{ inputs.manifestDir }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: "Load image" | ||
mathbunnyru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description: "Download image artifact and load it to docker" | ||
|
||
inputs: | ||
image: | ||
description: "Image name" | ||
required: true | ||
type: string | ||
platform: | ||
description: "Image platform" | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download built image 📥 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.image }}-${{ inputs.platform }} | ||
path: /tmp/ | ||
- name: Load downloaded image to docker 📥 | ||
run: | | ||
docker load --input /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar | ||
docker image ls -a | ||
shell: bash | ||
- name: Delete the file 🗑️ | ||
run: rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar | ||
shell: bash |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Download parent image, build new one, upload it to GitHub artifacts | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
parentImage: | ||
description: "Parent image name" | ||
required: true | ||
type: string | ||
image: | ||
description: "Image name" | ||
required: true | ||
type: string | ||
platform: | ||
description: "Image platform" | ||
required: true | ||
type: string | ||
runsOn: | ||
description: "GitHub Actions Runner image" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-upload: | ||
runs-on: ${{ inputs.runsOn }} | ||
steps: | ||
- name: Checkout Repo ⚡️ | ||
uses: actions/checkout@v3 | ||
- name: Create dev environment 📦 | ||
uses: ./.github/actions/create-dev-env | ||
|
||
- name: Load parent built image to docker 📥 | ||
mathbunnyru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if: ${{ inputs.parentImage != '' }} | ||
uses: ./.github/actions/load-image | ||
with: | ||
image: ${{ inputs.parentImage }} | ||
platform: ${{ inputs.platform }} | ||
|
||
- name: Build image 🛠 | ||
run: docker build --rm --force-rm --tag jupyter/${{ inputs.image }} ${{ inputs.image }}/ | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
# Full logs for CI build | ||
BUILDKIT_PROGRESS: plain | ||
shell: bash | ||
- name: Save image as a file 💾 | ||
mathbunnyru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar | ||
shell: bash | ||
|
||
- name: Upload artifact 💾 | ||
mathbunnyru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.image }}-${{ inputs.platform }} | ||
path: /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar | ||
retention-days: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Download image artifact from GitHub artifacts, tag it and push to DockerHub | ||
mathbunnyru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
images: | ||
description: "Stringified JSON object listing image names" | ||
required: true | ||
type: string | ||
platform: | ||
description: "Image platform" | ||
required: true | ||
type: string | ||
runsOn: | ||
description: "GitHub Actions Runner image" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
tag-push: | ||
runs-on: ${{ inputs.runsOn }} | ||
|
||
strategy: | ||
matrix: | ||
image: ${{ fromJson(inputs.images) }} | ||
|
||
steps: | ||
- name: Checkout Repo ⚡️ | ||
uses: actions/checkout@v3 | ||
- name: Create dev environment 📦 | ||
uses: ./.github/actions/create-dev-env | ||
|
||
- name: Load image to docker 📥 | ||
mathbunnyru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: ./.github/actions/load-image | ||
with: | ||
image: ${{ matrix.image }} | ||
platform: ${{ inputs.platform }} | ||
|
||
- name: Create tags 🏷 | ||
run: python3 -m tagging.tag_image --short-image-name ${{ matrix.image }} | ||
shell: bash | ||
|
||
- name: Write manifest files 🏷 | ||
run: python3 -m tagging.write_manifests --short-image-name ${{ matrix.image }} --hist-line-dir /tmp/hist_lines/ --manifest-dir /tmp/manifests/ | ||
shell: bash | ||
- name: Upload manifest file 💾 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.image }}-${{ inputs.platform }}-manifest | ||
path: /tmp/manifests/*.md | ||
retention-days: 3 | ||
- name: Upload build history line 💾 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.image }}-${{ inputs.platform }}-history_line | ||
path: /tmp/hist_lines/*.txt | ||
retention-days: 3 | ||
|
||
- name: Login to Docker Hub 🔐 | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' | ||
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # dependabot updates to latest release | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Push Images to Docker Hub 📤 | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' | ||
run: docker push --all-tags jupyter/${{ matrix.image }} | ||
shell: bash |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for using composites - I was thinking this would be a good way to simplify our workflows in the future but you were ahead of me already