From c1a91ff301589e1a52373e189ded35b77f993076 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 13:56:41 +0300 Subject: [PATCH 001/129] Completely refactor build system --- .github/actions/create-dev-env/action.yml | 32 ++++++++++++ .github/workflows/build-docker.yml | 61 +++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/actions/create-dev-env/action.yml create mode 100644 .github/workflows/build-docker.yml diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml new file mode 100644 index 0000000000..c506a38407 --- /dev/null +++ b/.github/actions/create-dev-env/action.yml @@ -0,0 +1,32 @@ +name: "Build environment" +description: "Create build environment" + +on: workflow_call + +runs: + steps: + - name: Maximize build space 🛠 + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + + # Setup docker to build for multiple platforms, see: + # https://github.com/docker/build-push-action/tree/master#usage + # https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md + - name: Set up QEMU (for docker buildx) 🐳 + uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release + + # https://github.com/docker/build-push-action/tree/master#usage + - name: Set up Docker Buildx (for multi-arch builds) 🐳 + uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # dependabot updates to latest release + + - 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 diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000000..d0d970c8e3 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,61 @@ +name: Build and test Docker Images + +on: + schedule: + # Weekly, at 03:00 on Monday UTC time + - cron: "0 3 * * 1" + pull_request: + paths: + - ".github/workflows/build-docker.yml" + + - "all-spark-notebook/**" + - "base-notebook/**" + - "datascience-notebook/**" + - "minimal-notebook/**" + - "pyspark-notebook/**" + - "r-notebook/**" + - "scipy-notebook/**" + - "tensorflow-notebook/**" + + - "tagging/**" + - "tests/**" + - "requirements-dev.txt" + push: + branches: + - main + - master + paths: + - ".github/workflows/build-docker.yml" + + - "all-spark-notebook/**" + - "base-notebook/**" + - "datascience-notebook/**" + - "minimal-notebook/**" + - "pyspark-notebook/**" + - "r-notebook/**" + - "scipy-notebook/**" + - "tensorflow-notebook/**" + + - "tagging/**" + - "tests/**" + - "requirements-dev.txt" + workflow_dispatch: + +# https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-base-notebook: + name: Build Base Notebook Image + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout Repo ⚡️ + uses: actions/checkout@v3 + - name: Run custom action + # Use the location in the repository (without action.yml) + uses: ./.github/actions/create-dev-env From fa266fc4d6d9c44a59389cd66a7cf25ec612fe08 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:02:53 +0300 Subject: [PATCH 002/129] Add shell --- .github/actions/create-dev-env/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index c506a38407..db9b9708ce 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -10,6 +10,7 @@ runs: sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/local/lib/android sudo rm -rf /opt/ghc + shell: bash # Setup docker to build for multiple platforms, see: # https://github.com/docker/build-push-action/tree/master#usage @@ -30,3 +31,4 @@ runs: run: | pip install --upgrade pip pip install -r requirements-dev.txt + shell: bash From 730455606c1d07d07d8d0d42ade855b593c356eb Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:04:35 +0300 Subject: [PATCH 003/129] Move shell before run --- .github/actions/create-dev-env/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index db9b9708ce..20198866ed 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -6,11 +6,11 @@ on: workflow_call runs: steps: - name: Maximize build space 🛠 + shell: bash run: | sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/local/lib/android sudo rm -rf /opt/ghc - shell: bash # Setup docker to build for multiple platforms, see: # https://github.com/docker/build-push-action/tree/master#usage @@ -28,7 +28,7 @@ runs: python-version: 3.x - name: Install Dev Dependencies 📦 + shell: bash run: | pip install --upgrade pip pip install -r requirements-dev.txt - shell: bash From 49f9c0e7caf342efe0a56a0fe846966af5b7f5df Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:09:06 +0300 Subject: [PATCH 004/129] Try composite action --- .github/actions/create-dev-env/action.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 20198866ed..d27ad16ecb 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -1,16 +1,15 @@ name: "Build environment" description: "Create build environment" -on: workflow_call - runs: + using: "composite" steps: - name: Maximize build space 🛠 - shell: bash run: | sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/local/lib/android sudo rm -rf /opt/ghc + shell: bash # Setup docker to build for multiple platforms, see: # https://github.com/docker/build-push-action/tree/master#usage @@ -28,7 +27,7 @@ runs: python-version: 3.x - name: Install Dev Dependencies 📦 - shell: bash run: | pip install --upgrade pip pip install -r requirements-dev.txt + shell: bash From c078abe91feacd14bafa638fc807ead74678c3bc Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:26:06 +0300 Subject: [PATCH 005/129] Actually build image and uplad as artifact --- .github/workflows/build-docker.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index d0d970c8e3..1a06583e62 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -56,6 +56,18 @@ jobs: steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 - - name: Run custom action + - name: Create dev environment 📦 # Use the location in the repository (without action.yml) uses: ./.github/actions/create-dev-env + - name: Build image 🛠 + uses: docker/build-push-action@v3 + with: + context: base-notebook/ + file: base-notebook/Dockerfile + tags: jupyter/base-notebook:latest + outputs: type=docker,dest=/tmp/image.tar + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: myimage + path: /tmp/myimage.tar From 74b5903400fec488e506c9d10cc8a70a569f1d65 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:27:14 +0300 Subject: [PATCH 006/129] Add icon --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 1a06583e62..f1faaae685 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -66,7 +66,7 @@ jobs: file: base-notebook/Dockerfile tags: jupyter/base-notebook:latest outputs: type=docker,dest=/tmp/image.tar - - name: Upload artifact + - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: name: myimage From 33fdc635ab19af55cbf54af8a0341547ec2eed3a Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:28:14 +0300 Subject: [PATCH 007/129] Better dependencies --- .github/workflows/build-docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f1faaae685..6f0c7da8af 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -7,6 +7,7 @@ on: pull_request: paths: - ".github/workflows/build-docker.yml" + - ".github/actions/create-dev-env/**" - "all-spark-notebook/**" - "base-notebook/**" @@ -26,6 +27,7 @@ on: - master paths: - ".github/workflows/build-docker.yml" + - ".github/actions/create-dev-env/**" - "all-spark-notebook/**" - "base-notebook/**" From f90de5efd807a29e7541caf5ef8b9c5745d3e129 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:32:08 +0300 Subject: [PATCH 008/129] Fix naming --- .github/workflows/build-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 6f0c7da8af..f901df8cc2 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -71,5 +71,5 @@ jobs: - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: - name: myimage - path: /tmp/myimage.tar + name: base-notebook + path: /tmp/image.tar From 611c51fb8242edf439f14593b8c5c6d806634b1c Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:32:59 +0300 Subject: [PATCH 009/129] Temporarily remove build space maximize --- .github/actions/create-dev-env/action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index d27ad16ecb..71b0cb74fd 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -4,12 +4,12 @@ description: "Create build environment" runs: using: "composite" steps: - - name: Maximize build space 🛠 - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - shell: bash + # - name: Maximize build space 🛠 + # run: | + # sudo rm -rf /usr/share/dotnet + # sudo rm -rf /usr/local/lib/android + # sudo rm -rf /opt/ghc + # shell: bash # Setup docker to build for multiple platforms, see: # https://github.com/docker/build-push-action/tree/master#usage From 157a980fcf27290355a40d1a3109bd916cbe6530 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:47:40 +0300 Subject: [PATCH 010/129] Test the image --- .github/workflows/build-docker.yml | 28 ++++++++++++++++++++++++---- tests/run_tests.py | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f901df8cc2..018b737bc2 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -50,7 +50,7 @@ concurrency: jobs: build-base-notebook: - name: Build Base Notebook Image + name: Build base-notebook runs-on: ubuntu-latest permissions: contents: read @@ -59,7 +59,6 @@ jobs: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 - name: Create dev environment 📦 - # Use the location in the repository (without action.yml) uses: ./.github/actions/create-dev-env - name: Build image 🛠 uses: docker/build-push-action@v3 @@ -67,9 +66,30 @@ jobs: context: base-notebook/ file: base-notebook/Dockerfile tags: jupyter/base-notebook:latest - outputs: type=docker,dest=/tmp/image.tar + outputs: type=docker,dest=/tmp/base-notebook.tar - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: name: base-notebook - path: /tmp/image.tar + path: /tmp/base-notebook.tar + + test-base-notebook: + name: Test base-notebook + runs-on: ubuntu-latest + needs: [build-base-notebook] + steps: + - name: Checkout Repo ⚡️ + uses: actions/checkout@v3 + - name: Create dev environment 📦 + uses: ./.github/actions/create-dev-env + - name: Download built image 📥 + uses: actions/download-artifact@v3 + with: + name: base-notebook + path: /tmp/ + - name: Load downloaded image to docker 📥 + run: | + docker load --input /tmp/base-notebook.tar + docker image ls -a + - name: Run tests ✅ + run: python3 -m tests.run_tests --short-image-name base-notebook diff --git a/tests/run_tests.py b/tests/run_tests.py index f464e17e13..12e68e2dcb 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -39,7 +39,7 @@ def test_image(short_image_name: str, owner: str) -> None: required=True, help="Short image name to run test on", ) - arg_parser.add_argument("--owner", required=True, help="Owner of the image") + arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") args = arg_parser.parse_args() From ba9095725b649189a8b247cbcb0d796148381b43 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 14:57:19 +0300 Subject: [PATCH 011/129] Remove old workflows --- .github/workflows/docker-amd64.yml | 89 --------------------- .github/workflows/docker.yml | 122 ----------------------------- 2 files changed, 211 deletions(-) delete mode 100644 .github/workflows/docker-amd64.yml delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker-amd64.yml b/.github/workflows/docker-amd64.yml deleted file mode 100644 index d4a41e93e7..0000000000 --- a/.github/workflows/docker-amd64.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Build and test amd64 Docker Images -# This workflow runs a lot quicker, than building multi-images in docker.yml -# This will allow us to conclude if things work or not far quicker, -# when we don't expect there to be any platform specific breaking change. - -on: - pull_request: - paths: - - ".github/workflows/docker-amd64.yml" - - - "all-spark-notebook/**" - - "base-notebook/**" - - "datascience-notebook/**" - - "minimal-notebook/**" - - "pyspark-notebook/**" - - "r-notebook/**" - - "scipy-notebook/**" - - "tensorflow-notebook/**" - - - "tagging/**" - - "tests/**" - - "Makefile" - - "requirements-dev.txt" - push: - branches: - - main - - master - paths: - - ".github/workflows/docker-amd64.yml" - - - "all-spark-notebook/**" - - "base-notebook/**" - - "datascience-notebook/**" - - "minimal-notebook/**" - - "pyspark-notebook/**" - - "r-notebook/**" - - "scipy-notebook/**" - - "tensorflow-notebook/**" - - - "tagging/**" - - "tests/**" - - "Makefile" - - "requirements-dev.txt" - workflow_dispatch: - -concurrency: - # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - build-test-amd64-images: - name: Build and test amd64 Docker Images - runs-on: ubuntu-latest - - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v3 - - - 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 - - - name: Build Docker Images 🛠 - run: make build-all - env: - # Full logs for CI build - BUILDKIT_PROGRESS: plain - - - name: Run tests ✅ - run: make test-all - - - name: Checkout Wiki Repo 📃 - uses: actions/checkout@v3 - with: - repository: ${{github.repository}}.wiki - path: wiki/ - - - name: Create tags and manifest 🏷 - run: make hook-all diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 26a0592bbc..0000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Build, test, and publish Docker Images - -on: - schedule: - # Weekly, at 03:00 on Monday UTC time - - cron: "0 3 * * 1" - pull_request: - paths: - - ".github/workflows/docker.yml" - - - "all-spark-notebook/**" - - "base-notebook/**" - - "datascience-notebook/**" - - "minimal-notebook/**" - - "pyspark-notebook/**" - - "r-notebook/**" - - "scipy-notebook/**" - - "tensorflow-notebook/**" - - - "tagging/**" - - "tests/**" - - "Makefile" - - "requirements-dev.txt" - push: - branches: - - main - - master - paths: - - ".github/workflows/docker.yml" - - - "all-spark-notebook/**" - - "base-notebook/**" - - "datascience-notebook/**" - - "minimal-notebook/**" - - "pyspark-notebook/**" - - "r-notebook/**" - - "scipy-notebook/**" - - "tensorflow-notebook/**" - - - "tagging/**" - - "tests/**" - - "Makefile" - - "requirements-dev.txt" - workflow_dispatch: - -concurrency: - # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-test-publish-images: - name: Build, test, and publish Docker Images - if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'jupyter/docker-stacks') - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Maximize build space 🛠 - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - # Setup docker to build for multiple platforms, see: - # https://github.com/docker/build-push-action/tree/master#usage - # https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md - - name: Set up QEMU (for docker buildx) 🐳 - uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # dependabot updates to latest release - - - name: Set up Docker Buildx (for multi-arch builds) 🐳 - uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # dependabot updates to latest release - - - name: Checkout Repo ⚡️ - uses: actions/checkout@v3 - - - 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 - - - name: Build Docker Images 🛠 - run: make build-all-multi - env: - # Full logs for CI build - BUILDKIT_PROGRESS: plain - - - name: Run tests ✅ - run: make test-all - - - name: Checkout Wiki Repo 📃 - uses: actions/checkout@v3 - with: - repository: ${{github.repository}}.wiki - path: wiki/ - - - name: Create tags and manifest 🏷 - run: make hook-all - - - name: Push Wiki to GitHub 📤 - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' - uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80 # dependabot updates to latest release - with: - commit_message: "Automated wiki publish for ${{github.sha}}" - repository: wiki/ - - - 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: make push-all-multi From f1169217dcf7772a9d1e5c5fe65ca44fbfbf5803 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 15:17:49 +0300 Subject: [PATCH 012/129] Add build-push action --- .github/actions/build-push-image/action.yml | 23 +++++++++++++++++++++ .github/workflows/build-docker.yml | 16 ++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 .github/actions/build-push-image/action.yml diff --git a/.github/actions/build-push-image/action.yml b/.github/actions/build-push-image/action.yml new file mode 100644 index 0000000000..b9218794ac --- /dev/null +++ b/.github/actions/build-push-image/action.yml @@ -0,0 +1,23 @@ +name: "Build, push image" +description: "Build and push image to GitHub artifacts" + +inputs: + imageName: + description: "Image name to be built" + required: true + +runs: + using: "composite" + steps: + - name: Build image 🛠 + uses: docker/build-push-action@v3 + with: + context: ${{ inputs.imageName }}/ + file: ${{ inputs.imageName }}/Dockerfile + tags: jupyter/${{ inputs.imageName }}:latest + outputs: type=docker,dest=/tmp/${{ inputs.imageName }}.tar + - name: Upload artifact 💾 + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.imageName }} + path: /tmp/${{ inputs.imageName }}.tar diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 018b737bc2..7c395ded45 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -7,7 +7,7 @@ on: pull_request: paths: - ".github/workflows/build-docker.yml" - - ".github/actions/create-dev-env/**" + - ".github/actions/**" - "all-spark-notebook/**" - "base-notebook/**" @@ -27,7 +27,7 @@ on: - master paths: - ".github/workflows/build-docker.yml" - - ".github/actions/create-dev-env/**" + - ".github/actions/**" - "all-spark-notebook/**" - "base-notebook/**" @@ -61,17 +61,9 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - name: Build image 🛠 - uses: docker/build-push-action@v3 + uses: ./.github/actions/build-push-image with: - context: base-notebook/ - file: base-notebook/Dockerfile - tags: jupyter/base-notebook:latest - outputs: type=docker,dest=/tmp/base-notebook.tar - - name: Upload artifact 💾 - uses: actions/upload-artifact@v3 - with: - name: base-notebook - path: /tmp/base-notebook.tar + imageName: base-notebook test-base-notebook: name: Test base-notebook From e68eaea4c33646f7565705cc92d0085f1b5ceb9e Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 15:29:04 +0300 Subject: [PATCH 013/129] Remove permissions --- .github/workflows/build-docker.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 7c395ded45..fcdbdd25de 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -52,9 +52,6 @@ jobs: build-base-notebook: name: Build base-notebook runs-on: ubuntu-latest - permissions: - contents: read - steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 From dfbe591fbd2d29b8594247e615ec40cb674a300a Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 15:38:14 +0300 Subject: [PATCH 014/129] Add test-image action --- .github/actions/test-image/action.yml | 22 ++++++++++++++++++++++ .github/workflows/build-docker.yml | 17 ++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 .github/actions/test-image/action.yml diff --git a/.github/actions/test-image/action.yml b/.github/actions/test-image/action.yml new file mode 100644 index 0000000000..9930edc725 --- /dev/null +++ b/.github/actions/test-image/action.yml @@ -0,0 +1,22 @@ +name: "Pull and test image" +description: "Download image from GitHub artifacts and test it" + +inputs: + imageName: + description: "Image name to be tested" + required: true + +runs: + using: "composite" + steps: + - name: Download built image 📥 + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.imageName }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + run: | + docker load --input /tmp/${{ inputs.imageName }}.tar + docker image ls -a + - name: Run tests ✅ + run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index fcdbdd25de..8bc4fff61b 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -57,7 +57,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Build image 🛠 + + - name: Build and push image as GitHub artifact 🛠 uses: ./.github/actions/build-push-image with: imageName: base-notebook @@ -71,14 +72,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Download built image 📥 - uses: actions/download-artifact@v3 + + - name: Pull image from GitHub artifacts and test it 🛠 + uses: ./.github/actions/test-image with: - name: base-notebook - path: /tmp/ - - name: Load downloaded image to docker 📥 - run: | - docker load --input /tmp/base-notebook.tar - docker image ls -a - - name: Run tests ✅ - run: python3 -m tests.run_tests --short-image-name base-notebook + imageName: base-notebook From 748dca4a3be86c40e0f0424a86bf8f8bb4a6beb5 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 15:43:06 +0300 Subject: [PATCH 015/129] Add missing shell --- .github/actions/test-image/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/test-image/action.yml b/.github/actions/test-image/action.yml index 9930edc725..2ea5a53d42 100644 --- a/.github/actions/test-image/action.yml +++ b/.github/actions/test-image/action.yml @@ -18,5 +18,7 @@ runs: run: | docker load --input /tmp/${{ inputs.imageName }}.tar docker image ls -a + shell: bash - name: Run tests ✅ run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} + shell: bash From 48518b5de1804fcc03c815a0eed68f0ee34c9c00 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 15:48:15 +0300 Subject: [PATCH 016/129] Add parent image support --- .github/actions/build-push-image/action.yml | 15 +++++++++++++++ .github/workflows/build-docker.yml | 1 + 2 files changed, 16 insertions(+) diff --git a/.github/actions/build-push-image/action.yml b/.github/actions/build-push-image/action.yml index b9218794ac..3bff83b5aa 100644 --- a/.github/actions/build-push-image/action.yml +++ b/.github/actions/build-push-image/action.yml @@ -5,10 +5,25 @@ inputs: imageName: description: "Image name to be built" required: true + parentImageName: + description: "Parent image name" runs: using: "composite" steps: + - name: Download parent built image 📥 + if: ${{ inputs.parentImageName != '' }} + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.parentImageName }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + if: ${{ inputs.parentImageName != '' }} + run: | + docker load --input /tmp/${{ inputs.parentImageName }}.tar + docker image ls -a + shell: bash + - name: Build image 🛠 uses: docker/build-push-action@v3 with: diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 8bc4fff61b..410908e7d8 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -62,6 +62,7 @@ jobs: uses: ./.github/actions/build-push-image with: imageName: base-notebook + parentImageName: "" test-base-notebook: name: Test base-notebook From b7342e8ebf46a3ec42abb50907a6e03c71122559 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:01:11 +0300 Subject: [PATCH 017/129] Implement reusable workflow for build --- .github/actions/build-push-image/action.yml | 38 ------------------ .github/workflows/build-docker.yml | 4 +- .github/workflows/sub-build-push-image.yml | 44 +++++++++++++++++++++ 3 files changed, 45 insertions(+), 41 deletions(-) delete mode 100644 .github/actions/build-push-image/action.yml create mode 100644 .github/workflows/sub-build-push-image.yml diff --git a/.github/actions/build-push-image/action.yml b/.github/actions/build-push-image/action.yml deleted file mode 100644 index 3bff83b5aa..0000000000 --- a/.github/actions/build-push-image/action.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: "Build, push image" -description: "Build and push image to GitHub artifacts" - -inputs: - imageName: - description: "Image name to be built" - required: true - parentImageName: - description: "Parent image name" - -runs: - using: "composite" - steps: - - name: Download parent built image 📥 - if: ${{ inputs.parentImageName != '' }} - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.parentImageName }} - path: /tmp/ - - name: Load downloaded image to docker 📥 - if: ${{ inputs.parentImageName != '' }} - run: | - docker load --input /tmp/${{ inputs.parentImageName }}.tar - docker image ls -a - shell: bash - - - name: Build image 🛠 - uses: docker/build-push-action@v3 - with: - context: ${{ inputs.imageName }}/ - file: ${{ inputs.imageName }}/Dockerfile - tags: jupyter/${{ inputs.imageName }}:latest - outputs: type=docker,dest=/tmp/${{ inputs.imageName }}.tar - - name: Upload artifact 💾 - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.imageName }} - path: /tmp/${{ inputs.imageName }}.tar diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 410908e7d8..b6a893bfc1 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -55,11 +55,9 @@ jobs: steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 - - name: Create dev environment 📦 - uses: ./.github/actions/create-dev-env - name: Build and push image as GitHub artifact 🛠 - uses: ./.github/actions/build-push-image + uses: ./.github/workflows/sub-build-push-image.yml with: imageName: base-notebook parentImageName: "" diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml new file mode 100644 index 0000000000..57650c2c44 --- /dev/null +++ b/.github/workflows/sub-build-push-image.yml @@ -0,0 +1,44 @@ +name: "Build, push image" +description: "Build and push image to GitHub artifacts" + +on: + workflow_call: + inputs: + imageName: + description: "Image name to be built" + required: true + parentImageName: + description: "Parent image name" + +jobs: + build-push-image: + name: Build and push image to GitHub artifacts + steps: + - name: Create dev environment 📦 + uses: ./.github/actions/create-dev-env + + - name: Download parent built image 📥 + if: ${{ inputs.parentImageName != '' }} + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.parentImageName }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + if: ${{ inputs.parentImageName != '' }} + run: | + docker load --input /tmp/${{ inputs.parentImageName }}.tar + docker image ls -a + shell: bash + + - name: Build image 🛠 + uses: docker/build-push-action@v3 + with: + context: ${{ inputs.imageName }}/ + file: ${{ inputs.imageName }}/Dockerfile + tags: jupyter/${{ inputs.imageName }}:latest + outputs: type=docker,dest=/tmp/${{ inputs.imageName }}.tar + - name: Upload artifact 💾 + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.imageName }} + path: /tmp/${{ inputs.imageName }}.tar From 5d5737699b689910212b63c69ef61322cbbe424e Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:05:05 +0300 Subject: [PATCH 018/129] Fix reuseable workflow --- .github/workflows/build-docker.yml | 15 ++++----------- .github/workflows/sub-build-push-image.yml | 3 +++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index b6a893bfc1..0921e0b14f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -50,17 +50,10 @@ concurrency: jobs: build-base-notebook: - name: Build base-notebook - runs-on: ubuntu-latest - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v3 - - - name: Build and push image as GitHub artifact 🛠 - uses: ./.github/workflows/sub-build-push-image.yml - with: - imageName: base-notebook - parentImageName: "" + uses: ./.github/workflows/sub-build-push-image.yml + with: + imageName: base-notebook + parentImageName: "" test-base-notebook: name: Test base-notebook diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 57650c2c44..15bbd5248d 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -13,7 +13,10 @@ on: jobs: build-push-image: name: Build and push image to GitHub artifacts + runs-on: ubuntu-latest steps: + - name: Checkout Repo ⚡️ + uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env From e51de12d380f6c2ac5e9e2106c8562600d27f818 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:06:48 +0300 Subject: [PATCH 019/129] Remove description --- .github/workflows/sub-build-push-image.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 15bbd5248d..4eb9ab74c9 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -1,5 +1,4 @@ -name: "Build, push image" -description: "Build and push image to GitHub artifacts" +name: Download parent image, build new one, push it to GitHub artifacts on: workflow_call: From b5a53e5e28754a05735ffb48ee3caa464cdbd27f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:07:52 +0300 Subject: [PATCH 020/129] Fix --- .github/workflows/sub-build-push-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 4eb9ab74c9..724078c515 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -8,6 +8,7 @@ on: required: true parentImageName: description: "Parent image name" + required: true jobs: build-push-image: From 45d4501bf135e98163ff15dc9fca66277bef9e0a Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:09:15 +0300 Subject: [PATCH 021/129] Add typing --- .github/workflows/sub-build-push-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 724078c515..892d7ce125 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -6,9 +6,11 @@ on: imageName: description: "Image name to be built" required: true + type: string parentImageName: description: "Parent image name" required: true + type: string jobs: build-push-image: From e70bebee28ce807a4fae9620859a04094381e7b4 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:12:58 +0300 Subject: [PATCH 022/129] Implement test-image as a reusable workflow --- .github/actions/test-image/action.yml | 24 --------------------- .github/workflows/build-docker.yml | 15 +++---------- .github/workflows/sub-build-push-image.yml | 1 - .github/workflows/sub-test-image.yml | 25 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 37 deletions(-) delete mode 100644 .github/actions/test-image/action.yml create mode 100644 .github/workflows/sub-test-image.yml diff --git a/.github/actions/test-image/action.yml b/.github/actions/test-image/action.yml deleted file mode 100644 index 2ea5a53d42..0000000000 --- a/.github/actions/test-image/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: "Pull and test image" -description: "Download image from GitHub artifacts and test it" - -inputs: - imageName: - description: "Image name to be tested" - required: true - -runs: - using: "composite" - steps: - - name: Download built image 📥 - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.imageName }} - path: /tmp/ - - name: Load downloaded image to docker 📥 - run: | - docker load --input /tmp/${{ inputs.imageName }}.tar - docker image ls -a - shell: bash - - name: Run tests ✅ - run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} - shell: bash diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 0921e0b14f..1d0ae41bb4 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -56,16 +56,7 @@ jobs: parentImageName: "" test-base-notebook: - name: Test base-notebook - runs-on: ubuntu-latest needs: [build-base-notebook] - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v3 - - name: Create dev environment 📦 - uses: ./.github/actions/create-dev-env - - - name: Pull image from GitHub artifacts and test it 🛠 - uses: ./.github/actions/test-image - with: - imageName: base-notebook + uses: ./.github/workflows/sub-test-image.yml + with: + imageName: base-notebook diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 892d7ce125..a0c2b6eb2d 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -14,7 +14,6 @@ on: jobs: build-push-image: - name: Build and push image to GitHub artifacts runs-on: ubuntu-latest steps: - name: Checkout Repo ⚡️ diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml new file mode 100644 index 0000000000..8ce152385c --- /dev/null +++ b/.github/workflows/sub-test-image.yml @@ -0,0 +1,25 @@ +name: Download image artifact from GitHub artifacts and test it + +inputs: + imageName: + description: "Image name to be tested" + required: true + type: string + +jobs: + test-image: + runs-on: ubuntu-latest + steps: + - name: Download built image 📥 + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.imageName }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + run: | + docker load --input /tmp/${{ inputs.imageName }}.tar + docker image ls -a + shell: bash + - name: Run tests ✅ + run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} + shell: bash From 75feb629a4a9b8ba51f5508dcf42afc4d304e93d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:13:55 +0300 Subject: [PATCH 023/129] Fix --- .github/workflows/sub-test-image.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 8ce152385c..c390987b46 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -1,10 +1,12 @@ name: Download image artifact from GitHub artifacts and test it -inputs: - imageName: - description: "Image name to be tested" - required: true - type: string +on: + workflow_call: + inputs: + imageName: + description: "Image name to be tested" + required: true + type: string jobs: test-image: From 7c3e802fda50bcda7d63584f233bdecc1c9a316b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:14:36 +0300 Subject: [PATCH 024/129] Add missing things --- .github/workflows/sub-test-image.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index c390987b46..5ba58c6c73 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -12,6 +12,11 @@ jobs: test-image: runs-on: ubuntu-latest steps: + - name: Checkout Repo ⚡️ + uses: actions/checkout@v3 + - name: Create dev environment 📦 + uses: ./.github/actions/create-dev-env + - name: Download built image 📥 uses: actions/download-artifact@v3 with: @@ -22,6 +27,7 @@ jobs: docker load --input /tmp/${{ inputs.imageName }}.tar docker image ls -a shell: bash + - name: Run tests ✅ run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} shell: bash From ea35ff19655ce9609ec309139d4eff92a7ddb8f9 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:21:43 +0300 Subject: [PATCH 025/129] Build minimal notebook as well --- .github/workflows/build-docker.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 1d0ae41bb4..bc14839069 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -60,3 +60,15 @@ jobs: uses: ./.github/workflows/sub-test-image.yml with: imageName: base-notebook + + build-minimal-notebook: + uses: ./.github/workflows/sub-build-push-image.yml + with: + imageName: minimal-notebook + parentImageName: base-notebook + + test-minimal-notebook: + needs: [build-minimal-notebook] + uses: ./.github/workflows/sub-test-image.yml + with: + imageName: minimal-notebook From dbb97628de0a26411375bf9b2644c2bf570fc25f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:35:18 +0300 Subject: [PATCH 026/129] Add missing needs statement --- .github/workflows/build-docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index bc14839069..790b2e0678 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -62,6 +62,7 @@ jobs: imageName: base-notebook build-minimal-notebook: + needs: [build-base-notebook] uses: ./.github/workflows/sub-build-push-image.yml with: imageName: minimal-notebook From be2873c78af6ab74a2a33617a34ff751d4ad37a7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:55:02 +0300 Subject: [PATCH 027/129] Start adding platform support --- .github/workflows/build-docker.yml | 16 ++++++++++------ .github/workflows/sub-build-push-image.yml | 18 +++++++++++++----- .github/workflows/sub-test-image.yml | 11 +++++++++-- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 790b2e0678..fcdb58d07b 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -49,27 +49,31 @@ concurrency: cancel-in-progress: true jobs: - build-base-notebook: + build-amd64-base-notebook: uses: ./.github/workflows/sub-build-push-image.yml with: - imageName: base-notebook parentImageName: "" + imageName: base-notebook + platform: amd64 - test-base-notebook: + test-amd64-base-notebook: needs: [build-base-notebook] uses: ./.github/workflows/sub-test-image.yml with: imageName: base-notebook + platform: amd64 - build-minimal-notebook: + build-amd64-minimal-notebook: needs: [build-base-notebook] uses: ./.github/workflows/sub-build-push-image.yml with: - imageName: minimal-notebook parentImageName: base-notebook + imageName: minimal-notebook + platform: amd64 - test-minimal-notebook: + test-amd64-minimal-notebook: needs: [build-minimal-notebook] uses: ./.github/workflows/sub-test-image.yml with: imageName: minimal-notebook + platform: amd64 diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index a0c2b6eb2d..1040cf7376 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -11,6 +11,13 @@ on: description: "Parent image name" required: true type: string + platform: + description: "Target platform for the built image" + required: true + type: choice + options: + - amd64 + - arm64 jobs: build-push-image: @@ -25,12 +32,12 @@ jobs: if: ${{ inputs.parentImageName != '' }} uses: actions/download-artifact@v3 with: - name: ${{ inputs.parentImageName }} + name: ${{ inputs.parentImageName }}-${{ inputs.platform }} path: /tmp/ - name: Load downloaded image to docker 📥 if: ${{ inputs.parentImageName != '' }} run: | - docker load --input /tmp/${{ inputs.parentImageName }}.tar + docker load --input /tmp/${{ inputs.parentImageName }}-${{ inputs.platform }}.tar docker image ls -a shell: bash @@ -40,9 +47,10 @@ jobs: context: ${{ inputs.imageName }}/ file: ${{ inputs.imageName }}/Dockerfile tags: jupyter/${{ inputs.imageName }}:latest - outputs: type=docker,dest=/tmp/${{ inputs.imageName }}.tar + outputs: type=docker,dest=/tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar + platform: linux/${{ inputs.platform }} - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: - name: ${{ inputs.imageName }} - path: /tmp/${{ inputs.imageName }}.tar + name: ${{ inputs.imageName }}-${{ inputs.platform }} + path: /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 5ba58c6c73..3ef705bd49 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -7,6 +7,13 @@ on: description: "Image name to be tested" required: true type: string + platform: + description: "Target platform for the built image" + required: true + type: choice + options: + - amd64 + - arm64 jobs: test-image: @@ -20,11 +27,11 @@ jobs: - name: Download built image 📥 uses: actions/download-artifact@v3 with: - name: ${{ inputs.imageName }} + name: ${{ inputs.imageName }}-${{ inputs.platform }} path: /tmp/ - name: Load downloaded image to docker 📥 run: | - docker load --input /tmp/${{ inputs.imageName }}.tar + docker load --input /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar docker image ls -a shell: bash From c9c9c4639604b2292733053daf426d76fd75fd87 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:56:08 +0300 Subject: [PATCH 028/129] Fix --- .github/workflows/build-docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index fcdb58d07b..149954027b 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -57,14 +57,14 @@ jobs: platform: amd64 test-amd64-base-notebook: - needs: [build-base-notebook] + needs: [build-amd64-base-notebook] uses: ./.github/workflows/sub-test-image.yml with: imageName: base-notebook platform: amd64 build-amd64-minimal-notebook: - needs: [build-base-notebook] + needs: [build-amd64-base-notebook] uses: ./.github/workflows/sub-build-push-image.yml with: parentImageName: base-notebook @@ -72,7 +72,7 @@ jobs: platform: amd64 test-amd64-minimal-notebook: - needs: [build-minimal-notebook] + needs: [build-amd64-minimal-notebook] uses: ./.github/workflows/sub-test-image.yml with: imageName: minimal-notebook From 4b2904b342682ca0d70627e60d12d9cea0a9663b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 16:58:12 +0300 Subject: [PATCH 029/129] Type: choice is not yet supported --- .github/workflows/sub-build-push-image.yml | 5 +---- .github/workflows/sub-test-image.yml | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 1040cf7376..09ebfa47a5 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -14,10 +14,7 @@ on: platform: description: "Target platform for the built image" required: true - type: choice - options: - - amd64 - - arm64 + type: string jobs: build-push-image: diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 3ef705bd49..9ed31468ce 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -10,10 +10,7 @@ on: platform: description: "Target platform for the built image" required: true - type: choice - options: - - amd64 - - arm64 + type: string jobs: test-image: From 58ffbfa027dc322e34ed8f8df72a5d33128722c0 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 17:01:05 +0300 Subject: [PATCH 030/129] Add arm64 build jobs --- .github/workflows/build-docker.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 149954027b..e2eb9a505e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -77,3 +77,32 @@ jobs: with: imageName: minimal-notebook platform: amd64 + + build-arm64-base-notebook: + uses: ./.github/workflows/sub-build-push-image.yml + with: + parentImageName: "" + imageName: base-notebook + platform: arm64 + + test-arm64-base-notebook: + needs: [build-arm64-base-notebook] + uses: ./.github/workflows/sub-test-image.yml + with: + imageName: base-notebook + platform: arm64 + + build-arm64-minimal-notebook: + needs: [build-arm64-base-notebook] + uses: ./.github/workflows/sub-build-push-image.yml + with: + parentImageName: base-notebook + imageName: minimal-notebook + platform: arm64 + + test-arm64-minimal-notebook: + needs: [build-arm64-minimal-notebook] + uses: ./.github/workflows/sub-test-image.yml + with: + imageName: minimal-notebook + platform: arm64 From f1826e7676b999a90618352069906dac0a37d2c2 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 17:12:44 +0300 Subject: [PATCH 031/129] Fix build image platform choosing --- .github/workflows/sub-build-push-image.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 09ebfa47a5..86a8b43e14 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -45,7 +45,8 @@ jobs: file: ${{ inputs.imageName }}/Dockerfile tags: jupyter/${{ inputs.imageName }}:latest outputs: type=docker,dest=/tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar - platform: linux/${{ inputs.platform }} + platforms: + - linux/${{ inputs.platform }} - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: From 457225fbdb1d77b749f9b1f21c446345e7bf65b7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 17:14:21 +0300 Subject: [PATCH 032/129] Fix --- .github/workflows/sub-build-push-image.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 86a8b43e14..554e1f0936 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -45,8 +45,7 @@ jobs: file: ${{ inputs.imageName }}/Dockerfile tags: jupyter/${{ inputs.imageName }}:latest outputs: type=docker,dest=/tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar - platforms: - - linux/${{ inputs.platform }} + platforms: linux/${{ inputs.platform }} - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: From a45feec63204f4b35519cd937eba5410bba70df7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 17:24:07 +0300 Subject: [PATCH 033/129] Better dependencies --- .github/workflows/build-docker.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index e2eb9a505e..8bd62291c4 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -7,7 +7,9 @@ on: pull_request: paths: - ".github/workflows/build-docker.yml" - - ".github/actions/**" + - ".github/workflows/sub-build-push-image.yml" + - ".github/workflows/sub-test-image.yml" + - ".github/actions/create-dev-env/action.yml" - "all-spark-notebook/**" - "base-notebook/**" @@ -27,7 +29,9 @@ on: - master paths: - ".github/workflows/build-docker.yml" - - ".github/actions/**" + - ".github/workflows/sub-build-push-image.yml" + - ".github/workflows/sub-test-image.yml" + - ".github/actions/create-dev-env/action.yml" - "all-spark-notebook/**" - "base-notebook/**" From b2d3ba803c4c1adcbf2af1811006f5c982d76815 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 17:39:47 +0300 Subject: [PATCH 034/129] Increase test timeout --- tests/base-notebook/test_package_managers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/base-notebook/test_package_managers.py b/tests/base-notebook/test_package_managers.py index d831b1e6de..dd5438399c 100644 --- a/tests/base-notebook/test_package_managers.py +++ b/tests/base-notebook/test_package_managers.py @@ -27,8 +27,9 @@ def test_package_manager( LOGGER.info( f"Test that the package manager {package_manager} is working properly ..." ) + # Increased timout to make aarch64 images tests work in QEMU container.run_and_wait( - timeout=5, + timeout=30, tty=True, command=["start.sh", "bash", "-c", f"{package_manager} {version_arg}"], ) From 82e5b2d19c0c8162850838a1020c96a70c11d9ef Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 18:13:38 +0300 Subject: [PATCH 035/129] Increase test timeout --- tests/minimal-notebook/test_nbconvert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/minimal-notebook/test_nbconvert.py b/tests/minimal-notebook/test_nbconvert.py index dabeba4d9c..d70aa9dd5e 100644 --- a/tests/minimal-notebook/test_nbconvert.py +++ b/tests/minimal-notebook/test_nbconvert.py @@ -33,7 +33,7 @@ def test_nbconvert( ) command = f"jupyter nbconvert {cont_data_dir}/{test_file}.ipynb --output-dir {output_dir} --to {output_format}" logs = container.run_and_wait( - timeout=30, + timeout=60, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, tty=True, command=["start.sh", "bash", "-c", command], From dfb158a0485f8fce7cde1778a10ac06f2dcc6759 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 18:47:37 +0300 Subject: [PATCH 036/129] Increase test timeout --- tests/minimal-notebook/test_nbconvert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/minimal-notebook/test_nbconvert.py b/tests/minimal-notebook/test_nbconvert.py index d70aa9dd5e..5434554559 100644 --- a/tests/minimal-notebook/test_nbconvert.py +++ b/tests/minimal-notebook/test_nbconvert.py @@ -33,7 +33,7 @@ def test_nbconvert( ) command = f"jupyter nbconvert {cont_data_dir}/{test_file}.ipynb --output-dir {output_dir} --to {output_format}" logs = container.run_and_wait( - timeout=60, + timeout=120, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, tty=True, command=["start.sh", "bash", "-c", command], From 291950dcfda4601b5fecdd7dc9be5839fb0b035c Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:09:40 +0300 Subject: [PATCH 037/129] Try no to use buildx --- .github/actions/create-dev-env/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 71b0cb74fd..45ce7b0ab7 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -17,10 +17,6 @@ runs: - name: Set up QEMU (for docker buildx) 🐳 uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release - # https://github.com/docker/build-push-action/tree/master#usage - - name: Set up Docker Buildx (for multi-arch builds) 🐳 - uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # dependabot updates to latest release - - name: Set Up Python 🐍 uses: actions/setup-python@v3 with: From 60263a1cc5212a151afa916cf9ec35e344cfa606 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:18:01 +0300 Subject: [PATCH 038/129] Remove QEMU as well --- .github/actions/create-dev-env/action.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 45ce7b0ab7..2956e9c9b4 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -11,12 +11,6 @@ runs: # sudo rm -rf /opt/ghc # shell: bash - # Setup docker to build for multiple platforms, see: - # https://github.com/docker/build-push-action/tree/master#usage - # https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md - - name: Set up QEMU (for docker buildx) 🐳 - uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release - - name: Set Up Python 🐍 uses: actions/setup-python@v3 with: From dcc00b4a1aa294e510c59f8a51df283d3b86d3a7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:21:11 +0300 Subject: [PATCH 039/129] Revert --- .github/actions/create-dev-env/action.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 2956e9c9b4..71b0cb74fd 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -11,6 +11,16 @@ runs: # sudo rm -rf /opt/ghc # shell: bash + # Setup docker to build for multiple platforms, see: + # https://github.com/docker/build-push-action/tree/master#usage + # https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md + - name: Set up QEMU (for docker buildx) 🐳 + uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release + + # https://github.com/docker/build-push-action/tree/master#usage + - name: Set up Docker Buildx (for multi-arch builds) 🐳 + uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # dependabot updates to latest release + - name: Set Up Python 🐍 uses: actions/setup-python@v3 with: From 2fe31005a4ef78ebfe2ee1e24716bc8d928c28b7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:34:37 +0300 Subject: [PATCH 040/129] Try to use simple docker commands --- .github/actions/create-dev-env/action.yml | 10 ------- .github/workflows/build-docker.yml | 33 +++------------------- .github/workflows/sub-build-push-image.yml | 20 +++++++------ 3 files changed, 16 insertions(+), 47 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 71b0cb74fd..2956e9c9b4 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -11,16 +11,6 @@ runs: # sudo rm -rf /opt/ghc # shell: bash - # Setup docker to build for multiple platforms, see: - # https://github.com/docker/build-push-action/tree/master#usage - # https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md - - name: Set up QEMU (for docker buildx) 🐳 - uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release - - # https://github.com/docker/build-push-action/tree/master#usage - - name: Set up Docker Buildx (for multi-arch builds) 🐳 - uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # dependabot updates to latest release - - name: Set Up Python 🐍 uses: actions/setup-python@v3 with: diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 8bd62291c4..303a44f502 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -59,6 +59,7 @@ jobs: parentImageName: "" imageName: base-notebook platform: amd64 + runsOn: ubuntu-latest test-amd64-base-notebook: needs: [build-amd64-base-notebook] @@ -66,6 +67,7 @@ jobs: with: imageName: base-notebook platform: amd64 + runsOn: ubuntu-latest build-amd64-minimal-notebook: needs: [build-amd64-base-notebook] @@ -74,6 +76,7 @@ jobs: parentImageName: base-notebook imageName: minimal-notebook platform: amd64 + runsOn: ubuntu-latest test-amd64-minimal-notebook: needs: [build-amd64-minimal-notebook] @@ -81,32 +84,4 @@ jobs: with: imageName: minimal-notebook platform: amd64 - - build-arm64-base-notebook: - uses: ./.github/workflows/sub-build-push-image.yml - with: - parentImageName: "" - imageName: base-notebook - platform: arm64 - - test-arm64-base-notebook: - needs: [build-arm64-base-notebook] - uses: ./.github/workflows/sub-test-image.yml - with: - imageName: base-notebook - platform: arm64 - - build-arm64-minimal-notebook: - needs: [build-arm64-base-notebook] - uses: ./.github/workflows/sub-build-push-image.yml - with: - parentImageName: base-notebook - imageName: minimal-notebook - platform: arm64 - - test-arm64-minimal-notebook: - needs: [build-arm64-minimal-notebook] - uses: ./.github/workflows/sub-test-image.yml - with: - imageName: minimal-notebook - platform: arm64 + runsOn: ubuntu-latest diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 554e1f0936..647726542a 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -15,10 +15,14 @@ on: description: "Target platform for the built image" required: true type: string + runsOn: + description: "Image to be run on" + required: true + type: string jobs: build-push-image: - runs-on: ubuntu-latest + runs-on: ${{ inputs.runsOn }} steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 @@ -39,13 +43,13 @@ jobs: shell: bash - name: Build image 🛠 - uses: docker/build-push-action@v3 - with: - context: ${{ inputs.imageName }}/ - file: ${{ inputs.imageName }}/Dockerfile - tags: jupyter/${{ inputs.imageName }}:latest - outputs: type=docker,dest=/tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar - platforms: linux/${{ inputs.platform }} + working-directory: ${{ inputs.imageName }} + run: docker build --tag jupyter/${{ inputs.imageName }} --tag jupyter/${{ inputs.imageName }} . + shell: bash + - name: Save image as a file 💾 + run: docker save jupyter/base-notebook -o /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar + shell: bash + - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: From dea81a82e49218ae439a3a96aa3cd0850c5c4459 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:37:11 +0300 Subject: [PATCH 041/129] Fix --- .github/workflows/sub-test-image.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 9ed31468ce..98a4ea3182 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -11,10 +11,14 @@ on: description: "Target platform for the built image" required: true type: string + runsOn: + description: "Image to be run on" + required: true + type: string jobs: test-image: - runs-on: ubuntu-latest + runs-on: ${{ inputs.runsOn }} steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 From ddb993af5a4c3ee3160370a1fb3137300b1332c8 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:47:05 +0300 Subject: [PATCH 042/129] Fix --- .github/workflows/sub-build-push-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 647726542a..71cc0bb0e2 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -47,7 +47,7 @@ jobs: run: docker build --tag jupyter/${{ inputs.imageName }} --tag jupyter/${{ inputs.imageName }} . shell: bash - name: Save image as a file 💾 - run: docker save jupyter/base-notebook -o /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar + run: docker save jupyter/${{ inputs.imageName }} -o /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar shell: bash - name: Upload artifact 💾 From 5b03f3a5b1baeea01529f433561b9af2e39be55d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 19:49:33 +0300 Subject: [PATCH 043/129] Better build --- .github/workflows/sub-build-push-image.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 71cc0bb0e2..8d998476ec 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -45,6 +45,10 @@ jobs: - name: Build image 🛠 working-directory: ${{ inputs.imageName }} run: docker build --tag jupyter/${{ inputs.imageName }} --tag jupyter/${{ inputs.imageName }} . + env: + DOCKER_BUILDKIT: 1 + # Full logs for CI build + BUILDKIT_PROGRESS: plain shell: bash - name: Save image as a file 💾 run: docker save jupyter/${{ inputs.imageName }} -o /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar From 539159f0d195ebe990b33d9f5bc19d2168694043 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 20:35:16 +0300 Subject: [PATCH 044/129] Add amd64 images tagging and push to DockerHub --- .github/workflows/build-docker.yml | 11 +++++ .github/workflows/sub-tag-push-image.yml | 53 ++++++++++++++++++++++++ tagging/tag_image.py | 2 +- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sub-tag-push-image.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 303a44f502..7e7a4e73ea 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -85,3 +85,14 @@ jobs: imageName: minimal-notebook platform: amd64 runsOn: ubuntu-latest + + amd64-images-tag-push: + needs: [test-amd64-base-notebook, test-amd64-minimal-notebook] + strategy: + matrix: + image: [base-notebook, minimal-notebook] + uses: ./.github/workflows/sub-tag-push-image.yml + with: + imageName: ${{ matrix.image }} + platform: amd64 + runsOn: ubuntu-latest diff --git a/.github/workflows/sub-tag-push-image.yml b/.github/workflows/sub-tag-push-image.yml new file mode 100644 index 0000000000..4dcf0ff839 --- /dev/null +++ b/.github/workflows/sub-tag-push-image.yml @@ -0,0 +1,53 @@ +name: Download image artifact from GitHub artifacts, tag it and push to DockerHub + +on: + workflow_call: + inputs: + imageName: + description: "Image name to be pushed" + required: true + type: string + platform: + description: "Target platform for the built image" + required: true + type: string + runsOn: + description: "Image to be run on" + required: true + type: string + +jobs: + test-image: + runs-on: ${{ inputs.runsOn }} + steps: + - name: Checkout Repo ⚡️ + uses: actions/checkout@v3 + - name: Create dev environment 📦 + uses: ./.github/actions/create-dev-env + + - name: Download built image 📥 + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.imageName }}-${{ inputs.platform }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + run: | + docker load --input /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar + docker image ls -a + shell: bash + + - name: Create tags and manifest 🏷 + run: python3 -m tagging.tag_image --short-image-name ${{ inputs.imageName }} + shell: bash + + - 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/${{ inputs.imageName }} + shell: bash diff --git a/tagging/tag_image.py b/tagging/tag_image.py index 55c614f23a..07daa0c0bb 100755 --- a/tagging/tag_image.py +++ b/tagging/tag_image.py @@ -56,7 +56,7 @@ def tag_image(short_image_name: str, owner: str) -> None: required=True, help="Short image name to apply tags for", ) - arg_parser.add_argument("--owner", required=True, help="Owner of the image") + arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") args = arg_parser.parse_args() tag_image(args.short_image_name, args.owner) From 35bff63286492adb334c206e0fdad16f3686d3fe Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 20:41:32 +0300 Subject: [PATCH 045/129] Fix --- .github/workflows/build-docker.yml | 5 +---- .github/workflows/sub-tag-push-image.yml | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 7e7a4e73ea..97f1700ae2 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -88,11 +88,8 @@ jobs: amd64-images-tag-push: needs: [test-amd64-base-notebook, test-amd64-minimal-notebook] - strategy: - matrix: - image: [base-notebook, minimal-notebook] uses: ./.github/workflows/sub-tag-push-image.yml with: - imageName: ${{ matrix.image }} platform: amd64 runsOn: ubuntu-latest + imageName: base-notebook diff --git a/.github/workflows/sub-tag-push-image.yml b/.github/workflows/sub-tag-push-image.yml index 4dcf0ff839..cdbad8cece 100644 --- a/.github/workflows/sub-tag-push-image.yml +++ b/.github/workflows/sub-tag-push-image.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: imageName: - description: "Image name to be pushed" + description: "Image name to be built" required: true type: string platform: @@ -17,7 +17,7 @@ on: type: string jobs: - test-image: + tag-push-images: runs-on: ${{ inputs.runsOn }} steps: - name: Checkout Repo ⚡️ From a8a7314c77e30f35967eaf0cf8997cf1bd557646 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 20:42:05 +0300 Subject: [PATCH 046/129] Better naming --- .github/workflows/sub-build-push-image.yml | 2 +- .github/workflows/sub-tag-push-image.yml | 4 ++-- .github/workflows/sub-test-image.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 8d998476ec..805cd942a0 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -12,7 +12,7 @@ on: required: true type: string platform: - description: "Target platform for the built image" + description: "Image platform" required: true type: string runsOn: diff --git a/.github/workflows/sub-tag-push-image.yml b/.github/workflows/sub-tag-push-image.yml index cdbad8cece..e417b9b3a7 100644 --- a/.github/workflows/sub-tag-push-image.yml +++ b/.github/workflows/sub-tag-push-image.yml @@ -4,11 +4,11 @@ on: workflow_call: inputs: imageName: - description: "Image name to be built" + description: "Image name to be pushed" required: true type: string platform: - description: "Target platform for the built image" + description: "Image platform" required: true type: string runsOn: diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 98a4ea3182..826910e62c 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -8,7 +8,7 @@ on: required: true type: string platform: - description: "Target platform for the built image" + description: "Image platform" required: true type: string runsOn: From 739003d1445f7ab3aee07950c6110e87eecbefc4 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:10:10 +0300 Subject: [PATCH 047/129] Refactor github workflows --- .github/actions/load-image/action.yml | 28 ++++++++++++++++++ .github/workflows/build-docker.yml | 30 +++++++++---------- .github/workflows/sub-build-push-image.yml | 34 +++++++++------------- .github/workflows/sub-tag-push-image.yml | 21 +++++-------- .github/workflows/sub-test-image.yml | 19 +++++------- 5 files changed, 72 insertions(+), 60 deletions(-) create mode 100644 .github/actions/load-image/action.yml diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml new file mode 100644 index 0000000000..8c99b6449f --- /dev/null +++ b/.github/actions/load-image/action.yml @@ -0,0 +1,28 @@ +name: "Load image" +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 📥 + if: ${{ inputs.image != '' }} + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.image }}-${{ inputs.platform }} + path: /tmp/ + - name: Load downloaded image to docker 📥 + if: ${{ inputs.image != '' }} + run: | + docker load --input /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar + docker image ls -a + shell: bash diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 97f1700ae2..9a17f308ca 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -53,43 +53,43 @@ concurrency: cancel-in-progress: true jobs: - build-amd64-base-notebook: + build-amd64-base: uses: ./.github/workflows/sub-build-push-image.yml with: - parentImageName: "" - imageName: base-notebook + parentImage: "" + image: base-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-base-notebook: - needs: [build-amd64-base-notebook] + test-amd64-base: + needs: [build-amd64-base] uses: ./.github/workflows/sub-test-image.yml with: - imageName: base-notebook + image: base-notebook platform: amd64 runsOn: ubuntu-latest - build-amd64-minimal-notebook: - needs: [build-amd64-base-notebook] + build-amd64-minimal: + needs: [build-amd64-base] uses: ./.github/workflows/sub-build-push-image.yml with: - parentImageName: base-notebook - imageName: minimal-notebook + parentImage: base-notebook + image: minimal-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-minimal-notebook: - needs: [build-amd64-minimal-notebook] + test-amd64-minimal: + needs: [build-amd64-minimal] uses: ./.github/workflows/sub-test-image.yml with: - imageName: minimal-notebook + image: minimal-notebook platform: amd64 runsOn: ubuntu-latest amd64-images-tag-push: - needs: [test-amd64-base-notebook, test-amd64-minimal-notebook] + needs: [test-amd64-base, test-amd64-minimal] uses: ./.github/workflows/sub-tag-push-image.yml with: platform: amd64 runsOn: ubuntu-latest - imageName: base-notebook + image: base-notebook diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index 805cd942a0..b432dd940a 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -3,12 +3,12 @@ name: Download parent image, build new one, push it to GitHub artifacts on: workflow_call: inputs: - imageName: - description: "Image name to be built" + parentImage: + description: "Parent image name" required: true type: string - parentImageName: - description: "Parent image name" + image: + description: "Image name" required: true type: string platform: @@ -16,7 +16,7 @@ on: required: true type: string runsOn: - description: "Image to be run on" + description: "GitHub Actions Runner image" required: true type: string @@ -30,32 +30,26 @@ jobs: uses: ./.github/actions/create-dev-env - name: Download parent built image 📥 - if: ${{ inputs.parentImageName != '' }} - uses: actions/download-artifact@v3 + if: ${{ inputs.parentImage != '' }} + uses: ./.github/actions/create-dev-env with: - name: ${{ inputs.parentImageName }}-${{ inputs.platform }} - path: /tmp/ - - name: Load downloaded image to docker 📥 - if: ${{ inputs.parentImageName != '' }} - run: | - docker load --input /tmp/${{ inputs.parentImageName }}-${{ inputs.platform }}.tar - docker image ls -a - shell: bash + image: ${{ inputs.parentImage }} + platform: ${{ inputs.platform }} - name: Build image 🛠 - working-directory: ${{ inputs.imageName }} - run: docker build --tag jupyter/${{ inputs.imageName }} --tag jupyter/${{ inputs.imageName }} . + working-directory: ${{ inputs.image }} + run: docker build --tag jupyter/${{ inputs.image }} --tag jupyter/${{ inputs.image }} . env: DOCKER_BUILDKIT: 1 # Full logs for CI build BUILDKIT_PROGRESS: plain shell: bash - name: Save image as a file 💾 - run: docker save jupyter/${{ inputs.imageName }} -o /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar + run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar shell: bash - name: Upload artifact 💾 uses: actions/upload-artifact@v3 with: - name: ${{ inputs.imageName }}-${{ inputs.platform }} - path: /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar + name: ${{ inputs.image }}-${{ inputs.platform }} + path: /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar diff --git a/.github/workflows/sub-tag-push-image.yml b/.github/workflows/sub-tag-push-image.yml index e417b9b3a7..8a6417c846 100644 --- a/.github/workflows/sub-tag-push-image.yml +++ b/.github/workflows/sub-tag-push-image.yml @@ -3,8 +3,8 @@ name: Download image artifact from GitHub artifacts, tag it and push to DockerHu on: workflow_call: inputs: - imageName: - description: "Image name to be pushed" + image: + description: "Image name" required: true type: string platform: @@ -12,7 +12,7 @@ on: required: true type: string runsOn: - description: "Image to be run on" + description: "GitHub Actions Runner image" required: true type: string @@ -26,18 +26,13 @@ jobs: uses: ./.github/actions/create-dev-env - name: Download built image 📥 - uses: actions/download-artifact@v3 + uses: ./.github/actions/create-dev-env with: - name: ${{ inputs.imageName }}-${{ inputs.platform }} - path: /tmp/ - - name: Load downloaded image to docker 📥 - run: | - docker load --input /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar - docker image ls -a - shell: bash + image: ${{ inputs.image }} + platform: ${{ inputs.platform }} - name: Create tags and manifest 🏷 - run: python3 -m tagging.tag_image --short-image-name ${{ inputs.imageName }} + run: python3 -m tagging.tag_image --short-image-name ${{ inputs.image }} shell: bash - name: Login to Docker Hub 🔐 @@ -49,5 +44,5 @@ jobs: - 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/${{ inputs.imageName }} + run: docker push --all-tags jupyter/${{ inputs.image }} shell: bash diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 826910e62c..4fb1b464da 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -3,8 +3,8 @@ name: Download image artifact from GitHub artifacts and test it on: workflow_call: inputs: - imageName: - description: "Image name to be tested" + image: + description: "Image name" required: true type: string platform: @@ -12,7 +12,7 @@ on: required: true type: string runsOn: - description: "Image to be run on" + description: "GitHub Actions Runner image" required: true type: string @@ -26,16 +26,11 @@ jobs: uses: ./.github/actions/create-dev-env - name: Download built image 📥 - uses: actions/download-artifact@v3 + uses: ./.github/actions/create-dev-env with: - name: ${{ inputs.imageName }}-${{ inputs.platform }} - path: /tmp/ - - name: Load downloaded image to docker 📥 - run: | - docker load --input /tmp/${{ inputs.imageName }}-${{ inputs.platform }}.tar - docker image ls -a - shell: bash + image: ${{ inputs.image }} + platform: ${{ inputs.platform }} - name: Run tests ✅ - run: python3 -m tests.run_tests --short-image-name ${{ inputs.imageName }} + run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }} shell: bash From f7bc1c1b3130f69d3e62f78c21390d8e55100fa3 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:13:34 +0300 Subject: [PATCH 048/129] Fix --- .github/workflows/build-docker.yml | 2 ++ .github/workflows/sub-build-push-image.yml | 4 ++-- .github/workflows/sub-test-image.yml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 9a17f308ca..8806ac5120 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -10,6 +10,7 @@ on: - ".github/workflows/sub-build-push-image.yml" - ".github/workflows/sub-test-image.yml" - ".github/actions/create-dev-env/action.yml" + - ".github/actions/load-image/action.yml" - "all-spark-notebook/**" - "base-notebook/**" @@ -32,6 +33,7 @@ on: - ".github/workflows/sub-build-push-image.yml" - ".github/workflows/sub-test-image.yml" - ".github/actions/create-dev-env/action.yml" + - ".github/actions/load-image/action.yml" - "all-spark-notebook/**" - "base-notebook/**" diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-push-image.yml index b432dd940a..18aaf48f47 100644 --- a/.github/workflows/sub-build-push-image.yml +++ b/.github/workflows/sub-build-push-image.yml @@ -1,4 +1,4 @@ -name: Download parent image, build new one, push it to GitHub artifacts +name: Download parent image, build new one, upload it to GitHub artifacts on: workflow_call: @@ -31,7 +31,7 @@ jobs: - name: Download parent built image 📥 if: ${{ inputs.parentImage != '' }} - uses: ./.github/actions/create-dev-env + uses: ./.github/actions/load-image with: image: ${{ inputs.parentImage }} platform: ${{ inputs.platform }} diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 4fb1b464da..73b1db9d65 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -26,7 +26,7 @@ jobs: uses: ./.github/actions/create-dev-env - name: Download built image 📥 - uses: ./.github/actions/create-dev-env + uses: ./.github/actions/load-image with: image: ${{ inputs.image }} platform: ${{ inputs.platform }} From a936129ea5721ed3eaeb3880c95b45fe466654ca Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:13:42 +0300 Subject: [PATCH 049/129] Fix --- .github/workflows/sub-tag-push-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sub-tag-push-image.yml b/.github/workflows/sub-tag-push-image.yml index 8a6417c846..8da7b2431e 100644 --- a/.github/workflows/sub-tag-push-image.yml +++ b/.github/workflows/sub-tag-push-image.yml @@ -26,7 +26,7 @@ jobs: uses: ./.github/actions/create-dev-env - name: Download built image 📥 - uses: ./.github/actions/create-dev-env + uses: ./.github/actions/load-image with: image: ${{ inputs.image }} platform: ${{ inputs.platform }} From ec841b9e8384225c122625c17f5005548078db2b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:15:51 +0300 Subject: [PATCH 050/129] Better workflow name --- .github/workflows/build-docker.yml | 8 ++++---- ...ub-build-push-image.yml => sub-build-upload-image.yml} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{sub-build-push-image.yml => sub-build-upload-image.yml} (100%) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 8806ac5120..f7b6b95625 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -7,7 +7,7 @@ on: pull_request: paths: - ".github/workflows/build-docker.yml" - - ".github/workflows/sub-build-push-image.yml" + - ".github/workflows/sub-build-upload-image.yml" - ".github/workflows/sub-test-image.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -30,7 +30,7 @@ on: - master paths: - ".github/workflows/build-docker.yml" - - ".github/workflows/sub-build-push-image.yml" + - ".github/workflows/sub-build-upload-image.yml" - ".github/workflows/sub-test-image.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -56,7 +56,7 @@ concurrency: jobs: build-amd64-base: - uses: ./.github/workflows/sub-build-push-image.yml + uses: ./.github/workflows/sub-build-upload-image.yml with: parentImage: "" image: base-notebook @@ -73,7 +73,7 @@ jobs: build-amd64-minimal: needs: [build-amd64-base] - uses: ./.github/workflows/sub-build-push-image.yml + uses: ./.github/workflows/sub-build-upload-image.yml with: parentImage: base-notebook image: minimal-notebook diff --git a/.github/workflows/sub-build-push-image.yml b/.github/workflows/sub-build-upload-image.yml similarity index 100% rename from .github/workflows/sub-build-push-image.yml rename to .github/workflows/sub-build-upload-image.yml From 91b70a85bf3172a86b4e4388800050d2dbe52a77 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:21:25 +0300 Subject: [PATCH 051/129] Better push workflow --- .github/workflows/build-docker.yml | 12 ++++++++---- ...g-push-image.yml => sub-tag-push-images.yml} | 17 +++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) rename .github/workflows/{sub-tag-push-image.yml => sub-tag-push-images.yml} (82%) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f7b6b95625..17a8762e2a 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -8,7 +8,7 @@ on: paths: - ".github/workflows/build-docker.yml" - ".github/workflows/sub-build-upload-image.yml" - - ".github/workflows/sub-test-image.yml" + - ".github/workflows/sub-test-images.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -31,7 +31,7 @@ on: paths: - ".github/workflows/build-docker.yml" - ".github/workflows/sub-build-upload-image.yml" - - ".github/workflows/sub-test-image.yml" + - ".github/workflows/sub-test-images.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -82,7 +82,7 @@ jobs: test-amd64-minimal: needs: [build-amd64-minimal] - uses: ./.github/workflows/sub-test-image.yml + uses: ./.github/workflows/sub-test-images.yml with: image: minimal-notebook platform: amd64 @@ -94,4 +94,8 @@ jobs: with: platform: amd64 runsOn: ubuntu-latest - image: base-notebook + # https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + # The strategy property is not supported in any job that calls a reusable workflow + # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 + images: >- + ["base-notebook", "minimal-notebook"] diff --git a/.github/workflows/sub-tag-push-image.yml b/.github/workflows/sub-tag-push-images.yml similarity index 82% rename from .github/workflows/sub-tag-push-image.yml rename to .github/workflows/sub-tag-push-images.yml index 8da7b2431e..67c00e7f17 100644 --- a/.github/workflows/sub-tag-push-image.yml +++ b/.github/workflows/sub-tag-push-images.yml @@ -3,8 +3,8 @@ name: Download image artifact from GitHub artifacts, tag it and push to DockerHu on: workflow_call: inputs: - image: - description: "Image name" + images: + description: "Stringified JSON object listing image names" required: true type: string platform: @@ -19,6 +19,11 @@ on: jobs: tag-push-images: runs-on: ${{ inputs.runsOn }} + + strategy: + matrix: + image: ${{fromJson(inputs.images)}} + steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 @@ -28,11 +33,11 @@ jobs: - name: Download built image 📥 uses: ./.github/actions/load-image with: - image: ${{ inputs.image }} + image: ${{ matrix.image }} platform: ${{ inputs.platform }} - - name: Create tags and manifest 🏷 - run: python3 -m tagging.tag_image --short-image-name ${{ inputs.image }} + - name: Create tags 🏷 + run: python3 -m tagging.tag_image --short-image-name ${{ matrix.image }} shell: bash - name: Login to Docker Hub 🔐 @@ -44,5 +49,5 @@ jobs: - 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/${{ inputs.image }} + run: docker push --all-tags jupyter/${{ matrix.image }} shell: bash From 6322b79c7eb9506da04d4693e750aebc35205f49 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:23:26 +0300 Subject: [PATCH 052/129] Fix --- .github/workflows/build-docker.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 17a8762e2a..b0841c0e59 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -8,7 +8,9 @@ on: paths: - ".github/workflows/build-docker.yml" - ".github/workflows/sub-build-upload-image.yml" - - ".github/workflows/sub-test-images.yml" + - ".github/workflows/sub-test-image.yml" + - ".github/workflows/sub-tag-push-images.yml" + - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -31,7 +33,9 @@ on: paths: - ".github/workflows/build-docker.yml" - ".github/workflows/sub-build-upload-image.yml" - - ".github/workflows/sub-test-images.yml" + - ".github/workflows/sub-test-image.yml" + - ".github/workflows/sub-tag-push-images.yml" + - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" From c5c38f9c2924489c748275f216530f0c829d52e0 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:23:39 +0300 Subject: [PATCH 053/129] Fix --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index b0841c0e59..f104862053 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -86,7 +86,7 @@ jobs: test-amd64-minimal: needs: [build-amd64-minimal] - uses: ./.github/workflows/sub-test-images.yml + uses: ./.github/workflows/sub-test-image.yml with: image: minimal-notebook platform: amd64 From 6ce871a26d7048343f4e02aac56a275b6a4b2010 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:25:27 +0300 Subject: [PATCH 054/129] Fix --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f104862053..ef9fcc9ec0 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -94,7 +94,7 @@ jobs: amd64-images-tag-push: needs: [test-amd64-base, test-amd64-minimal] - uses: ./.github/workflows/sub-tag-push-image.yml + uses: ./.github/workflows/sub-tag-push-images.yml with: platform: amd64 runsOn: ubuntu-latest From edc115c1439712dbb46164b65f7d3cded1b51ada Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:30:03 +0300 Subject: [PATCH 055/129] Refactor --- .github/actions/load-image/action.yml | 2 -- .github/workflows/sub-build-upload-image.yml | 2 +- .github/workflows/sub-tag-push-images.yml | 4 ++-- .github/workflows/sub-test-image.yml | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index 8c99b6449f..c76ccccac7 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -15,13 +15,11 @@ runs: using: "composite" steps: - name: Download built image 📥 - if: ${{ inputs.image != '' }} uses: actions/download-artifact@v3 with: name: ${{ inputs.image }}-${{ inputs.platform }} path: /tmp/ - name: Load downloaded image to docker 📥 - if: ${{ inputs.image != '' }} run: | docker load --input /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar docker image ls -a diff --git a/.github/workflows/sub-build-upload-image.yml b/.github/workflows/sub-build-upload-image.yml index 18aaf48f47..a5db7c57e0 100644 --- a/.github/workflows/sub-build-upload-image.yml +++ b/.github/workflows/sub-build-upload-image.yml @@ -29,7 +29,7 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Download parent built image 📥 + - name: Load parent built image to docker 📥 if: ${{ inputs.parentImage != '' }} uses: ./.github/actions/load-image with: diff --git a/.github/workflows/sub-tag-push-images.yml b/.github/workflows/sub-tag-push-images.yml index 67c00e7f17..d23197baaa 100644 --- a/.github/workflows/sub-tag-push-images.yml +++ b/.github/workflows/sub-tag-push-images.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: - image: ${{fromJson(inputs.images)}} + image: ${{ fromJson(inputs.images) }} steps: - name: Checkout Repo ⚡️ @@ -30,7 +30,7 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Download built image 📥 + - name: Load image to docker 📥 uses: ./.github/actions/load-image with: image: ${{ matrix.image }} diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 73b1db9d65..996087981f 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -25,7 +25,7 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Download built image 📥 + - name: Load image to docker 📥 uses: ./.github/actions/load-image with: image: ${{ inputs.image }} From 8e11fcdb7930fbbda6ab62992578d0f086972ba1 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:47:27 +0300 Subject: [PATCH 056/129] Add tags prefix support --- tagging/github_set_env.py | 11 ----------- tagging/tag_image.py | 31 ++++++++++++++++++------------- 2 files changed, 18 insertions(+), 24 deletions(-) delete mode 100644 tagging/github_set_env.py diff --git a/tagging/github_set_env.py b/tagging/github_set_env.py deleted file mode 100644 index 299540edca..0000000000 --- a/tagging/github_set_env.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. -import os - - -def github_set_env(env_name: str, env_value: str) -> None: - if not os.environ.get("GITHUB_ACTIONS") or not os.environ.get("GITHUB_ENV"): - return - - with open(os.environ["GITHUB_ENV"], "a") as f: - f.write(f"{env_name}={env_value}\n") diff --git a/tagging/tag_image.py b/tagging/tag_image.py index 07daa0c0bb..74b612157e 100755 --- a/tagging/tag_image.py +++ b/tagging/tag_image.py @@ -3,19 +3,24 @@ # Distributed under the terms of the Modified BSD License. import argparse import logging +import platform import plumbum from tagging.docker_runner import DockerRunner from tagging.get_taggers_and_manifests import get_taggers_and_manifests -from tagging.github_set_env import github_set_env docker = plumbum.local["docker"] LOGGER = logging.getLogger(__name__) -def tag_image(short_image_name: str, owner: str) -> None: +def get_tags_prefix() -> str: + machine = platform.machine() + return "" if machine == "x86_64" else f"{machine}-" + + +def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: """ Tags /:latest with the tags reported by all taggers for the given image. @@ -29,22 +34,19 @@ def tag_image(short_image_name: str, owner: str) -> None: image = f"{owner}/{short_image_name}:latest" with DockerRunner(image) as container: - tags = [] for tagger in taggers: tagger_name = tagger.__class__.__name__ tag_value = tagger.tag_value(container) - tags.append(tag_value) LOGGER.info( f"Applying tag, tagger_name: {tagger_name} tag_value: {tag_value}" ) - docker["tag", image, f"{owner}/{short_image_name}:{tag_value}"]() - - if tags: - env_name = f'{short_image_name.replace("-", "_")}_EXTRA_TAG_ARGS' - docker_build_tag_args = " ".join( - [f"-t {owner}/{short_image_name}:{tag}" for tag in tags] - ) - github_set_env(env_name, docker_build_tag_args) + docker[ + "tag", image, f"{owner}/{short_image_name}:{tags_prefix}{tag_value}" + ]() + if tags_prefix != "": + LOGGER.info("Changing :latest tag to include tags_prefix") + docker["tag", image, f"{owner}/{short_image_name}:{tags_prefix}latest"]() + docker["rmi", image]() if __name__ == "__main__": @@ -59,4 +61,7 @@ def tag_image(short_image_name: str, owner: str) -> None: arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") args = arg_parser.parse_args() - tag_image(args.short_image_name, args.owner) + tags_prefix = get_tags_prefix() + LOGGER.info(f"Using: {tags_prefix=}") + + tag_image(args.short_image_name, args.owner, tags_prefix) From b9e294c1a660dfe87b1a3f909a9157c8d635a4cb Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:50:09 +0300 Subject: [PATCH 057/129] Small refactor --- .github/workflows/sub-build-upload-image.yml | 2 +- .github/workflows/sub-tag-push-images.yml | 2 +- .github/workflows/sub-test-image.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sub-build-upload-image.yml b/.github/workflows/sub-build-upload-image.yml index a5db7c57e0..ddd29c87a9 100644 --- a/.github/workflows/sub-build-upload-image.yml +++ b/.github/workflows/sub-build-upload-image.yml @@ -21,7 +21,7 @@ on: type: string jobs: - build-push-image: + build-upload: runs-on: ${{ inputs.runsOn }} steps: - name: Checkout Repo ⚡️ diff --git a/.github/workflows/sub-tag-push-images.yml b/.github/workflows/sub-tag-push-images.yml index d23197baaa..6a5375d56d 100644 --- a/.github/workflows/sub-tag-push-images.yml +++ b/.github/workflows/sub-tag-push-images.yml @@ -17,7 +17,7 @@ on: type: string jobs: - tag-push-images: + tag-push: runs-on: ${{ inputs.runsOn }} strategy: diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/sub-test-image.yml index 996087981f..e6e6a20c73 100644 --- a/.github/workflows/sub-test-image.yml +++ b/.github/workflows/sub-test-image.yml @@ -17,7 +17,7 @@ on: type: string jobs: - test-image: + test: runs-on: ${{ inputs.runsOn }} steps: - name: Checkout Repo ⚡️ From 1170727c1992fcd9c7e4bf0f1d920ec1955753ce Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 12 May 2022 23:55:34 +0300 Subject: [PATCH 058/129] Rename workflows --- ...load-image.yml => docker-build-upload.yml} | 0 ...ag-push-images.yml => docker-tag-push.yml} | 0 .../{sub-test-image.yml => docker-test.yml} | 0 .../{build-docker.yml => docker.yml} | 28 +++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) rename .github/workflows/{sub-build-upload-image.yml => docker-build-upload.yml} (100%) rename .github/workflows/{sub-tag-push-images.yml => docker-tag-push.yml} (100%) rename .github/workflows/{sub-test-image.yml => docker-test.yml} (100%) rename .github/workflows/{build-docker.yml => docker.yml} (76%) diff --git a/.github/workflows/sub-build-upload-image.yml b/.github/workflows/docker-build-upload.yml similarity index 100% rename from .github/workflows/sub-build-upload-image.yml rename to .github/workflows/docker-build-upload.yml diff --git a/.github/workflows/sub-tag-push-images.yml b/.github/workflows/docker-tag-push.yml similarity index 100% rename from .github/workflows/sub-tag-push-images.yml rename to .github/workflows/docker-tag-push.yml diff --git a/.github/workflows/sub-test-image.yml b/.github/workflows/docker-test.yml similarity index 100% rename from .github/workflows/sub-test-image.yml rename to .github/workflows/docker-test.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/docker.yml similarity index 76% rename from .github/workflows/build-docker.yml rename to .github/workflows/docker.yml index ef9fcc9ec0..340bbc606b 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: Build and test Docker Images +name: Build, test and push Docker Images on: schedule: @@ -6,10 +6,10 @@ on: - cron: "0 3 * * 1" pull_request: paths: - - ".github/workflows/build-docker.yml" - - ".github/workflows/sub-build-upload-image.yml" - - ".github/workflows/sub-test-image.yml" - - ".github/workflows/sub-tag-push-images.yml" + - ".github/workflows/docker.yml" + - ".github/workflows/docker-build-upload.yml" + - ".github/workflows/docker-test.yml" + - ".github/workflows/docker-tag-push.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -31,10 +31,10 @@ on: - main - master paths: - - ".github/workflows/build-docker.yml" - - ".github/workflows/sub-build-upload-image.yml" - - ".github/workflows/sub-test-image.yml" - - ".github/workflows/sub-tag-push-images.yml" + - ".github/workflows/docker.yml" + - ".github/workflows/docker-build-upload.yml" + - ".github/workflows/docker-test.yml" + - ".github/workflows/docker-tag-push.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -60,7 +60,7 @@ concurrency: jobs: build-amd64-base: - uses: ./.github/workflows/sub-build-upload-image.yml + uses: ./.github/workflows/docker-build-upload.yml with: parentImage: "" image: base-notebook @@ -69,7 +69,7 @@ jobs: test-amd64-base: needs: [build-amd64-base] - uses: ./.github/workflows/sub-test-image.yml + uses: ./.github/workflows/docker-test.yml with: image: base-notebook platform: amd64 @@ -77,7 +77,7 @@ jobs: build-amd64-minimal: needs: [build-amd64-base] - uses: ./.github/workflows/sub-build-upload-image.yml + uses: ./.github/workflows/docker-build-upload.yml with: parentImage: base-notebook image: minimal-notebook @@ -86,7 +86,7 @@ jobs: test-amd64-minimal: needs: [build-amd64-minimal] - uses: ./.github/workflows/sub-test-image.yml + uses: ./.github/workflows/docker-test.yml with: image: minimal-notebook platform: amd64 @@ -94,7 +94,7 @@ jobs: amd64-images-tag-push: needs: [test-amd64-base, test-amd64-minimal] - uses: ./.github/workflows/sub-tag-push-images.yml + uses: ./.github/workflows/docker-tag-push.yml with: platform: amd64 runsOn: ubuntu-latest From 5ff0ecd8ba2cf9972b50c63c0030d6815ef0466d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 00:54:04 +0300 Subject: [PATCH 059/129] Upload manifests in workflow --- ...-push.yml => docker-tag-manifest-push.yml} | 14 +++++ .github/workflows/docker.yml | 6 +- tagging/tag_image.py | 8 +-- tagging/tags_prefix.py | 8 +++ ...create_manifests.py => write_manifests.py} | 57 +++++++++---------- 5 files changed, 52 insertions(+), 41 deletions(-) rename .github/workflows/{docker-tag-push.yml => docker-tag-manifest-push.yml} (74%) create mode 100644 tagging/tags_prefix.py rename tagging/{create_manifests.py => write_manifests.py} (64%) diff --git a/.github/workflows/docker-tag-push.yml b/.github/workflows/docker-tag-manifest-push.yml similarity index 74% rename from .github/workflows/docker-tag-push.yml rename to .github/workflows/docker-tag-manifest-push.yml index 6a5375d56d..fa4f18a556 100644 --- a/.github/workflows/docker-tag-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -40,6 +40,20 @@ jobs: 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 }} + shell: bash + - name: Upload manifest file 💾 + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.image }}-${{ inputs.platform }}-manifest + path: /tmp/manifests/*.md + - name: Upload build history line 💾 + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.image }}-${{ inputs.platform }}-history_line + path: /tmp/build_history_lines/*.txt + - 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 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 340bbc606b..70733958cd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,7 +9,7 @@ on: - ".github/workflows/docker.yml" - ".github/workflows/docker-build-upload.yml" - ".github/workflows/docker-test.yml" - - ".github/workflows/docker-tag-push.yml" + - ".github/workflows/docker-tag-manifest-push.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -34,7 +34,7 @@ on: - ".github/workflows/docker.yml" - ".github/workflows/docker-build-upload.yml" - ".github/workflows/docker-test.yml" - - ".github/workflows/docker-tag-push.yml" + - ".github/workflows/docker-tag-manifest-push.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -94,7 +94,7 @@ jobs: amd64-images-tag-push: needs: [test-amd64-base, test-amd64-minimal] - uses: ./.github/workflows/docker-tag-push.yml + uses: ./.github/workflows/docker-tag-manifest-push.yml with: platform: amd64 runsOn: ubuntu-latest diff --git a/tagging/tag_image.py b/tagging/tag_image.py index 74b612157e..629930bb4d 100755 --- a/tagging/tag_image.py +++ b/tagging/tag_image.py @@ -3,23 +3,18 @@ # Distributed under the terms of the Modified BSD License. import argparse import logging -import platform import plumbum from tagging.docker_runner import DockerRunner from tagging.get_taggers_and_manifests import get_taggers_and_manifests +from tagging.tags_prefix import get_tags_prefix docker = plumbum.local["docker"] LOGGER = logging.getLogger(__name__) -def get_tags_prefix() -> str: - machine = platform.machine() - return "" if machine == "x86_64" else f"{machine}-" - - def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: """ Tags /:latest with the tags reported by all taggers @@ -62,6 +57,5 @@ def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: args = arg_parser.parse_args() tags_prefix = get_tags_prefix() - LOGGER.info(f"Using: {tags_prefix=}") tag_image(args.short_image_name, args.owner, tags_prefix) diff --git a/tagging/tags_prefix.py b/tagging/tags_prefix.py new file mode 100644 index 0000000000..beb8507d7e --- /dev/null +++ b/tagging/tags_prefix.py @@ -0,0 +1,8 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +import platform + + +def get_tags_prefix() -> str: + machine = platform.machine() + return "" if machine == "x86_64" else f"{machine}-" diff --git a/tagging/create_manifests.py b/tagging/write_manifests.py similarity index 64% rename from tagging/create_manifests.py rename to tagging/write_manifests.py index 3771db1e6d..1753fa6a47 100755 --- a/tagging/create_manifests.py +++ b/tagging/write_manifests.py @@ -4,7 +4,7 @@ import argparse import datetime import logging -import os +from pathlib import Path from docker.models.containers import Container @@ -12,6 +12,7 @@ from tagging.get_taggers_and_manifests import get_taggers_and_manifests from tagging.git_helper import GitHelper from tagging.manifests import ManifestHeader, ManifestInterface +from tagging.tags_prefix import get_tags_prefix LOGGER = logging.getLogger(__name__) @@ -20,10 +21,10 @@ MARKDOWN_LINE_BREAK = "
" -def append_build_history_line( +def write_build_history_line( short_image_name: str, owner: str, - wiki_path: str, + manifest_filename: str, all_tags: list[str], ) -> None: LOGGER.info("Appending build history line") @@ -33,60 +34,55 @@ def append_build_history_line( f"`{owner}/{short_image_name}:{tag_value}`" for tag_value in all_tags ) commit_hash = GitHelper.commit_hash() - commit_hash_tag = GitHelper.commit_hash_tag() 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}/{short_image_name}/Dockerfile)", - f"[Build manifest](./{short_image_name}-{commit_hash_tag})", + f"[Build manifest](./{manifest_filename.removesuffix('.md')})", ] ) build_history_line = "|".join([date_column, image_column, links_column]) + "|" - - home_wiki_file = os.path.join(wiki_path, "Home.md") - with open(home_wiki_file) as f: - file = f.read() - TABLE_BEGINNING = "|-|-|-|\n" - file = file.replace(TABLE_BEGINNING, TABLE_BEGINNING + build_history_line + "\n") - with open(home_wiki_file, "w") as f: - f.write(file) + build_history_filename = manifest_filename.replace(".md", ".txt") + Path(f"/tmp/build_history_lines/{build_history_filename}").write_text( + build_history_line + ) -def create_manifest_file( +def write_manifest_file( short_image_name: str, owner: str, - wiki_path: str, + manifest_filename: str, manifests: list[ManifestInterface], container: Container, ) -> None: manifest_names = [manifest.__class__.__name__ for manifest in manifests] LOGGER.info(f"Using manifests: {manifest_names}") - commit_hash_tag = GitHelper.commit_hash_tag() - manifest_file = os.path.join( - wiki_path, - f"manifests/{short_image_name}-{commit_hash_tag}.md", - ) - markdown_pieces = [ ManifestHeader.create_header(short_image_name, owner, BUILD_TIMESTAMP) ] + [manifest.markdown_piece(container) for manifest in manifests] markdown_content = "\n\n".join(markdown_pieces) + "\n" - with open(manifest_file, "w") as f: - f.write(markdown_content) + Path(f"/tmp/manifests/{manifest_filename}").write_text(markdown_content) -def create_manifests(short_image_name: str, owner: str, wiki_path: str) -> None: +def write_manifests(short_image_name: str, owner: str) -> None: LOGGER.info(f"Creating manifests for image: {short_image_name}") taggers, manifests = get_taggers_and_manifests(short_image_name) image = f"{owner}/{short_image_name}:latest" + tags_prefix = get_tags_prefix() + commit_hash_tag = GitHelper.commit_hash_tag() + filename = f"{tags_prefix}{short_image_name}-{commit_hash_tag}.md" + manifest_filename = f"{filename}.md" + with DockerRunner(image) as container: - all_tags = [tagger.tag_value(container) for tagger in taggers] - append_build_history_line(short_image_name, owner, wiki_path, all_tags) - create_manifest_file(short_image_name, owner, wiki_path, manifests, container) + all_tags = [tags_prefix + tagger.tag_value(container) for tagger in taggers] + write_build_history_line(short_image_name, owner, all_tags) + write_manifest_file( + short_image_name, owner, manifest_filename, manifests, container + ) if __name__ == "__main__": @@ -96,12 +92,11 @@ def create_manifests(short_image_name: str, owner: str, wiki_path: str) -> None: arg_parser.add_argument( "--short-image-name", required=True, - help="Short image name to apply tags for", + help="Short image name to create manifests for", ) - arg_parser.add_argument("--owner", required=True, help="Owner of the image") - arg_parser.add_argument("--wiki-path", required=True, help="Path to the wiki pages") + arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") args = arg_parser.parse_args() LOGGER.info(f"Current build timestamp: {BUILD_TIMESTAMP}") - create_manifests(args.short_image_name, args.owner, args.wiki_path) + write_manifests(args.short_image_name, args.owner) From 3bd471438b5c952dc2016446892a0c85cac596a3 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 00:59:56 +0300 Subject: [PATCH 060/129] Fix --- tagging/write_manifests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tagging/write_manifests.py b/tagging/write_manifests.py index 1753fa6a47..bcab8beeac 100755 --- a/tagging/write_manifests.py +++ b/tagging/write_manifests.py @@ -79,7 +79,7 @@ def write_manifests(short_image_name: str, owner: str) -> None: with DockerRunner(image) as container: all_tags = [tags_prefix + tagger.tag_value(container) for tagger in taggers] - write_build_history_line(short_image_name, owner, all_tags) + write_build_history_line(short_image_name, owner, manifest_filename, all_tags) write_manifest_file( short_image_name, owner, manifest_filename, manifests, container ) From 3389922c19c350aa7ebfc86ba639ef09163455e9 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 01:15:27 +0300 Subject: [PATCH 061/129] Add args to call write_manifests --- .../workflows/docker-tag-manifest-push.yml | 2 +- tagging/write_manifests.py | 49 +++++++++++++------ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index fa4f18a556..bdb7810292 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -41,7 +41,7 @@ jobs: shell: bash - name: Write manifest files 🏷 - run: python3 -m tagging.write_manifests --short-image-name ${{ matrix.image }} + 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 diff --git a/tagging/write_manifests.py b/tagging/write_manifests.py index bcab8beeac..56d588d0b0 100755 --- a/tagging/write_manifests.py +++ b/tagging/write_manifests.py @@ -24,7 +24,8 @@ def write_build_history_line( short_image_name: str, owner: str, - manifest_filename: str, + hist_line_dir: Path, + filename: str, all_tags: list[str], ) -> None: LOGGER.info("Appending build history line") @@ -38,20 +39,19 @@ def write_build_history_line( [ f"[Git diff](https://github.com/jupyter/docker-stacks/commit/{commit_hash})", f"[Dockerfile](https://github.com/jupyter/docker-stacks/blob/{commit_hash}/{short_image_name}/Dockerfile)", - f"[Build manifest](./{manifest_filename.removesuffix('.md')})", + f"[Build manifest](./{filename})", ] ) build_history_line = "|".join([date_column, image_column, links_column]) + "|" - build_history_filename = manifest_filename.replace(".md", ".txt") - Path(f"/tmp/build_history_lines/{build_history_filename}").write_text( - build_history_line - ) + hist_line_dir.mkdir(parents=True, exist_ok=True) + (hist_line_dir / f"{filename}.txt").write_text(build_history_line) def write_manifest_file( short_image_name: str, owner: str, - manifest_filename: str, + manifest_dir: Path, + filename: str, manifests: list[ManifestInterface], container: Container, ) -> None: @@ -63,10 +63,16 @@ def write_manifest_file( ] + [manifest.markdown_piece(container) for manifest in manifests] markdown_content = "\n\n".join(markdown_pieces) + "\n" - Path(f"/tmp/manifests/{manifest_filename}").write_text(markdown_content) + manifest_dir.mkdir(parents=True, exist_ok=True) + (manifest_dir / f"{filename}.md").write_text(markdown_content) -def write_manifests(short_image_name: str, owner: str) -> None: +def write_manifests( + short_image_name: str, + owner: str, + hist_line_dir: Path, + manifest_dir: Path, +) -> None: LOGGER.info(f"Creating manifests for image: {short_image_name}") taggers, manifests = get_taggers_and_manifests(short_image_name) @@ -74,14 +80,15 @@ def write_manifests(short_image_name: str, owner: str) -> None: tags_prefix = get_tags_prefix() commit_hash_tag = GitHelper.commit_hash_tag() - filename = f"{tags_prefix}{short_image_name}-{commit_hash_tag}.md" - manifest_filename = f"{filename}.md" + filename = f"{tags_prefix}{short_image_name}-{commit_hash_tag}" with DockerRunner(image) as container: all_tags = [tags_prefix + tagger.tag_value(container) for tagger in taggers] - write_build_history_line(short_image_name, owner, manifest_filename, all_tags) + write_build_history_line( + short_image_name, owner, hist_line_dir, filename, all_tags + ) write_manifest_file( - short_image_name, owner, manifest_filename, manifests, container + short_image_name, owner, manifest_dir, filename, manifests, container ) @@ -94,9 +101,23 @@ def write_manifests(short_image_name: str, owner: str) -> None: required=True, help="Short image name to create manifests for", ) + arg_parser.add_argument( + "--hist-line-dir", + required=True, + type=Path, + help="Directory to save history line", + ) + arg_parser.add_argument( + "--manifest-dir", + required=True, + type=Path, + help="Directory to save manifest file", + ) arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") args = arg_parser.parse_args() LOGGER.info(f"Current build timestamp: {BUILD_TIMESTAMP}") - write_manifests(args.short_image_name, args.owner) + write_manifests( + args.short_image_name, args.owner, args.hist_line_dir, args.manifest_dir + ) From f80d45c73b48d3e11bb8307f33b39e8b5be8ce03 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 01:19:00 +0300 Subject: [PATCH 062/129] Run only on base-notebook --- .github/workflows/docker.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 70733958cd..b7ac977633 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -75,25 +75,25 @@ jobs: platform: amd64 runsOn: ubuntu-latest - build-amd64-minimal: - needs: [build-amd64-base] - uses: ./.github/workflows/docker-build-upload.yml - with: - parentImage: base-notebook - image: minimal-notebook - platform: amd64 - runsOn: ubuntu-latest + # build-amd64-minimal: + # needs: [build-amd64-base] + # uses: ./.github/workflows/docker-build-upload.yml + # with: + # parentImage: base-notebook + # image: minimal-notebook + # platform: amd64 + # runsOn: ubuntu-latest - test-amd64-minimal: - needs: [build-amd64-minimal] - uses: ./.github/workflows/docker-test.yml - with: - image: minimal-notebook - platform: amd64 - runsOn: ubuntu-latest + # test-amd64-minimal: + # needs: [build-amd64-minimal] + # uses: ./.github/workflows/docker-test.yml + # with: + # image: minimal-notebook + # platform: amd64 + # runsOn: ubuntu-latest amd64-images-tag-push: - needs: [test-amd64-base, test-amd64-minimal] + needs: [test-amd64-base] uses: ./.github/workflows/docker-tag-manifest-push.yml with: platform: amd64 @@ -102,4 +102,4 @@ jobs: # The strategy property is not supported in any job that calls a reusable workflow # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 images: >- - ["base-notebook", "minimal-notebook"] + ["base-notebook"] From 38eddd8da9c43803aaba4704a49cb3a0d516aedf Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 01:34:10 +0300 Subject: [PATCH 063/129] Fix --- .github/workflows/docker-tag-manifest-push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index bdb7810292..8ed20c03fd 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -46,12 +46,12 @@ jobs: - name: Upload manifest file 💾 uses: actions/upload-artifact@v3 with: - name: ${{ inputs.image }}-${{ inputs.platform }}-manifest + name: ${{ matrix.image }}-${{ inputs.platform }}-manifest path: /tmp/manifests/*.md - name: Upload build history line 💾 uses: actions/upload-artifact@v3 with: - name: ${{ inputs.image }}-${{ inputs.platform }}-history_line + name: ${{ matrix.image }}-${{ inputs.platform }}-history_line path: /tmp/build_history_lines/*.txt - name: Login to Docker Hub 🔐 From 4407e14e6eb240cb6f2dec31831291ed3f7fcacb Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 01:36:04 +0300 Subject: [PATCH 064/129] Fix hist lines dir --- .github/workflows/docker-tag-manifest-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index 8ed20c03fd..70963f1a7b 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -52,7 +52,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ matrix.image }}-${{ inputs.platform }}-history_line - path: /tmp/build_history_lines/*.txt + path: /tmp/hist_lines/*.txt - name: Login to Docker Hub 🔐 if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' From f534a62cc966aa11102d95b26b743014923e2fcc Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 01:58:05 +0300 Subject: [PATCH 065/129] Add docker wiki workflow --- .github/workflows/docker-wiki.yml | 48 +++++++++++++++++++++++++++++++ .github/workflows/docker.yml | 2 ++ tagging/update_wiki_page.py | 44 ++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 .github/workflows/docker-wiki.yml create mode 100644 tagging/update_wiki_page.py diff --git a/.github/workflows/docker-wiki.yml b/.github/workflows/docker-wiki.yml new file mode 100644 index 0000000000..2d5e366070 --- /dev/null +++ b/.github/workflows/docker-wiki.yml @@ -0,0 +1,48 @@ +name: Download manifest artifacts from GitHub, tag and push to DockerHub +# We're doing everything in one workflow on purpose +# This way we make sure we don't access wiki pages from several jobs simultaneously + +on: + workflow_call: + +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 + + # To make this workflow easier to implement, we download all artifacts + # https://github.com/actions/download-artifact/issues/6 + - name: Download all artifacts 📥 + uses: actions/download-artifact@v3 + with: + path: /tmp/artifacts/ + - name: Display structure of downloaded files + run: ls - R + working-directory: /tmp/artifacts/ + shell: bash + + - name: Checkout Wiki Repo 📃 + uses: actions/checkout@v3 + with: + repository: ${{github.repository}}.wiki + path: wiki/ + + - name: Update wiki page 🏷 + run: python3 -m tests.update_wiki_page --wiki-dir wiki/ --artifacts-dir /tmp/artifacts/ + shell: bash + + - name: Push Wiki to GitHub 📤 + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' + uses: stefanzweifel/git-auto-commit-action@5804e42f86b1891093b151b6c4e78e759c746c4d # dependabot updates to latest release + with: + commit_message: "Automated wiki publish for ${{github.sha}}" + repository: wiki/ diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b7ac977633..dac9a2f909 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,6 +10,7 @@ on: - ".github/workflows/docker-build-upload.yml" - ".github/workflows/docker-test.yml" - ".github/workflows/docker-tag-manifest-push.yml" + - ".github/workflows/docker-wiki.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -35,6 +36,7 @@ on: - ".github/workflows/docker-build-upload.yml" - ".github/workflows/docker-test.yml" - ".github/workflows/docker-tag-manifest-push.yml" + - ".github/workflows/docker-wiki.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py new file mode 100644 index 0000000000..b163fd8310 --- /dev/null +++ b/tagging/update_wiki_page.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +import argparse +import logging +import shutil +from pathlib import Path + + +def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: + home_wiki_file = wiki_dir / "Home.md" + file = home_wiki_file.read(home_wiki_file) + + build_history_line_files = artifacts_dir.rglob("**/*.txt") + build_history_lines = "\n".join( + hist_line_file.read_text() for hist_line_file in build_history_line_files + ) + TABLE_BEGINNING = "|-|-|-|\n" + file = file.replace(TABLE_BEGINNING, TABLE_BEGINNING + build_history_lines + "\n") + home_wiki_file.write(file) + + for file in artifacts_dir.rglob("**/*.md"): + shutil.copy(file, wiki_dir / file.name) + + +if __name__ == "__main__": + logging.basicConfig(level=logging.INFO) + + arg_parser = argparse.ArgumentParser() + arg_parser.add_argument( + "--wiki-dir", + required=True, + type=Path, + help="Directory for wiki repo", + ) + arg_parser.add_argument( + "--artifacts-dir", + required=True, + type=Path, + help="Directory to save history line", + ) + args = arg_parser.parse_args() + + update_wiki_page(args.wiki_dir, args.artifacts_dir) From b5bfa8b819eb9ddc45bb3de14e69cc4d44fdc97f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:02:21 +0300 Subject: [PATCH 066/129] Fix --- tagging/update_wiki_page.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py index b163fd8310..e1e9183565 100644 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -9,7 +9,7 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: home_wiki_file = wiki_dir / "Home.md" - file = home_wiki_file.read(home_wiki_file) + file = home_wiki_file.read_text(home_wiki_file) build_history_line_files = artifacts_dir.rglob("**/*.txt") build_history_lines = "\n".join( @@ -17,7 +17,7 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: ) TABLE_BEGINNING = "|-|-|-|\n" file = file.replace(TABLE_BEGINNING, TABLE_BEGINNING + build_history_lines + "\n") - home_wiki_file.write(file) + home_wiki_file.write_text(file) for file in artifacts_dir.rglob("**/*.md"): shutil.copy(file, wiki_dir / file.name) From 616069dd46fe81ac40a99bb5390d8e3d267e8644 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:03:05 +0300 Subject: [PATCH 067/129] Fix double tagging --- .github/workflows/docker-build-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index ddd29c87a9..2f85c53b2c 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -38,7 +38,7 @@ jobs: - name: Build image 🛠 working-directory: ${{ inputs.image }} - run: docker build --tag jupyter/${{ inputs.image }} --tag jupyter/${{ inputs.image }} . + run: docker build --tag jupyter/${{ inputs.image }} . env: DOCKER_BUILDKIT: 1 # Full logs for CI build From e6c598f2391c0563c200ebc593a999663e8214a9 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:05:24 +0300 Subject: [PATCH 068/129] Run command from root --- .github/workflows/docker-build-upload.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index 2f85c53b2c..f63820cf87 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -37,8 +37,7 @@ jobs: platform: ${{ inputs.platform }} - name: Build image 🛠 - working-directory: ${{ inputs.image }} - run: docker build --tag jupyter/${{ inputs.image }} . + run: docker build --tag jupyter/${{ inputs.image }} ${{ inputs.image }}/ env: DOCKER_BUILDKIT: 1 # Full logs for CI build From a5203d861bd416d521659c85dba4527a93999c58 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:11:30 +0300 Subject: [PATCH 069/129] Fix update_wiki_page.py --- tagging/update_wiki_page.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py index e1e9183565..63d230acc5 100644 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -8,19 +8,21 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: - home_wiki_file = wiki_dir / "Home.md" - file = home_wiki_file.read_text(home_wiki_file) + wiki_home_file = wiki_dir / "Home.md" + wiki_home_content = wiki_home_file.read_text() build_history_line_files = artifacts_dir.rglob("**/*.txt") build_history_lines = "\n".join( hist_line_file.read_text() for hist_line_file in build_history_line_files ) TABLE_BEGINNING = "|-|-|-|\n" - file = file.replace(TABLE_BEGINNING, TABLE_BEGINNING + build_history_lines + "\n") - home_wiki_file.write_text(file) + wiki_home_content = wiki_home_content.replace( + TABLE_BEGINNING, TABLE_BEGINNING + build_history_lines + "\n" + ) + wiki_home_file.write_text(wiki_home_content) - for file in artifacts_dir.rglob("**/*.md"): - shutil.copy(file, wiki_dir / file.name) + for manifest_file in artifacts_dir.rglob("**/*.md"): + shutil.copy(manifest_file, wiki_dir / manifest_file.name) if __name__ == "__main__": From 36319f99d4d41de3f3355ce060a03e8afe1a4732 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:23:12 +0300 Subject: [PATCH 070/129] Wiki update fixes --- .../{docker-wiki.yml => docker-wiki-update.yml} | 10 ++-------- .github/workflows/docker.yml | 8 ++++++-- 2 files changed, 8 insertions(+), 10 deletions(-) rename .github/workflows/{docker-wiki.yml => docker-wiki-update.yml} (89%) diff --git a/.github/workflows/docker-wiki.yml b/.github/workflows/docker-wiki-update.yml similarity index 89% rename from .github/workflows/docker-wiki.yml rename to .github/workflows/docker-wiki-update.yml index 2d5e366070..f1b363bdf7 100644 --- a/.github/workflows/docker-wiki.yml +++ b/.github/workflows/docker-wiki-update.yml @@ -7,12 +7,7 @@ on: jobs: tag-push: - runs-on: ${{ inputs.runsOn }} - - strategy: - matrix: - image: ${{ fromJson(inputs.images) }} - + runs-on: ubuntu-latest steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v3 @@ -26,8 +21,7 @@ jobs: with: path: /tmp/artifacts/ - name: Display structure of downloaded files - run: ls - R - working-directory: /tmp/artifacts/ + run: ls -R /tmp/artifacts/ shell: bash - name: Checkout Wiki Repo 📃 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index dac9a2f909..cd1796e5cb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,7 +10,7 @@ on: - ".github/workflows/docker-build-upload.yml" - ".github/workflows/docker-test.yml" - ".github/workflows/docker-tag-manifest-push.yml" - - ".github/workflows/docker-wiki.yml" + - ".github/workflows/docker-wiki-update.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -36,7 +36,7 @@ on: - ".github/workflows/docker-build-upload.yml" - ".github/workflows/docker-test.yml" - ".github/workflows/docker-tag-manifest-push.yml" - - ".github/workflows/docker-wiki.yml" + - ".github/workflows/docker-wiki-update.yml" - ".github/actions/create-dev-env/action.yml" - ".github/actions/load-image/action.yml" @@ -105,3 +105,7 @@ jobs: # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 images: >- ["base-notebook"] + + wiki-update: + needs: [amd64-images-tag-push] + uses: ./.github/workflows/docker-wiki-update.yml From 944664eb28c663005a365973f335f67042683acf Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:34:49 +0300 Subject: [PATCH 071/129] Fix typo --- .github/workflows/docker-wiki-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-wiki-update.yml b/.github/workflows/docker-wiki-update.yml index f1b363bdf7..b19f0e6595 100644 --- a/.github/workflows/docker-wiki-update.yml +++ b/.github/workflows/docker-wiki-update.yml @@ -20,7 +20,7 @@ jobs: uses: actions/download-artifact@v3 with: path: /tmp/artifacts/ - - name: Display structure of downloaded files + - name: Display structure of downloaded files 🔍️ run: ls -R /tmp/artifacts/ shell: bash @@ -31,7 +31,7 @@ jobs: path: wiki/ - name: Update wiki page 🏷 - run: python3 -m tests.update_wiki_page --wiki-dir wiki/ --artifacts-dir /tmp/artifacts/ + run: python3 -m tagging.update_wiki_page --wiki-dir wiki/ --artifacts-dir /tmp/artifacts/ shell: bash - name: Push Wiki to GitHub 📤 From 0487c9966002b76b86b2825be3e42b25c95fdf74 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:35:47 +0300 Subject: [PATCH 072/129] Cleanup docs about multi platform builds --- Makefile | 78 +------------------- README.md | 11 +-- docs/contributing/tests.md | 10 +-- tagging/tag_image.py | 3 - tests/base-notebook/test_package_managers.py | 1 - 5 files changed, 7 insertions(+), 96 deletions(-) diff --git a/Makefile b/Makefile index 54b5f89db5..46ebc8b430 100644 --- a/Makefile +++ b/Makefile @@ -7,21 +7,6 @@ SHELL:=bash OWNER?=jupyter # Need to list the images in build dependency order - -# Images supporting the following architectures: -# - linux/amd64 -# - linux/arm64 -MULTI_IMAGES:= \ - base-notebook \ - minimal-notebook \ - r-notebook \ - scipy-notebook \ - pyspark-notebook \ - all-spark-notebook -# Images that can only be built on the amd64 architecture (aka. x86_64) -AMD64_ONLY_IMAGES:= \ - datascience-notebook \ - tensorflow-notebook # All of the images ALL_IMAGES:= \ base-notebook \ @@ -42,7 +27,7 @@ export DOCKER_BUILDKIT:=1 help: @echo "jupyter/docker-stacks" @echo "=====================" - @echo "Replace % with a stack directory name (e.g., make build-multi/minimal-notebook)" + @echo "Replace % with a stack directory name (e.g., make build/minimal-notebook)" @echo @grep -E '^[a-zA-Z0-9_%/-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @@ -57,60 +42,6 @@ build/%: ## build the latest image for a stack using the system's architecture @echo "::endgroup::" build-all: $(foreach I, $(ALL_IMAGES), build/$(I)) ## build all stacks -# Limitations on docker buildx build (using docker/buildx 0.5.1): -# -# 1. Can't --load and --push at the same time -# -# 2. Can't --load multiple platforms -# -# What does it mean to --load? -# -# - It means that the built image can be referenced by `docker` CLI, for example -# when using the `docker tag` or `docker push` commands. -# -# Workarounds due to limitations: -# -# 1. We always build a dedicated image using the current system architecture -# named as OWNER/-notebook so we always can reference that image no -# matter what during tests etc. -# -# 2. We always also build a multi-platform image during build-multi that will be -# inaccessible with `docker tag` and `docker push` etc, but this will help us -# test the build on the different platform and provide cached layers for -# later. -# -# 3. We let push-multi refer to rebuilding a multi image with `--push`. -# -# We can rely on the cached layer from build-multi now even though we never -# tagged the multi image. -# -# Outcomes of the workaround: -# -# 1. We can keep using the previously defined Makefile commands that doesn't -# include `-multi` suffix as before. -# -# 2. Assuming we have setup docker/dockerx properly to build in arm64 -# architectures as well, then we can build and publish such images via the -# `-multi` suffix without needing a local registry. -# -# 3. If we get dedicated arm64 runners, we can test everything separately -# without needing to update this Makefile, and if all tests succeeds we can -# do a publish job that creates a multi-platform image for us. -# -build-multi/%: DOCKER_BUILD_ARGS?= -build-multi/%: ## build the latest image for a stack on both amd64 and arm64 - @echo "::group::Build $(OWNER)/$(notdir $@) (system's architecture)" - docker buildx build $(DOCKER_BUILD_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --load - @echo -n "Built image size: " - @docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}" - @echo "::endgroup::" - - @echo "::group::Build $(OWNER)/$(notdir $@) (amd64,arm64)" - docker buildx build $(DOCKER_BUILD_ARGS) -t build-multi-tmp-cache/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64" - @echo "::endgroup::" -build-all-multi: $(foreach I, $(MULTI_IMAGES), build-multi/$(I)) $(foreach I, $(AMD64_ONLY_IMAGES), build/$(I)) ## build all stacks - - check-outdated/%: ## check the outdated mamba/conda packages in a stack and produce a report (experimental) @TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest tests/base-notebook/test_outdated.py @@ -176,13 +107,6 @@ push/%: ## push all tags for a jupyter image @echo "::endgroup::" push-all: $(foreach I, $(ALL_IMAGES), push/$(I)) ## push all tagged images -push-multi/%: DOCKER_BUILD_ARGS?= -push-multi/%: ## push all tags for a jupyter image that support multiple architectures - @echo "::group::Push $(OWNER)/$(notdir $@) (amd64,arm64)" - docker buildx build $(DOCKER_BUILD_ARGS) $($(subst -,_,$(notdir $@))_EXTRA_TAG_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64" --push - @echo "::endgroup::" -push-all-multi: $(foreach I, $(MULTI_IMAGES), push-multi/$(I)) $(foreach I, $(AMD64_ONLY_IMAGES), push/$(I)) ## push all tagged images - run-shell/%: ## run a bash in interactive mode in a stack diff --git a/README.md b/README.md index 5e933051c3..c04123d551 100644 --- a/README.md +++ b/README.md @@ -115,14 +115,9 @@ This change is tracked in the issue [#1217](https://github.com/jupyter/docker-st ## CPU Architectures -All published containers support amd64 (x86_64) and aarch64, except for `datascience-notebook` and `tensorflow-notebook`, which only support amd64 for now. +We published containers both for `amd64` (`x86_64`) and `aarch64`, except for `datascience-notebook` and `tensorflow-notebook`, which only support amd64 for now. ### Caveats for arm64 images -- The manifests we publish in this project's wiki as well as the image tags for - the multi-platform images that also support arm, are all based on the amd64 - version even though details about the installed packages versions could differ - between architectures. For the status about this, see - [#1401](https://github.com/jupyter/docker-stacks/issues/1401). -- Only the amd64 images are actively tested currently. For the status about - this, see [#1402](https://github.com/jupyter/docker-stacks/issues/1402). +- We do not create multi-platform images +- All arm64 images have `aarch64-` tag prefix, for example `jupyter/base-notebook:aarch64-python-3.9.6` diff --git a/docs/contributing/tests.md b/docs/contributing/tests.md index fff6c57833..87198a987a 100644 --- a/docs/contributing/tests.md +++ b/docs/contributing/tests.md @@ -5,11 +5,7 @@ We greatly appreciate pull requests that extend the automated tests that vet the ## How the Tests Work A [GitHub Action workflow](https://github.com/jupyter/docker-stacks/blob/master/.github/workflows/docker.yml) -runs the following commands against pull requests submitted to the `jupyter/docker-stacks` repository: - -1. `make build-all-multi` - which builds all the Docker images -2. `make test-all` - which tests the newly created Docker images - This `make` command builds and then tests every docker image. +runs tests against pull requests submitted to the `jupyter/docker-stacks` repository: We use `pytest` module to run tests on the image. `conftest.py` and `pytest.ini` in the `tests` folder define the environment in which tests are run. @@ -40,8 +36,8 @@ Please follow the process below to add new tests: If you use `make`, call: ```bash - make build/somestack-notebook - make test/somestack-notebook + make build/-notebook + make test/-notebook ``` 3. [Submit a pull request](https://github.com/PointCloudLibrary/pcl/wiki/A-step-by-step-guide-on-preparing-and-submitting-a-pull-request) diff --git a/tagging/tag_image.py b/tagging/tag_image.py index 629930bb4d..775baad45a 100755 --- a/tagging/tag_image.py +++ b/tagging/tag_image.py @@ -19,9 +19,6 @@ def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: """ Tags /:latest with the tags reported by all taggers for the given image. - - Tags are in a GitHub Actions environment also saved to environment variables - in a format making it easy to append them. """ LOGGER.info(f"Tagging image: {short_image_name}") taggers, _ = get_taggers_and_manifests(short_image_name) diff --git a/tests/base-notebook/test_package_managers.py b/tests/base-notebook/test_package_managers.py index dd5438399c..2ca16ec7b5 100644 --- a/tests/base-notebook/test_package_managers.py +++ b/tests/base-notebook/test_package_managers.py @@ -27,7 +27,6 @@ def test_package_manager( LOGGER.info( f"Test that the package manager {package_manager} is working properly ..." ) - # Increased timout to make aarch64 images tests work in QEMU container.run_and_wait( timeout=30, tty=True, From dbd5325837c836ba7b95ae4b0242331179458014 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:53:26 +0300 Subject: [PATCH 073/129] Improve wiki page update --- tagging/update_wiki_page.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py index 63d230acc5..cbc441a141 100644 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -6,10 +6,13 @@ import shutil from pathlib import Path +LOGGER = logging.getLogger(__name__) + def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: - wiki_home_file = wiki_dir / "Home.md" + LOGGER.info("Updating wiki page") + wiki_home_file = wiki_dir / "Home.md" wiki_home_content = wiki_home_file.read_text() build_history_line_files = artifacts_dir.rglob("**/*.txt") build_history_lines = "\n".join( @@ -20,9 +23,11 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: TABLE_BEGINNING, TABLE_BEGINNING + build_history_lines + "\n" ) wiki_home_file.write_text(wiki_home_content) + LOGGER.info("Wiki home file updated") for manifest_file in artifacts_dir.rglob("**/*.md"): - shutil.copy(manifest_file, wiki_dir / manifest_file.name) + shutil.copy(manifest_file, wiki_dir / "manifests" / manifest_file.name) + LOGGER.info(f"Manifest file added: {manifest_file.name}") if __name__ == "__main__": From cfb7fd6ca1924003a435b99c21df73af9db6bbcb Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:59:40 +0300 Subject: [PATCH 074/129] [TMP] Add test to check if image is freshly built --- base-notebook/Dockerfile | 1 + base-notebook/test-file.txt | 1 + tests/base-notebook/units/unit_check_file.py | 8 ++++++++ 3 files changed, 10 insertions(+) create mode 100644 base-notebook/test-file.txt create mode 100644 tests/base-notebook/units/unit_check_file.py diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 7943cbad76..7a2aebc22e 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -103,6 +103,7 @@ RUN mkdir "/home/${NB_USER}/work" && \ # Do all this in a single RUN command to avoid duplicating all of the # files across image layers when the permissions change COPY --chown="${NB_UID}:${NB_GID}" initial-condarc "${CONDA_DIR}/.condarc" +COPY --chown="${NB_UID}:${NB_GID}" test-file.txt /tmp/test-file.txt WORKDIR /tmp RUN set -x && \ arch=$(uname -m) && \ diff --git a/base-notebook/test-file.txt b/base-notebook/test-file.txt new file mode 100644 index 0000000000..bd83801f89 --- /dev/null +++ b/base-notebook/test-file.txt @@ -0,0 +1 @@ +test-content diff --git a/tests/base-notebook/units/unit_check_file.py b/tests/base-notebook/units/unit_check_file.py new file mode 100644 index 0000000000..ecc00719de --- /dev/null +++ b/tests/base-notebook/units/unit_check_file.py @@ -0,0 +1,8 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +from pathlib import Path + +file = Path("/tmp/test-file.txt") +assert file.exists() +assert file.read_text() == "test-content\n" From b6e25f3d34bf270fd7417d20510f4892a7db719a Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 03:01:23 +0300 Subject: [PATCH 075/129] Enable minimal-notebook build --- .github/workflows/docker.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cd1796e5cb..6254c04d5d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -77,25 +77,25 @@ jobs: platform: amd64 runsOn: ubuntu-latest - # build-amd64-minimal: - # needs: [build-amd64-base] - # uses: ./.github/workflows/docker-build-upload.yml - # with: - # parentImage: base-notebook - # image: minimal-notebook - # platform: amd64 - # runsOn: ubuntu-latest + build-amd64-minimal: + needs: [build-amd64-base] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: base-notebook + image: minimal-notebook + platform: amd64 + runsOn: ubuntu-latest - # test-amd64-minimal: - # needs: [build-amd64-minimal] - # uses: ./.github/workflows/docker-test.yml - # with: - # image: minimal-notebook - # platform: amd64 - # runsOn: ubuntu-latest + test-amd64-minimal: + needs: [build-amd64-minimal] + uses: ./.github/workflows/docker-test.yml + with: + image: minimal-notebook + platform: amd64 + runsOn: ubuntu-latest amd64-images-tag-push: - needs: [test-amd64-base] + needs: [test-amd64-base, test-amd64-minimal] uses: ./.github/workflows/docker-tag-manifest-push.yml with: platform: amd64 @@ -104,7 +104,7 @@ jobs: # The strategy property is not supported in any job that calls a reusable workflow # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 images: >- - ["base-notebook"] + ["base-notebook", "minimal-notebook"] wiki-update: needs: [amd64-images-tag-push] From 3ce4312155b7d388c8cd5b33cee3a37359b00f7d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 11:24:38 +0300 Subject: [PATCH 076/129] Test all amd64 images --- .github/workflows/docker.yml | 125 ++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6254c04d5d..2b798b19c2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -94,8 +94,120 @@ jobs: platform: amd64 runsOn: ubuntu-latest + build-amd64-scipy: + needs: [build-amd64-minimal] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: minimal-notebook + image: scipy-notebook + platform: amd64 + runsOn: ubuntu-latest + + test-amd64-scipy: + needs: [build-amd64-scipy] + uses: ./.github/workflows/docker-test.yml + with: + image: scipy-notebook + platform: amd64 + runsOn: ubuntu-latest + + build-amd64-r: + needs: [build-amd64-minimal] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: minimal-notebook + image: r-notebook + platform: amd64 + runsOn: ubuntu-latest + + test-amd64-r: + needs: [build-amd64-r] + uses: ./.github/workflows/docker-test.yml + with: + image: r-notebook + platform: amd64 + runsOn: ubuntu-latest + + build-amd64-tensorflow: + needs: [build-amd64-scipy] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: scipy-notebook + image: tensorflow-notebook + platform: amd64 + runsOn: ubuntu-latest + + test-amd64-tensorflow: + needs: [build-amd64-tensorflow] + uses: ./.github/workflows/docker-test.yml + with: + image: tensorflow-notebook + platform: amd64 + runsOn: ubuntu-latest + + build-amd64-datascience: + needs: [build-amd64-scipy] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: scipy-notebook + image: datascience-notebook + platform: amd64 + runsOn: ubuntu-latest + + test-amd64-datascience: + needs: [build-amd64-datascience] + uses: ./.github/workflows/docker-test.yml + with: + image: datascience-notebook + platform: amd64 + runsOn: ubuntu-latest + + build-amd64-pyspark: + needs: [build-amd64-scipy] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: scipy-notebook + image: pyspark-notebook + platform: amd64 + runsOn: ubuntu-latest + + test-amd64-pyspark: + needs: [build-amd64-pyspark] + uses: ./.github/workflows/docker-test.yml + with: + image: pyspark-notebook + platform: amd64 + runsOn: ubuntu-latest + + build-amd64-all-spark: + needs: [build-amd64-spark] + uses: ./.github/workflows/docker-build-upload.yml + with: + parentImage: spark-notebook + image: all-spark-notebook + platform: amd64 + runsOn: ubuntu-latest + + test-amd64-all-spark: + needs: [build-amd64-all-spark] + uses: ./.github/workflows/docker-test.yml + with: + image: all-spark-notebook + platform: amd64 + runsOn: ubuntu-latest + amd64-images-tag-push: - needs: [test-amd64-base, test-amd64-minimal] + needs: + [ + test-amd64-base, + test-amd64-minimal, + test-amd64-scipy, + test-amd64-r, + test-amd64-tensorflow, + test-amd64-datascience, + test-amd64-pyspark, + test-amd64-all-spark, + ] uses: ./.github/workflows/docker-tag-manifest-push.yml with: platform: amd64 @@ -104,7 +216,16 @@ jobs: # The strategy property is not supported in any job that calls a reusable workflow # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 images: >- - ["base-notebook", "minimal-notebook"] + [ + "base-notebook", + "minimal-notebook", + "scipy-notebook", + "r-notebook", + "tensorflow-notebook", + "datascience-notebook", + "pyspark-notebook", + "all-spark-notebook" + ] wiki-update: needs: [amd64-images-tag-push] From 940767ec4c539d76cdf1f140fc053af39416a283 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 11:26:28 +0300 Subject: [PATCH 077/129] Fix typo --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2b798b19c2..45430b7095 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -180,10 +180,10 @@ jobs: runsOn: ubuntu-latest build-amd64-all-spark: - needs: [build-amd64-spark] + needs: [build-amd64-pyspark] uses: ./.github/workflows/docker-build-upload.yml with: - parentImage: spark-notebook + parentImage: pyspark-notebook image: all-spark-notebook platform: amd64 runsOn: ubuntu-latest From 4b22cb0d02e8df1e1f43fd270298bb5791e1d8f8 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 11:51:27 +0300 Subject: [PATCH 078/129] Revert timeout increase because we don't use QEMU as now --- tests/base-notebook/test_package_managers.py | 2 +- tests/minimal-notebook/test_nbconvert.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/base-notebook/test_package_managers.py b/tests/base-notebook/test_package_managers.py index 2ca16ec7b5..d831b1e6de 100644 --- a/tests/base-notebook/test_package_managers.py +++ b/tests/base-notebook/test_package_managers.py @@ -28,7 +28,7 @@ def test_package_manager( f"Test that the package manager {package_manager} is working properly ..." ) container.run_and_wait( - timeout=30, + timeout=5, tty=True, command=["start.sh", "bash", "-c", f"{package_manager} {version_arg}"], ) diff --git a/tests/minimal-notebook/test_nbconvert.py b/tests/minimal-notebook/test_nbconvert.py index 5434554559..dabeba4d9c 100644 --- a/tests/minimal-notebook/test_nbconvert.py +++ b/tests/minimal-notebook/test_nbconvert.py @@ -33,7 +33,7 @@ def test_nbconvert( ) command = f"jupyter nbconvert {cont_data_dir}/{test_file}.ipynb --output-dir {output_dir} --to {output_format}" logs = container.run_and_wait( - timeout=120, + timeout=30, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, tty=True, command=["start.sh", "bash", "-c", command], From 6ad55a30d02524821b359a6189e5ae079ab6e974 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 11:51:46 +0300 Subject: [PATCH 079/129] Fix typo in docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c04123d551..c63557a1ae 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ This change is tracked in the issue [#1217](https://github.com/jupyter/docker-st ## CPU Architectures -We published containers both for `amd64` (`x86_64`) and `aarch64`, except for `datascience-notebook` and `tensorflow-notebook`, which only support amd64 for now. +We publish containers both for `amd64` (`x86_64`) and `aarch64`, except for `datascience-notebook` and `tensorflow-notebook`, which only support amd64 for now. ### Caveats for arm64 images From 6844487913abd8304cf0339349368756e7b772b7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 11:52:10 +0300 Subject: [PATCH 080/129] Use better rglob to prevent future problems --- tagging/update_wiki_page.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py index cbc441a141..bbc3ec44b7 100644 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -14,7 +14,7 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: wiki_home_file = wiki_dir / "Home.md" wiki_home_content = wiki_home_file.read_text() - build_history_line_files = artifacts_dir.rglob("**/*.txt") + build_history_line_files = artifacts_dir.rglob("*-history_line/*.txt") build_history_lines = "\n".join( hist_line_file.read_text() for hist_line_file in build_history_line_files ) @@ -25,7 +25,7 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: wiki_home_file.write_text(wiki_home_content) LOGGER.info("Wiki home file updated") - for manifest_file in artifacts_dir.rglob("**/*.md"): + for manifest_file in artifacts_dir.rglob("*-manifest/*.md"): shutil.copy(manifest_file, wiki_dir / "manifests" / manifest_file.name) LOGGER.info(f"Manifest file added: {manifest_file.name}") From 2db847f38877976e2099c286d8ecc8bf2aedf66e Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 12:57:24 +0300 Subject: [PATCH 081/129] Add docker build options --- .github/workflows/docker-build-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index f63820cf87..5e95fd5c38 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -37,7 +37,7 @@ jobs: platform: ${{ inputs.platform }} - name: Build image 🛠 - run: docker build --tag jupyter/${{ inputs.image }} ${{ inputs.image }}/ + run: docker build --rm --force-rm --tag jupyter/${{ inputs.image }} ${{ inputs.image }}/ env: DOCKER_BUILDKIT: 1 # Full logs for CI build From 25a82e5e235043c6b42a3dc0baaa4634b9f1d117 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 13:39:28 +0300 Subject: [PATCH 082/129] Download only manifest files --- .github/actions/download-manifests/action.yml | 101 ++++++++++++++++++ .github/workflows/docker-wiki-update.yml | 11 +- .github/workflows/docker.yml | 2 + tagging/update_wiki_page.py | 16 ++- 4 files changed, 119 insertions(+), 11 deletions(-) create mode 100644 .github/actions/download-manifests/action.yml mode change 100644 => 100755 tagging/update_wiki_page.py diff --git a/.github/actions/download-manifests/action.yml b/.github/actions/download-manifests/action.yml new file mode 100644 index 0000000000..c716f02a3d --- /dev/null +++ b/.github/actions/download-manifests/action.yml @@ -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 }} diff --git a/.github/workflows/docker-wiki-update.yml b/.github/workflows/docker-wiki-update.yml index b19f0e6595..6cfc87595d 100644 --- a/.github/workflows/docker-wiki-update.yml +++ b/.github/workflows/docker-wiki-update.yml @@ -14,12 +14,11 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - # To make this workflow easier to implement, we download all artifacts - # https://github.com/actions/download-artifact/issues/6 - - name: Download all artifacts 📥 - uses: actions/download-artifact@v3 + - name: Download all manifests and history lines 📥 + uses: ./.github/actions/download-manifests with: - path: /tmp/artifacts/ + histLineDir: /tmp/hist_lines/ + manifestDir: /tmp/manifests/ - name: Display structure of downloaded files 🔍️ run: ls -R /tmp/artifacts/ shell: bash @@ -31,7 +30,7 @@ jobs: path: wiki/ - name: Update wiki page 🏷 - run: python3 -m tagging.update_wiki_page --wiki-dir wiki/ --artifacts-dir /tmp/artifacts/ + run: python3 -m tagging.update_wiki_page --wiki-dir wiki/ --hist-line-dir /tmp/hist_lines/ --manifest-dir /tmp/manifests/ shell: bash - name: Push Wiki to GitHub 📤 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 45430b7095..6f801c72df 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,6 +13,7 @@ on: - ".github/workflows/docker-wiki-update.yml" - ".github/actions/create-dev-env/action.yml" + - ".github/actions/download-manifests/action.yml" - ".github/actions/load-image/action.yml" - "all-spark-notebook/**" @@ -39,6 +40,7 @@ on: - ".github/workflows/docker-wiki-update.yml" - ".github/actions/create-dev-env/action.yml" + - ".github/actions/download-manifests/action.yml" - ".github/actions/load-image/action.yml" - "all-spark-notebook/**" diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py old mode 100644 new mode 100755 index bbc3ec44b7..3cd2b918f6 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -9,12 +9,12 @@ LOGGER = logging.getLogger(__name__) -def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: +def update_wiki_page(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None: LOGGER.info("Updating wiki page") wiki_home_file = wiki_dir / "Home.md" wiki_home_content = wiki_home_file.read_text() - build_history_line_files = artifacts_dir.rglob("*-history_line/*.txt") + build_history_line_files = hist_line_dir.rglob("*.txt") build_history_lines = "\n".join( hist_line_file.read_text() for hist_line_file in build_history_line_files ) @@ -25,7 +25,7 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: wiki_home_file.write_text(wiki_home_content) LOGGER.info("Wiki home file updated") - for manifest_file in artifacts_dir.rglob("*-manifest/*.md"): + for manifest_file in manifest_dir.rglob("*.md"): shutil.copy(manifest_file, wiki_dir / "manifests" / manifest_file.name) LOGGER.info(f"Manifest file added: {manifest_file.name}") @@ -41,11 +41,17 @@ def update_wiki_page(wiki_dir: Path, artifacts_dir: Path) -> None: help="Directory for wiki repo", ) arg_parser.add_argument( - "--artifacts-dir", + "--hist-line-dir", required=True, type=Path, help="Directory to save history line", ) + arg_parser.add_argument( + "--manifest-dir", + required=True, + type=Path, + help="Directory to save manifest file", + ) args = arg_parser.parse_args() - update_wiki_page(args.wiki_dir, args.artifacts_dir) + update_wiki_page(args.wiki_dir, args.hist_line_dir, args.manifest_dir) From 4f1d8a6b30c2b66a7cff4e5c5196c0a8f09dddc3 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 14:33:48 +0300 Subject: [PATCH 083/129] Fix paths --- .github/workflows/docker-wiki-update.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-wiki-update.yml b/.github/workflows/docker-wiki-update.yml index 6cfc87595d..a427365569 100644 --- a/.github/workflows/docker-wiki-update.yml +++ b/.github/workflows/docker-wiki-update.yml @@ -20,7 +20,9 @@ jobs: histLineDir: /tmp/hist_lines/ manifestDir: /tmp/manifests/ - name: Display structure of downloaded files 🔍️ - run: ls -R /tmp/artifacts/ + run: | + ls -R /tmp/hist_lines/ + ls -R /tmp/manifests/ shell: bash - name: Checkout Wiki Repo 📃 From 7a3794313e0dcd7c9411022628a96146514e7232 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 15:00:09 +0300 Subject: [PATCH 084/129] Set retention days on uploaded artifacts --- .github/workflows/docker-build-upload.yml | 1 + .github/workflows/docker-tag-manifest-push.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index 5e95fd5c38..3e39296f3c 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -52,3 +52,4 @@ jobs: with: name: ${{ inputs.image }}-${{ inputs.platform }} path: /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar + retention-days: 3 diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index 70963f1a7b..774bf071b3 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -48,11 +48,13 @@ jobs: 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' From cd178aa88990df123eeef11f3453eaafe745c3c6 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 15:03:10 +0300 Subject: [PATCH 085/129] Move accidentally deleted file back --- .github/workflows/hub-overview.yml | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/hub-overview.yml diff --git a/.github/workflows/hub-overview.yml b/.github/workflows/hub-overview.yml new file mode 100644 index 0000000000..63610fbd8b --- /dev/null +++ b/.github/workflows/hub-overview.yml @@ -0,0 +1,43 @@ +name: Update dockerhub overviews + +on: + push: + branches: + - main + - master + paths: + - ".github/workflows/hub-overview.yml" + + - "all-spark-notebook/README.md" + - "base-notebook/README.md" + - "datascience-notebook/README.md" + - "minimal-notebook/README.md" + - "pyspark-notebook/README.md" + - "r-notebook/README.md" + - "scipy-notebook/README.md" + - "tensorflow-notebook/README.md" + +jobs: + update-dockerhub-overview: + name: Update dockerhub overviews + runs-on: ubuntu-latest + + steps: + # Currently, it's impossible to automatically update descriptions + # https://github.com/docker/hub-tool/issues/172 + - name: Fail to show, that for now we need to manually update dockerhub overview page 💩 + run: exit 1 + + - name: Checkout Repo ⚡️ + uses: actions/checkout@v3 + + - name: push README to Dockerhub for base-notebook 🐳 + uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # dependabot updates to latest release + env: + DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} + with: + destination_container_repo: jupyter/base-notebook + provider: dockerhub + short_description: "Small base image for Jupyter Notebook stacks from https://github.com/jupyter/docker-stacks" + readme_file: "base-notebook/README.md" From ffe33b1335011eab52650d8646aea0e7c08bfbfa Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 15:06:29 +0300 Subject: [PATCH 086/129] Better python code --- tagging/tag_image.py | 2 +- tagging/update_wiki_page.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tagging/tag_image.py b/tagging/tag_image.py index 775baad45a..56c9e928b8 100755 --- a/tagging/tag_image.py +++ b/tagging/tag_image.py @@ -36,7 +36,7 @@ def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: "tag", image, f"{owner}/{short_image_name}:{tags_prefix}{tag_value}" ]() if tags_prefix != "": - LOGGER.info("Changing :latest tag to include tags_prefix") + LOGGER.info(f"Changing :latest tag to include {tags_prefix=}") docker["tag", image, f"{owner}/{short_image_name}:{tags_prefix}latest"]() docker["rmi", image]() diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py index 3cd2b918f6..bd6f46754b 100755 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -7,6 +7,7 @@ from pathlib import Path LOGGER = logging.getLogger(__name__) +TABLE_BEGINNING = "|-|-|-|\n" def update_wiki_page(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None: @@ -18,7 +19,6 @@ def update_wiki_page(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> build_history_lines = "\n".join( hist_line_file.read_text() for hist_line_file in build_history_line_files ) - TABLE_BEGINNING = "|-|-|-|\n" wiki_home_content = wiki_home_content.replace( TABLE_BEGINNING, TABLE_BEGINNING + build_history_lines + "\n" ) From 7543e49a9fe7f62e95c4b21f96026b2997dfddbc Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 15:15:10 +0300 Subject: [PATCH 087/129] Minor fixes --- tagging/{tags_prefix.py => get_tags_prefix.py} | 0 tagging/tag_image.py | 9 ++++----- tagging/write_manifests.py | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) rename tagging/{tags_prefix.py => get_tags_prefix.py} (100%) diff --git a/tagging/tags_prefix.py b/tagging/get_tags_prefix.py similarity index 100% rename from tagging/tags_prefix.py rename to tagging/get_tags_prefix.py diff --git a/tagging/tag_image.py b/tagging/tag_image.py index 56c9e928b8..f571e1158d 100755 --- a/tagging/tag_image.py +++ b/tagging/tag_image.py @@ -8,14 +8,14 @@ from tagging.docker_runner import DockerRunner from tagging.get_taggers_and_manifests import get_taggers_and_manifests -from tagging.tags_prefix import get_tags_prefix +from tagging.get_tags_prefix import get_tags_prefix docker = plumbum.local["docker"] LOGGER = logging.getLogger(__name__) -def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: +def tag_image(short_image_name: str, owner: str) -> None: """ Tags /:latest with the tags reported by all taggers for the given image. @@ -24,6 +24,7 @@ def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: taggers, _ = get_taggers_and_manifests(short_image_name) image = f"{owner}/{short_image_name}:latest" + tags_prefix = get_tags_prefix() with DockerRunner(image) as container: for tagger in taggers: @@ -53,6 +54,4 @@ def tag_image(short_image_name: str, owner: str, tags_prefix: str) -> None: arg_parser.add_argument("--owner", default="jupyter", help="Owner of the image") args = arg_parser.parse_args() - tags_prefix = get_tags_prefix() - - tag_image(args.short_image_name, args.owner, tags_prefix) + tag_image(args.short_image_name, args.owner) diff --git a/tagging/write_manifests.py b/tagging/write_manifests.py index 56d588d0b0..99a75b8088 100755 --- a/tagging/write_manifests.py +++ b/tagging/write_manifests.py @@ -10,13 +10,13 @@ from tagging.docker_runner import DockerRunner from tagging.get_taggers_and_manifests import get_taggers_and_manifests +from tagging.get_tags_prefix import get_tags_prefix from tagging.git_helper import GitHelper from tagging.manifests import ManifestHeader, ManifestInterface -from tagging.tags_prefix import get_tags_prefix LOGGER = logging.getLogger(__name__) - +# This would actually be manifest creation timestamp BUILD_TIMESTAMP = datetime.datetime.utcnow().isoformat()[:-7] + "Z" MARKDOWN_LINE_BREAK = "
" From 3ef0cf882a4ffc2617b6a8d0798bcd0bad34da23 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 19:19:55 +0300 Subject: [PATCH 088/129] Remove downloaded file and do not maximize build space --- .github/actions/create-dev-env/action.yml | 7 ------- .github/actions/load-image/action.yml | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 2956e9c9b4..0cccf56e78 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -4,13 +4,6 @@ description: "Create build environment" runs: using: "composite" steps: - # - name: Maximize build space 🛠 - # run: | - # sudo rm -rf /usr/share/dotnet - # sudo rm -rf /usr/local/lib/android - # sudo rm -rf /opt/ghc - # shell: bash - - name: Set Up Python 🐍 uses: actions/setup-python@v3 with: diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index c76ccccac7..48dbbb6ef7 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -24,3 +24,6 @@ runs: 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 From cd615603ad94794d559249985863c2edf8c7cb0d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 18 May 2022 19:29:05 +0300 Subject: [PATCH 089/129] Update .github/actions/load-image/action.yml Co-authored-by: Tania Allard --- .github/actions/load-image/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index 48dbbb6ef7..d508a78de8 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -1,4 +1,4 @@ -name: "Load image" +name: Load Docker image description: "Download image artifact and load it to docker" inputs: From bf7e7fd19316b8c45015123515d1cd4cb6bf30ca Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 18 May 2022 19:29:22 +0300 Subject: [PATCH 090/129] Update .github/workflows/docker-build-upload.yml Co-authored-by: Tania Allard --- .github/workflows/docker-build-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index 3e39296f3c..2007825e48 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -29,7 +29,7 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Load parent built image to docker 📥 + - name: Load parent built image to Docker 📥 if: ${{ inputs.parentImage != '' }} uses: ./.github/actions/load-image with: From f2c45508e0efd47f20a440955fa4868e77940e6d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 18 May 2022 19:29:34 +0300 Subject: [PATCH 091/129] Update .github/workflows/docker-build-upload.yml Co-authored-by: Tania Allard --- .github/workflows/docker-build-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index 2007825e48..a260024340 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -43,7 +43,7 @@ jobs: # Full logs for CI build BUILDKIT_PROGRESS: plain shell: bash - - name: Save image as a file 💾 + - name: Save image as a tar for later use 💾 run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar shell: bash From 927cbf8cfbafab402c035a00072c6021702f2d30 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 18 May 2022 19:29:45 +0300 Subject: [PATCH 092/129] Update .github/workflows/docker-build-upload.yml Co-authored-by: Tania Allard --- .github/workflows/docker-build-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index a260024340..1adae8d9a3 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -47,7 +47,7 @@ jobs: run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar shell: bash - - name: Upload artifact 💾 + - name: Upload image as artifact 💾 uses: actions/upload-artifact@v3 with: name: ${{ inputs.image }}-${{ inputs.platform }} From 1936d7356a7a5963b04d5fbaac3350696b07322c Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 18 May 2022 19:30:39 +0300 Subject: [PATCH 093/129] Apply suggestions from code review Co-authored-by: Tania Allard --- .github/workflows/docker-tag-manifest-push.yml | 4 ++-- docs/contributing/tests.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index 774bf071b3..87761dc2e6 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -1,4 +1,4 @@ -name: Download image artifact from GitHub artifacts, tag it and push to DockerHub +name: Download Docker image from GitHub artifacts, tag and push it to DockerHub on: workflow_call: @@ -30,7 +30,7 @@ jobs: - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env - - name: Load image to docker 📥 + - name: Load image to Docker 📥 uses: ./.github/actions/load-image with: image: ${{ matrix.image }} diff --git a/docs/contributing/tests.md b/docs/contributing/tests.md index 87198a987a..1de1d25902 100644 --- a/docs/contributing/tests.md +++ b/docs/contributing/tests.md @@ -5,7 +5,7 @@ We greatly appreciate pull requests that extend the automated tests that vet the ## How the Tests Work A [GitHub Action workflow](https://github.com/jupyter/docker-stacks/blob/master/.github/workflows/docker.yml) -runs tests against pull requests submitted to the `jupyter/docker-stacks` repository: +runs tests against pull requests submitted to the `jupyter/docker-stacks` repository. We use `pytest` module to run tests on the image. `conftest.py` and `pytest.ini` in the `tests` folder define the environment in which tests are run. From 30819970ccdfd05e79042c75f92a7e29872a0a5d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 19 May 2022 14:10:18 +0300 Subject: [PATCH 094/129] Unify yaml quotes style --- .github/actions/create-dev-env/action.yml | 6 +++--- .github/actions/download-manifests/action.yml | 10 +++++----- .github/actions/load-image/action.yml | 8 ++++---- .github/workflows/docker-build-upload.yml | 8 ++++---- .github/workflows/docker-tag-manifest-push.yml | 6 +++--- .github/workflows/docker-test.yml | 6 +++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 0cccf56e78..cab9c46b42 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -1,8 +1,8 @@ -name: "Build environment" -description: "Create build environment" +name: Build environment +description: Create build environment runs: - using: "composite" + using: composite steps: - name: Set Up Python 🐍 uses: actions/setup-python@v3 diff --git a/.github/actions/download-manifests/action.yml b/.github/actions/download-manifests/action.yml index c716f02a3d..fb696b3529 100644 --- a/.github/actions/download-manifests/action.yml +++ b/.github/actions/download-manifests/action.yml @@ -1,5 +1,5 @@ -name: "Download manifests" -description: "Download all manifests and history lines" +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 @@ -7,16 +7,16 @@ description: "Download all manifests and history lines" inputs: histLineDir: - description: "Directory to store history lines" + description: Directory to store history lines required: true type: string manifestDir: - description: "Directory to store manifest files" + description: Directory to store manifest files required: true type: string runs: - using: "composite" + using: composite steps: - name: Download artifact 📥 uses: actions/download-artifact@v3 diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index d508a78de8..4583ea5d59 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -1,18 +1,18 @@ name: Load Docker image -description: "Download image artifact and load it to docker" +description: Download image artifact and load it to docker inputs: image: - description: "Image name" + description: Image name required: true type: string platform: - description: "Image platform" + description: Image platform required: true type: string runs: - using: "composite" + using: composite steps: - name: Download built image 📥 uses: actions/download-artifact@v3 diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-upload.yml index 1adae8d9a3..25e89770cc 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-upload.yml @@ -4,19 +4,19 @@ on: workflow_call: inputs: parentImage: - description: "Parent image name" + description: Parent image name required: true type: string image: - description: "Image name" + description: Image name required: true type: string platform: - description: "Image platform" + description: Image platform required: true type: string runsOn: - description: "GitHub Actions Runner image" + description: GitHub Actions Runner image required: true type: string diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index 87761dc2e6..a937a1a46e 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -4,15 +4,15 @@ on: workflow_call: inputs: images: - description: "Stringified JSON object listing image names" + description: Stringified JSON object listing image names required: true type: string platform: - description: "Image platform" + description: Image platform required: true type: string runsOn: - description: "GitHub Actions Runner image" + description: GitHub Actions Runner image required: true type: string diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index e6e6a20c73..8d0f7dd947 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -4,15 +4,15 @@ on: workflow_call: inputs: image: - description: "Image name" + description: Image name required: true type: string platform: - description: "Image platform" + description: Image platform required: true type: string runsOn: - description: "GitHub Actions Runner image" + description: GitHub Actions Runner image required: true type: string From 0602872f90054f293e03371d457e8fa39241a230 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 19 May 2022 15:38:57 +0300 Subject: [PATCH 095/129] Update codestyle --- .github/workflows/docker-wiki-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-wiki-update.yml b/.github/workflows/docker-wiki-update.yml index a427365569..1e89b1982f 100644 --- a/.github/workflows/docker-wiki-update.yml +++ b/.github/workflows/docker-wiki-update.yml @@ -28,7 +28,7 @@ jobs: - name: Checkout Wiki Repo 📃 uses: actions/checkout@v3 with: - repository: ${{github.repository}}.wiki + repository: ${{ github.repository }}.wiki path: wiki/ - name: Update wiki page 🏷 @@ -39,5 +39,5 @@ jobs: if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' uses: stefanzweifel/git-auto-commit-action@5804e42f86b1891093b151b6c4e78e759c746c4d # dependabot updates to latest release with: - commit_message: "Automated wiki publish for ${{github.sha}}" + commit_message: "Automated wiki publish for ${{ github.sha }}" repository: wiki/ From 4e91cc94baf84c2903ef1fbe1f4746b05352add8 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 19 May 2022 21:53:31 +0300 Subject: [PATCH 096/129] Test in the same step as build --- ...pload.yml => docker-build-test-upload.yml} | 10 +- .github/workflows/docker-test.yml | 36 ----- .github/workflows/docker.yml | 132 +++++------------- 3 files changed, 40 insertions(+), 138 deletions(-) rename .github/workflows/{docker-build-upload.yml => docker-build-test-upload.yml} (87%) delete mode 100644 .github/workflows/docker-test.yml diff --git a/.github/workflows/docker-build-upload.yml b/.github/workflows/docker-build-test-upload.yml similarity index 87% rename from .github/workflows/docker-build-upload.yml rename to .github/workflows/docker-build-test-upload.yml index 25e89770cc..46c7503d84 100644 --- a/.github/workflows/docker-build-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -1,4 +1,4 @@ -name: Download parent image, build new one, upload it to GitHub artifacts +name: Download parent image, build new one, test it and upload to GitHub artifacts on: workflow_call: @@ -21,7 +21,7 @@ on: type: string jobs: - build-upload: + build-test-upload: runs-on: ${{ inputs.runsOn }} steps: - name: Checkout Repo ⚡️ @@ -43,10 +43,14 @@ jobs: # Full logs for CI build BUILDKIT_PROGRESS: plain shell: bash + + - name: Run tests ✅ + run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }} + shell: bash + - name: Save image as a tar for later use 💾 run: docker save jupyter/${{ inputs.image }} -o /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar shell: bash - - name: Upload image as artifact 💾 uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml deleted file mode 100644 index 8d0f7dd947..0000000000 --- a/.github/workflows/docker-test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Download image artifact from GitHub artifacts and test it - -on: - workflow_call: - inputs: - 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: - test: - runs-on: ${{ inputs.runsOn }} - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v3 - - name: Create dev environment 📦 - uses: ./.github/actions/create-dev-env - - - name: Load image to docker 📥 - uses: ./.github/actions/load-image - with: - image: ${{ inputs.image }} - platform: ${{ inputs.platform }} - - - name: Run tests ✅ - run: python3 -m tests.run_tests --short-image-name ${{ inputs.image }} - shell: bash diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6f801c72df..9da264e8ed 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,8 +7,7 @@ on: pull_request: paths: - ".github/workflows/docker.yml" - - ".github/workflows/docker-build-upload.yml" - - ".github/workflows/docker-test.yml" + - ".github/workflows/docker-build-test-upload.yml" - ".github/workflows/docker-tag-manifest-push.yml" - ".github/workflows/docker-wiki-update.yml" @@ -34,8 +33,7 @@ on: - master paths: - ".github/workflows/docker.yml" - - ".github/workflows/docker-build-upload.yml" - - ".github/workflows/docker-test.yml" + - ".github/workflows/docker-build-test-upload.yml" - ".github/workflows/docker-tag-manifest-push.yml" - ".github/workflows/docker-wiki-update.yml" @@ -63,152 +61,88 @@ concurrency: cancel-in-progress: true jobs: - build-amd64-base: - uses: ./.github/workflows/docker-build-upload.yml + amd64-base: + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: "" image: base-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-base: - needs: [build-amd64-base] - uses: ./.github/workflows/docker-test.yml - with: - image: base-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-minimal: - needs: [build-amd64-base] - uses: ./.github/workflows/docker-build-upload.yml + amd64-minimal: + needs: [amd64-base] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: base-notebook image: minimal-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-minimal: - needs: [build-amd64-minimal] - uses: ./.github/workflows/docker-test.yml - with: - image: minimal-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-scipy: - needs: [build-amd64-minimal] - uses: ./.github/workflows/docker-build-upload.yml + amd64-scipy: + needs: [amd64-minimal] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: minimal-notebook image: scipy-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-scipy: - needs: [build-amd64-scipy] - uses: ./.github/workflows/docker-test.yml - with: - image: scipy-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-r: - needs: [build-amd64-minimal] - uses: ./.github/workflows/docker-build-upload.yml + amd64-r: + needs: [amd64-minimal] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: minimal-notebook image: r-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-r: - needs: [build-amd64-r] - uses: ./.github/workflows/docker-test.yml - with: - image: r-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-tensorflow: - needs: [build-amd64-scipy] - uses: ./.github/workflows/docker-build-upload.yml + amd64-tensorflow: + needs: [amd64-scipy] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: scipy-notebook image: tensorflow-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-tensorflow: - needs: [build-amd64-tensorflow] - uses: ./.github/workflows/docker-test.yml - with: - image: tensorflow-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-datascience: - needs: [build-amd64-scipy] - uses: ./.github/workflows/docker-build-upload.yml + amd64-datascience: + needs: [amd64-scipy] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: scipy-notebook image: datascience-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-datascience: - needs: [build-amd64-datascience] - uses: ./.github/workflows/docker-test.yml - with: - image: datascience-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-pyspark: - needs: [build-amd64-scipy] - uses: ./.github/workflows/docker-build-upload.yml + amd64-pyspark: + needs: [amd64-scipy] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: scipy-notebook image: pyspark-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-pyspark: - needs: [build-amd64-pyspark] - uses: ./.github/workflows/docker-test.yml - with: - image: pyspark-notebook - platform: amd64 - runsOn: ubuntu-latest - - build-amd64-all-spark: - needs: [build-amd64-pyspark] - uses: ./.github/workflows/docker-build-upload.yml + amd64-all-spark: + needs: [amd64-pyspark] + uses: ./.github/workflows/docker-build-test-upload.yml with: parentImage: pyspark-notebook image: all-spark-notebook platform: amd64 runsOn: ubuntu-latest - test-amd64-all-spark: - needs: [build-amd64-all-spark] - uses: ./.github/workflows/docker-test.yml - with: - image: all-spark-notebook - platform: amd64 - runsOn: ubuntu-latest - amd64-images-tag-push: needs: [ - test-amd64-base, - test-amd64-minimal, - test-amd64-scipy, - test-amd64-r, - test-amd64-tensorflow, - test-amd64-datascience, - test-amd64-pyspark, - test-amd64-all-spark, + amd64-base, + amd64-minimal, + amd64-scipy, + amd64-r, + amd64-tensorflow, + amd64-datascience, + amd64-pyspark, + amd64-all-spark, ] uses: ./.github/workflows/docker-tag-manifest-push.yml with: From 4ce4d0cc60b2d1b5596b63e75f2dfcb7c46d1af0 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 25 May 2022 20:33:44 +0300 Subject: [PATCH 097/129] Add docs --- .github/workflows/docker.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9da264e8ed..db3974bdbf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,10 +7,14 @@ on: pull_request: paths: - ".github/workflows/docker.yml" + # We use local reusable workflows to make architecture clean an simple + # https://docs.github.com/en/actions/using-workflows/reusing-workflows - ".github/workflows/docker-build-test-upload.yml" - ".github/workflows/docker-tag-manifest-push.yml" - ".github/workflows/docker-wiki-update.yml" + # We use local composite actions to combine multiple workflow steps within one action + # https://docs.github.com/en/actions/creating-actions/about-custom-actions#composite-actions - ".github/actions/create-dev-env/action.yml" - ".github/actions/download-manifests/action.yml" - ".github/actions/load-image/action.yml" @@ -57,6 +61,7 @@ on: # https://docs.github.com/en/actions/using-jobs/using-concurrency concurrency: + # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true From 42d30ff9c4129a2396420ccafe088d11ba4013d7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 10:25:46 +0400 Subject: [PATCH 098/129] Bump actions/setup-python --- .github/actions/create-dev-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index cab9c46b42..685cda4193 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -5,7 +5,7 @@ runs: using: composite steps: - name: Set Up Python 🐍 - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.x From 2b844b3431a86ade9c1c475e82e0f5b7bd47d920 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 12:44:57 +0400 Subject: [PATCH 099/129] Try to use aarch64 self-hosted runner --- .github/actions/create-dev-env/action.yml | 8 ++ .../workflows/docker-build-test-upload.yml | 10 +++ .../workflows/docker-tag-manifest-push.yml | 2 + .github/workflows/docker-wiki-update.yml | 2 + .github/workflows/docker.yml | 82 ++++++++++++++++++- tests/run_tests.py | 6 +- 6 files changed, 107 insertions(+), 3 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 685cda4193..d2d0a60d16 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -1,13 +1,21 @@ name: Build environment description: Create build environment +inputs: + platform: + description: Platform to be run on + required: true + type: string + runs: using: composite steps: + # Self-hosted runners have to have python3 preinstalled - name: Set Up Python 🐍 uses: actions/setup-python@v4 with: python-version: 3.x + if: ${{ inputs.platform == 'amd64' }} - name: Install Dev Dependencies 📦 run: | diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 46c7503d84..4f96c6ff4a 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -28,6 +28,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env + with: + platform: ${{ inputs.platform }} - name: Load parent built image to Docker 📥 if: ${{ inputs.parentImage != '' }} @@ -57,3 +59,11 @@ jobs: name: ${{ inputs.image }}-${{ inputs.platform }} path: /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar retention-days: 3 + + # Self-hosted runners share a state between runs + - name: Cleanup artifacts 🗑️ + run: | + rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar + docker image rm jupyter/${{ inputs.image }} + docker image rm ubuntu:focal || exit 0 + shell: bash diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index a937a1a46e..4b39ff7533 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -29,6 +29,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env + with: + platform: ${{ inputs.platform }} - name: Load image to Docker 📥 uses: ./.github/actions/load-image diff --git a/.github/workflows/docker-wiki-update.yml b/.github/workflows/docker-wiki-update.yml index 1e89b1982f..65aae6c5d3 100644 --- a/.github/workflows/docker-wiki-update.yml +++ b/.github/workflows/docker-wiki-update.yml @@ -13,6 +13,8 @@ jobs: uses: actions/checkout@v3 - name: Create dev environment 📦 uses: ./.github/actions/create-dev-env + with: + platform: amd64 - name: Download all manifests and history lines 📥 uses: ./.github/actions/download-manifests diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index db3974bdbf..cb2dc8a7c6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -66,6 +66,14 @@ concurrency: cancel-in-progress: true jobs: + aarch64-base: + uses: ./.github/workflows/docker-build-test-upload.yml + with: + parentImage: "" + image: base-notebook + platform: aarch64 + runsOn: self-hosted + amd64-base: uses: ./.github/workflows/docker-build-test-upload.yml with: @@ -74,6 +82,15 @@ jobs: platform: amd64 runsOn: ubuntu-latest + aarch64-minimal: + needs: [aarch64-base] + uses: ./.github/workflows/docker-build-test-upload.yml + with: + parentImage: base-notebook + image: minimal-notebook + platform: aarch64 + runsOn: self-hosted + amd64-minimal: needs: [amd64-base] uses: ./.github/workflows/docker-build-test-upload.yml @@ -83,6 +100,15 @@ jobs: platform: amd64 runsOn: ubuntu-latest + aarch64-scipy: + needs: [aarch64-minimal] + uses: ./.github/workflows/docker-build-test-upload.yml + with: + parentImage: minimal-notebook + image: scipy-notebook + platform: aarch64 + runsOn: self-hosted + amd64-scipy: needs: [amd64-minimal] uses: ./.github/workflows/docker-build-test-upload.yml @@ -92,6 +118,15 @@ jobs: platform: amd64 runsOn: ubuntu-latest + aarch64-r: + needs: [aarch64-minimal] + uses: ./.github/workflows/docker-build-test-upload.yml + with: + parentImage: minimal-notebook + image: r-notebook + platform: aarch64 + runsOn: self-hosted + amd64-r: needs: [amd64-minimal] uses: ./.github/workflows/docker-build-test-upload.yml @@ -119,6 +154,15 @@ jobs: platform: amd64 runsOn: ubuntu-latest + aarch64-pyspark: + needs: [aarch64-scipy] + uses: ./.github/workflows/docker-build-test-upload.yml + with: + parentImage: scipy-notebook + image: pyspark-notebook + platform: aarch64 + runsOn: self-hosted + amd64-pyspark: needs: [amd64-scipy] uses: ./.github/workflows/docker-build-test-upload.yml @@ -128,6 +172,15 @@ jobs: platform: amd64 runsOn: ubuntu-latest + aarch64-all-spark: + needs: [aarch64-pyspark] + uses: ./.github/workflows/docker-build-test-upload.yml + with: + parentImage: pyspark-notebook + image: all-spark-notebook + platform: aarch64 + runsOn: self-hosted + amd64-all-spark: needs: [amd64-pyspark] uses: ./.github/workflows/docker-build-test-upload.yml @@ -168,6 +221,33 @@ jobs: "all-spark-notebook" ] + aarch64-images-tag-push: + needs: + [ + aarch64-base, + aarch64-minimal, + aarch64-scipy, + aarch64-r, + aarch64-pyspark, + aarch64-all-spark, + ] + uses: ./.github/workflows/docker-tag-manifest-push.yml + with: + platform: amd64 + runsOn: ubuntu-latest + # https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations + # The strategy property is not supported in any job that calls a reusable workflow + # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 + images: >- + [ + "base-notebook", + "minimal-notebook", + "scipy-notebook", + "r-notebook", + "pyspark-notebook", + "all-spark-notebook" + ] + wiki-update: - needs: [amd64-images-tag-push] + needs: [amd64-images-tag-push, aarch64-images-tag-push] uses: ./.github/workflows/docker-wiki-update.yml diff --git a/tests/run_tests.py b/tests/run_tests.py index 12e68e2dcb..5a49d2b70c 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -8,7 +8,7 @@ from tests.images_hierarchy import get_test_dirs -pytest = plumbum.local["pytest"] +python3 = plumbum.local["python3"] LOGGER = logging.getLogger(__name__) @@ -19,7 +19,9 @@ def test_image(short_image_name: str, owner: str) -> None: LOGGER.info(f"Test dirs to be run: {test_dirs}") with plumbum.local.env(TEST_IMAGE=f"{owner}/{short_image_name}"): ( - pytest[ + python3[ + "-m", + "pytest", "--numprocesses", "auto", "-m", From b06c797f62e1a738bee7b43ad25cb8d8237839bf Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 19:21:44 +0400 Subject: [PATCH 100/129] Fix style --- .github/workflows/docker-build-test-upload.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 4f96c6ff4a..d9bf868fe1 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -63,7 +63,7 @@ jobs: # Self-hosted runners share a state between runs - name: Cleanup artifacts 🗑️ run: | - rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar - docker image rm jupyter/${{ inputs.image }} - docker image rm ubuntu:focal || exit 0 + rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar + docker image rm jupyter/${{ inputs.image }} + docker image rm ubuntu:focal || exit 0 shell: bash From d52b8dd62b69b9867137738f29c052c059bb1c91 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 19:34:06 +0400 Subject: [PATCH 101/129] Add artifacts cleanup --- .github/workflows/docker-build-test-upload.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index d9bf868fe1..565c623295 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -31,6 +31,12 @@ jobs: with: platform: ${{ inputs.platform }} + # Self-hosted runners might share a state between runs + - name: Cleanup unwanted docker images 🗑️ + run: docker system prune --all --force + shell: bash + if: ${{ inputs.platform == 'aarch64' }} + - name: Load parent built image to Docker 📥 if: ${{ inputs.parentImage != '' }} uses: ./.github/actions/load-image @@ -61,9 +67,9 @@ jobs: retention-days: 3 # Self-hosted runners share a state between runs - - name: Cleanup artifacts 🗑️ + - name: Cleanup built artifacts 🗑️ run: | rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar - docker image rm jupyter/${{ inputs.image }} - docker image rm ubuntu:focal || exit 0 + docker system prune --all --force shell: bash + if: ${{ inputs.platform == 'aarch64' }} From 515404a42462be91598f4a6a888f428b6c032695 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 19:38:42 +0400 Subject: [PATCH 102/129] Add downloading aarch64 artifacts --- .github/actions/download-manifests/action.yml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/.github/actions/download-manifests/action.yml b/.github/actions/download-manifests/action.yml index fb696b3529..3423caaa73 100644 --- a/.github/actions/download-manifests/action.yml +++ b/.github/actions/download-manifests/action.yml @@ -18,21 +18,41 @@ inputs: runs: using: composite steps: + - name: Download artifact 📥 + uses: actions/download-artifact@v3 + with: + name: base-notebook-aarch64-history_line + path: ${{ inputs.histLineDir }} - 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-aarch64-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-aarch64-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-aarch64-history_line + path: ${{ inputs.histLineDir }} - name: Download artifact 📥 uses: actions/download-artifact@v3 with: @@ -48,32 +68,62 @@ runs: with: name: datascience-notebook-amd64-history_line path: ${{ inputs.histLineDir }} + - name: Download artifact 📥 + uses: actions/download-artifact@v3 + with: + name: pyspark-notebook-aarch64-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-aarch64-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-aarch64-manifest + path: ${{ inputs.manifestDir }} - 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-aarch64-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-aarch64-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-aarch64-manifest + path: ${{ inputs.manifestDir }} - name: Download artifact 📥 uses: actions/download-artifact@v3 with: @@ -89,11 +139,21 @@ runs: with: name: datascience-notebook-amd64-manifest path: ${{ inputs.manifestDir }} + - name: Download artifact 📥 + uses: actions/download-artifact@v3 + with: + name: pyspark-notebook-aarch64-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-aarch64-manifest + path: ${{ inputs.manifestDir }} - name: Download artifact 📥 uses: actions/download-artifact@v3 with: From a350070e5480d041695ddca20f7dbd48666dc660 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 20:11:50 +0400 Subject: [PATCH 103/129] Better wording --- .github/actions/create-dev-env/action.yml | 3 ++- .github/workflows/docker-build-test-upload.yml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index d2d0a60d16..7f874a6f3a 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -10,7 +10,8 @@ inputs: runs: using: composite steps: - # Self-hosted runners have to have python3 preinstalled + # aarch64 runners do not have pre-built python3 distributions + # so, we install python3 in the aarch64 VM manually - name: Set Up Python 🐍 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 565c623295..674ee64cf3 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -31,7 +31,7 @@ jobs: with: platform: ${{ inputs.platform }} - # Self-hosted runners might share a state between runs + # Self-hosted runners share a state (whole VM) between runs - name: Cleanup unwanted docker images 🗑️ run: docker system prune --all --force shell: bash @@ -66,7 +66,7 @@ jobs: path: /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar retention-days: 3 - # Self-hosted runners share a state between runs + # Self-hosted runners share a state (whole VM) between runs - name: Cleanup built artifacts 🗑️ run: | rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar From 23f0eb947a6545fb4b1aef444552c2aad16beeef Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 20:12:37 +0400 Subject: [PATCH 104/129] Always run cleanup steps --- .github/workflows/docker-build-test-upload.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 674ee64cf3..f01b1ccdf0 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -35,7 +35,7 @@ jobs: - name: Cleanup unwanted docker images 🗑️ run: docker system prune --all --force shell: bash - if: ${{ inputs.platform == 'aarch64' }} + if: always() && ${{ inputs.platform == 'aarch64' }} - name: Load parent built image to Docker 📥 if: ${{ inputs.parentImage != '' }} @@ -72,4 +72,4 @@ jobs: rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar docker system prune --all --force shell: bash - if: ${{ inputs.platform == 'aarch64' }} + if: always() && ${{ inputs.platform == 'aarch64' }} From aad4f22f41c3d8af25e92e6cd6560d77a66de5d5 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 20:18:28 +0400 Subject: [PATCH 105/129] Always doesn't respect other conditions --- .github/workflows/docker-build-test-upload.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index f01b1ccdf0..8d2e5819f1 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -35,7 +35,7 @@ jobs: - name: Cleanup unwanted docker images 🗑️ run: docker system prune --all --force shell: bash - if: always() && ${{ inputs.platform == 'aarch64' }} + if: always() - name: Load parent built image to Docker 📥 if: ${{ inputs.parentImage != '' }} @@ -72,4 +72,4 @@ jobs: rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar docker system prune --all --force shell: bash - if: always() && ${{ inputs.platform == 'aarch64' }} + if: always() From ad4670b171569b16f47a8ab5761971c348d31e3d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 20:44:12 +0400 Subject: [PATCH 106/129] Add docs to setup aarch64 runner --- aarch64-runner/setup.sh | 23 +++++++++++++++++++++++ docs/index.rst | 1 + docs/maintaining/aarch64-runner.md | 11 +++++++++++ 3 files changed, 35 insertions(+) create mode 100755 aarch64-runner/setup.sh create mode 100644 docs/maintaining/aarch64-runner.md diff --git a/aarch64-runner/setup.sh b/aarch64-runner/setup.sh new file mode 100755 index 0000000000..7aa09c05a4 --- /dev/null +++ b/aarch64-runner/setup.sh @@ -0,0 +1,23 @@ +#!/bin/bash -e + +GITHUB_RUNNER_USER="runner-user" + +if [ "$EUID" -ne 0 ]; then + echo "Please run as root" + exit 1 +fi + +apt-get update --yes +apt-get upgrade --yes + +echo "Creating runner-user, who will run GitHub Actions runner" +adduser --disabled-password --gecos "" ${GITHUB_RUNNER_USER} + +echo "Setting up python3" +apt-get install --yes --no-install-recommends python3 +curl -sS https://bootstrap.pypa.io/get-pip.py | python3 + +echo "Setting up docker" +apt-get install --yes --no-install-recommends docker.io +usermod -aG docker ${GITHUB_RUNNER_USER} +chmod 666 /var/run/docker.sock diff --git a/docs/index.rst b/docs/index.rst index 7c3e9e032e..54ddb166cf 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -31,6 +31,7 @@ Table of Contents :maxdepth: 2 :caption: Maintainer Guide + maintaining/aarch64-runner maintaining/tasks .. toctree:: diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md new file mode 100644 index 0000000000..2de188667a --- /dev/null +++ b/docs/maintaining/aarch64-runner.md @@ -0,0 +1,11 @@ +# Creating aarch64 self-hosted GitHub runner + +For `aarch64` runners, we have self-hosted VMs, provided by [Oracle OCI](https://www.oracle.com/cloud/). + +To setup new runner, please: + +1. Create an Oracle `VM.Standard.A1.Flex` with `1 OCPU` and `4 GB` using `Ubuntu 22.04` image. +2. Run: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mathbunnyru/docker-stacks/asalikhov/new_build_system/aarch64-runner/setup.sh)"` + This will perform initial runner setup and create a non-root user `runner-user`. +3. Setup new GitHub Runner with this user: +4. Run under `root` user in Runner directory: `./svc.sh install runner-user` From febc1ff7a19f400619cce6311c107a817c6a12a4 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 20:46:30 +0400 Subject: [PATCH 107/129] Add always() where needed --- .github/actions/load-image/action.yml | 3 ++- .github/workflows/docker-build-test-upload.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index 4583ea5d59..be3b3d4c31 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -25,5 +25,6 @@ runs: docker image ls -a shell: bash - name: Delete the file 🗑️ - run: rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar + run: rm -f /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar shell: bash + if: always() diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 8d2e5819f1..16126a85c7 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -69,7 +69,7 @@ jobs: # Self-hosted runners share a state (whole VM) between runs - name: Cleanup built artifacts 🗑️ run: | - rm /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar + rm -f /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar docker system prune --all --force shell: bash if: always() From 56f172ea92a3afb5117fff564dc5c672b10a7b21 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 20:52:33 +0400 Subject: [PATCH 108/129] Fixes --- aarch64-runner/setup.sh | 3 ++- docs/maintaining/aarch64-runner.md | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/aarch64-runner/setup.sh b/aarch64-runner/setup.sh index 7aa09c05a4..1fbd848e15 100755 --- a/aarch64-runner/setup.sh +++ b/aarch64-runner/setup.sh @@ -1,4 +1,5 @@ -#!/bin/bash -e +#!/bin/bash +set -ex GITHUB_RUNNER_USER="runner-user" diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index 2de188667a..7364643254 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -1,11 +1,11 @@ -# Creating aarch64 self-hosted GitHub runner +# Self-hosted runners -For `aarch64` runners, we have self-hosted VMs, provided by [Oracle OCI](https://www.oracle.com/cloud/). +For `aarch64` images, we have self-hosted VMs, provided by [Oracle OCI](https://www.oracle.com/cloud/). -To setup new runner, please: +To setup a new runner: -1. Create an Oracle `VM.Standard.A1.Flex` with `1 OCPU` and `4 GB` using `Ubuntu 22.04` image. -2. Run: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mathbunnyru/docker-stacks/asalikhov/new_build_system/aarch64-runner/setup.sh)"` +1. Create an Oracle `VM.Standard.A1.Flex` with _1 OCPU_ and _4 GB_ using `Ubuntu 22.04` image. +2. Run under `root`: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mathbunnyru/docker-stacks/asalikhov/new_build_system/aarch64-runner/setup.sh)"` This will perform initial runner setup and create a non-root user `runner-user`. 3. Setup new GitHub Runner with this user: 4. Run under `root` user in Runner directory: `./svc.sh install runner-user` From ed40afbf6b39b70573bbb46e629ac0ef302bf418 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 21:11:11 +0400 Subject: [PATCH 109/129] Better style --- docs/maintaining/aarch64-runner.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index 7364643254..fe45f1d33e 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -4,8 +4,14 @@ For `aarch64` images, we have self-hosted VMs, provided by [Oracle OCI](https:// To setup a new runner: -1. Create an Oracle `VM.Standard.A1.Flex` with _1 OCPU_ and _4 GB_ using `Ubuntu 22.04` image. -2. Run under `root`: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mathbunnyru/docker-stacks/asalikhov/new_build_system/aarch64-runner/setup.sh)"` +1. Create an Oracle `VM.Standard.A1.Flex` with _1 OCPU_ and _6 GB_ using `Ubuntu 22.04` image. +2. Run under `root`: + + ```bash + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mathbunnyru/docker-stacks/asalikhov/new_build_system/aarch64-runner/setup.sh)" + ``` + This will perform initial runner setup and create a non-root user `runner-user`. + 3. Setup new GitHub Runner with this user: 4. Run under `root` user in Runner directory: `./svc.sh install runner-user` From c71c79e407982f97ee85bf745f2adf6a0c95062e Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 21:17:19 +0400 Subject: [PATCH 110/129] Add copying authorized_keys --- aarch64-runner/setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aarch64-runner/setup.sh b/aarch64-runner/setup.sh index 1fbd848e15..ec6a57c0a1 100755 --- a/aarch64-runner/setup.sh +++ b/aarch64-runner/setup.sh @@ -11,8 +11,11 @@ fi apt-get update --yes apt-get upgrade --yes -echo "Creating runner-user, who will run GitHub Actions runner" +echo "Setting up runner-user, who will run GitHub Actions runner" adduser --disabled-password --gecos "" ${GITHUB_RUNNER_USER} +mkdir /home/${GITHUB_RUNNER_USER}/.ssh/ +cp /home/ubuntu/.ssh/authorized_keys /home/${GITHUB_RUNNER_USER}/.ssh/authorized_keys +chown ${GITHUB_RUNNER_USER}:${GITHUB_RUNNER_USER} /home/${GITHUB_RUNNER_USER}/.ssh/authorized_keys echo "Setting up python3" apt-get install --yes --no-install-recommends python3 From 625e60b62a214966fd5489be9eb5963f6da5f3a0 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 21:18:15 +0400 Subject: [PATCH 111/129] Better docs --- docs/maintaining/aarch64-runner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index fe45f1d33e..252399ac41 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -13,5 +13,5 @@ To setup a new runner: This will perform initial runner setup and create a non-root user `runner-user`. -3. Setup new GitHub Runner with this user: +3. Setup new GitHub Runner with this user: using `Linux` and `ARM64`. 4. Run under `root` user in Runner directory: `./svc.sh install runner-user` From c0d3b811cb604e478792e70f9206b1b5b00cb02e Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 21:30:16 +0400 Subject: [PATCH 112/129] Better docs --- docs/maintaining/aarch64-runner.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index 252399ac41..e46ccf5f10 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -14,4 +14,10 @@ To setup a new runner: This will perform initial runner setup and create a non-root user `runner-user`. 3. Setup new GitHub Runner with this user: using `Linux` and `ARM64`. -4. Run under `root` user in Runner directory: `./svc.sh install runner-user` +4. Run under `root`: + + ```bash + cd /home/runner-user/actions-runner/ && ./svc.sh install runner-user + ``` + +5. Reboot VM to apply all updates and run GitHub runner. From 1be103d0da4f16c1c23b563438f682c495847217 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 21:52:13 +0400 Subject: [PATCH 113/129] Better docs --- docs/maintaining/aarch64-runner.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index e46ccf5f10..3514e5235c 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -4,7 +4,7 @@ For `aarch64` images, we have self-hosted VMs, provided by [Oracle OCI](https:// To setup a new runner: -1. Create an Oracle `VM.Standard.A1.Flex` with _1 OCPU_ and _6 GB_ using `Ubuntu 22.04` image. +1. Create a compute instance `VM.Standard.A1.Flex` with _1 OCPU_ and _6 GB_ using `Ubuntu 22.04` image. 2. Run under `root`: ```bash @@ -13,7 +13,8 @@ To setup a new runner: This will perform initial runner setup and create a non-root user `runner-user`. -3. Setup new GitHub Runner with this user: using `Linux` and `ARM64`. +3. Setup new GitHub Runner under `runner-user` using [GitHub Instructions](https://github.com/jupyter/docker-stacks/settings/actions/runners/new?arch=arm64&os=linux). + Do not `./run.sh` yet. 4. Run under `root`: ```bash From cc6fb74a612be18c3503e98765431bb55dabfd71 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 21:59:19 +0400 Subject: [PATCH 114/129] Fix linkcheck-docs error --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 0a1d05b4af..5af9bbe4f1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -91,6 +91,7 @@ linkcheck_ignore = [ r".*github\.com.*#", # javascript based anchors + r"https://github.com/jupyter/docker-stacks/settings/actions/runners/new?arch=arm64&os=linux", # only works for users with permissions to change runners r"https://docs.github\.com/.*", # 403 error r"http://127\.0\.0\.1:49153/.*", # example r"https://mybinder\.org/v2/gh/.*", # lots of 500 errors From 500e1a85097394b35296666ea9fd89ea8190a862 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 22:25:14 +0400 Subject: [PATCH 115/129] Fix linkcheck-docs error --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 5af9bbe4f1..970894d6a1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -91,7 +91,7 @@ linkcheck_ignore = [ r".*github\.com.*#", # javascript based anchors - r"https://github.com/jupyter/docker-stacks/settings/actions/runners/new?arch=arm64&os=linux", # only works for users with permissions to change runners + r"https://github\.com/jupyter/docker-stacks/settings/actions/runners/new\?arch=arm64&os=linux", # only works for users with permissions to change runners r"https://docs.github\.com/.*", # 403 error r"http://127\.0\.0\.1:49153/.*", # example r"https://mybinder\.org/v2/gh/.*", # lots of 500 errors From 171c6c308dcb67f9028bbcbfadb794526c9eb74b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 23:10:08 +0400 Subject: [PATCH 116/129] Some fixes for push step --- .github/actions/load-image/action.yml | 5 +++ .../workflows/docker-build-test-upload.yml | 8 +--- .../workflows/docker-tag-manifest-push.yml | 9 ++++ .github/workflows/docker.yml | 42 +++++++++---------- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index be3b3d4c31..618e70f579 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -14,6 +14,11 @@ inputs: runs: using: composite steps: + # Self-hosted runners share a state (whole VM) between runs + - name: Cleanup unwanted docker images 🗑️ + run: docker system prune --all --force + shell: bash + - name: Download built image 📥 uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 16126a85c7..8b5587ca95 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -31,12 +31,6 @@ jobs: with: platform: ${{ inputs.platform }} - # Self-hosted runners share a state (whole VM) between runs - - name: Cleanup unwanted docker images 🗑️ - run: docker system prune --all --force - shell: bash - if: always() - - name: Load parent built image to Docker 📥 if: ${{ inputs.parentImage != '' }} uses: ./.github/actions/load-image @@ -67,7 +61,7 @@ jobs: retention-days: 3 # Self-hosted runners share a state (whole VM) between runs - - name: Cleanup built artifacts 🗑️ + - name: Cleanup artifacts 🗑️ run: | rm -f /tmp/${{ inputs.image }}-${{ inputs.platform }}.tar docker system prune --all --force diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index 4b39ff7533..7f4e5ccc99 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -69,3 +69,12 @@ jobs: 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 + + # Self-hosted runners share a state (whole VM) between runs + - name: Cleanup artifacts 🗑️ + run: | + rm -rf /tmp/hist_lines/ + rm -rf /tmp/manifests/ + docker system prune --all --force + shell: bash + if: always() diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cb2dc8a7c6..4b64565a6e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -190,22 +190,20 @@ jobs: platform: amd64 runsOn: ubuntu-latest - amd64-images-tag-push: + aarch64-images-tag-push: needs: [ - amd64-base, - amd64-minimal, - amd64-scipy, - amd64-r, - amd64-tensorflow, - amd64-datascience, - amd64-pyspark, - amd64-all-spark, + aarch64-base, + aarch64-minimal, + aarch64-scipy, + aarch64-r, + aarch64-pyspark, + aarch64-all-spark, ] uses: ./.github/workflows/docker-tag-manifest-push.yml with: - platform: amd64 - runsOn: ubuntu-latest + platform: aarch64 + runsOn: self-hosted # https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations # The strategy property is not supported in any job that calls a reusable workflow # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 @@ -215,21 +213,21 @@ jobs: "minimal-notebook", "scipy-notebook", "r-notebook", - "tensorflow-notebook", - "datascience-notebook", "pyspark-notebook", "all-spark-notebook" ] - aarch64-images-tag-push: + amd64-images-tag-push: needs: [ - aarch64-base, - aarch64-minimal, - aarch64-scipy, - aarch64-r, - aarch64-pyspark, - aarch64-all-spark, + amd64-base, + amd64-minimal, + amd64-scipy, + amd64-r, + amd64-tensorflow, + amd64-datascience, + amd64-pyspark, + amd64-all-spark, ] uses: ./.github/workflows/docker-tag-manifest-push.yml with: @@ -244,10 +242,12 @@ jobs: "minimal-notebook", "scipy-notebook", "r-notebook", + "tensorflow-notebook", + "datascience-notebook", "pyspark-notebook", "all-spark-notebook" ] wiki-update: - needs: [amd64-images-tag-push, aarch64-images-tag-push] + needs: [aarch64-images-tag-push, amd64-images-tag-push] uses: ./.github/workflows/docker-wiki-update.yml From 2cafcc1feb18fad29e0a5cb23d9f33d5d08cd56d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 23:38:15 +0400 Subject: [PATCH 117/129] More simple README.md --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c63557a1ae..93a6b21c7a 100644 --- a/README.md +++ b/README.md @@ -115,9 +115,6 @@ This change is tracked in the issue [#1217](https://github.com/jupyter/docker-st ## CPU Architectures -We publish containers both for `amd64` (`x86_64`) and `aarch64`, except for `datascience-notebook` and `tensorflow-notebook`, which only support amd64 for now. - -### Caveats for arm64 images - +- We publish containers for both `amd64` (`x86_64`) and `aarch64` platforms, except for `datascience-notebook` and `tensorflow-notebook`, which only support `amd64` for now - We do not create multi-platform images -- All arm64 images have `aarch64-` tag prefix, for example `jupyter/base-notebook:aarch64-python-3.9.6` +- Instead, all arm64 images have `aarch64-` tag prefix, for example `jupyter/base-notebook:aarch64-python-3.10.5` From 44d3104b4294d29cca422429623890619208d19b Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 4 Jul 2022 23:38:36 +0400 Subject: [PATCH 118/129] Remove export G_SLICE=always-malloc --- all-spark-notebook/Dockerfile | 8 +------- base-notebook/Dockerfile | 6 ------ datascience-notebook/Dockerfile | 8 +------- pyspark-notebook/Dockerfile | 8 +------- r-notebook/Dockerfile | 8 +------- scipy-notebook/Dockerfile | 8 +------- tensorflow-notebook/Dockerfile | 8 +------- 7 files changed, 6 insertions(+), 48 deletions(-) diff --git a/all-spark-notebook/Dockerfile b/all-spark-notebook/Dockerfile index f28472487a..69cf982b88 100644 --- a/all-spark-notebook/Dockerfile +++ b/all-spark-notebook/Dockerfile @@ -27,13 +27,7 @@ RUN apt-get update --yes && \ USER ${NB_UID} # R packages including IRKernel which gets installed globally. -RUN arch=$(uname -m) && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - export G_SLICE=always-malloc; \ - fi && \ - mamba install --quiet --yes \ +RUN mamba install --quiet --yes \ 'r-base' \ 'r-ggplot2' \ 'r-irkernel' \ diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 0f0fcd7709..df735db043 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -117,12 +117,6 @@ RUN set -x && \ rm /tmp/micromamba.tar.bz2 && \ PYTHON_SPECIFIER="python=${PYTHON_VERSION}" && \ if [[ "${PYTHON_VERSION}" == "default" ]]; then PYTHON_SPECIFIER="python"; fi && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - # We don't use `micromamba config set` since it instead modifies ~/.condarc. - echo "extract_threads: 1" >> "${CONDA_DIR}/.condarc"; \ - fi && \ # Install the packages ./micromamba install \ --root-prefix="${CONDA_DIR}" \ diff --git a/datascience-notebook/Dockerfile b/datascience-notebook/Dockerfile index 0fe69bc116..1ad8b71105 100644 --- a/datascience-notebook/Dockerfile +++ b/datascience-notebook/Dockerfile @@ -61,13 +61,7 @@ USER ${NB_UID} # R packages including IRKernel which gets installed globally. # r-e1071: dependency of the caret R package -RUN arch=$(uname -m) && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - export G_SLICE=always-malloc; \ - fi && \ - mamba install --quiet --yes \ +RUN mamba install --quiet --yes \ 'r-base' \ 'r-caret' \ 'r-crayon' \ diff --git a/pyspark-notebook/Dockerfile b/pyspark-notebook/Dockerfile index 9a3f54171b..6be3c92432 100644 --- a/pyspark-notebook/Dockerfile +++ b/pyspark-notebook/Dockerfile @@ -61,13 +61,7 @@ RUN fix-permissions "/etc/ipython/" USER ${NB_UID} # Install pyarrow -RUN arch=$(uname -m) && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - export G_SLICE=always-malloc; \ - fi && \ - mamba install --quiet --yes \ +RUN mamba install --quiet --yes \ 'pyarrow' && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index dac8757cc1..3319a802b3 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -27,13 +27,7 @@ USER ${NB_UID} # R packages including IRKernel which gets installed globally. # r-e1071: dependency of the caret R package -RUN arch=$(uname -m) && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - export G_SLICE=always-malloc; \ - fi && \ - mamba install --quiet --yes \ +RUN mamba install --quiet --yes \ 'r-base' \ 'r-caret' \ 'r-crayon' \ diff --git a/scipy-notebook/Dockerfile b/scipy-notebook/Dockerfile index 7bd6caf805..9385e7d750 100644 --- a/scipy-notebook/Dockerfile +++ b/scipy-notebook/Dockerfile @@ -26,13 +26,7 @@ RUN apt-get update --yes && \ USER ${NB_UID} # Install Python 3 packages -RUN arch=$(uname -m) && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - export G_SLICE=always-malloc; \ - fi && \ - mamba install --quiet --yes \ +RUN mamba install --quiet --yes \ 'altair' \ 'beautifulsoup4' \ 'bokeh' \ diff --git a/tensorflow-notebook/Dockerfile b/tensorflow-notebook/Dockerfile index 65bf7999de..78a8af280c 100644 --- a/tensorflow-notebook/Dockerfile +++ b/tensorflow-notebook/Dockerfile @@ -11,13 +11,7 @@ LABEL maintainer="Jupyter Project " SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Install Tensorflow -RUN arch=$(uname -m) && \ - if [ "${arch}" == "aarch64" ]; then \ - # Prevent libmamba from sporadically hanging on arm64 under QEMU - # - export G_SLICE=always-malloc; \ - fi && \ - mamba install --quiet --yes \ +RUN mamba install --quiet --yes \ 'tensorflow' && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ From b40de11cd0a6a9f501fd7366b613a01928336ac4 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 11:21:27 +0400 Subject: [PATCH 119/129] Better docs --- docs/maintaining/aarch64-runner.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index 3514e5235c..908ac39310 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -1,10 +1,11 @@ # Self-hosted runners -For `aarch64` images, we have self-hosted VMs, provided by [Oracle OCI](https://www.oracle.com/cloud/). +For building `aarch64` images, we use VMs, provided by [Oracle OCI](https://www.oracle.com/cloud/). +Currently, there are 2 self-hosted GitHub runners with _2 OCPU_ and _12 GB_ each. To setup a new runner: -1. Create a compute instance `VM.Standard.A1.Flex` with _1 OCPU_ and _6 GB_ using `Ubuntu 22.04` image. +1. Create a compute instance `VM.Standard.A1.Flex` with _2 OCPU_ and _12 GB_ using `Ubuntu 22.04` image. 2. Run under `root`: ```bash From a1e63937ce9528b1553c78919b6c20dc53acba07 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 11:22:08 +0400 Subject: [PATCH 120/129] Use ARM64 tag for self-hosted runners --- .github/workflows/docker.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4b64565a6e..48a7ff9bc9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -72,7 +72,7 @@ jobs: parentImage: "" image: base-notebook platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 amd64-base: uses: ./.github/workflows/docker-build-test-upload.yml @@ -89,7 +89,7 @@ jobs: parentImage: base-notebook image: minimal-notebook platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 amd64-minimal: needs: [amd64-base] @@ -107,7 +107,7 @@ jobs: parentImage: minimal-notebook image: scipy-notebook platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 amd64-scipy: needs: [amd64-minimal] @@ -125,7 +125,7 @@ jobs: parentImage: minimal-notebook image: r-notebook platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 amd64-r: needs: [amd64-minimal] @@ -161,7 +161,7 @@ jobs: parentImage: scipy-notebook image: pyspark-notebook platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 amd64-pyspark: needs: [amd64-scipy] @@ -179,7 +179,7 @@ jobs: parentImage: pyspark-notebook image: all-spark-notebook platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 amd64-all-spark: needs: [amd64-pyspark] @@ -203,7 +203,7 @@ jobs: uses: ./.github/workflows/docker-tag-manifest-push.yml with: platform: aarch64 - runsOn: self-hosted + runsOn: ARM64 # https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations # The strategy property is not supported in any job that calls a reusable workflow # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 From 6e536016e84d675f844eb934ba97a36f077a1680 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:21:20 +0400 Subject: [PATCH 121/129] Better filenames for manifests and hist lines --- .github/workflows/docker-tag-manifest-push.yml | 4 ++-- tagging/update_wiki_page.py | 4 ++-- tagging/write_manifests.py | 11 +++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-tag-manifest-push.yml b/.github/workflows/docker-tag-manifest-push.yml index 7f4e5ccc99..506d375433 100644 --- a/.github/workflows/docker-tag-manifest-push.yml +++ b/.github/workflows/docker-tag-manifest-push.yml @@ -49,13 +49,13 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ matrix.image }}-${{ inputs.platform }}-manifest - path: /tmp/manifests/*.md + path: /tmp/manifests/${{ inputs.platform }}-${{ matrix.image }}-*.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 + path: /tmp/hist_lines/${{ inputs.platform }}-${{ matrix.image }}-*.txt retention-days: 3 - name: Login to Docker Hub 🔐 diff --git a/tagging/update_wiki_page.py b/tagging/update_wiki_page.py index bd6f46754b..597e8f7ce0 100755 --- a/tagging/update_wiki_page.py +++ b/tagging/update_wiki_page.py @@ -15,7 +15,7 @@ def update_wiki_page(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> wiki_home_file = wiki_dir / "Home.md" wiki_home_content = wiki_home_file.read_text() - build_history_line_files = hist_line_dir.rglob("*.txt") + build_history_line_files = sorted(hist_line_dir.rglob("*.txt")) build_history_lines = "\n".join( hist_line_file.read_text() for hist_line_file in build_history_line_files ) @@ -25,7 +25,7 @@ def update_wiki_page(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> wiki_home_file.write_text(wiki_home_content) LOGGER.info("Wiki home file updated") - for manifest_file in manifest_dir.rglob("*.md"): + for manifest_file in sorted(manifest_dir.rglob("*.md")): shutil.copy(manifest_file, wiki_dir / "manifests" / manifest_file.name) LOGGER.info(f"Manifest file added: {manifest_file.name}") diff --git a/tagging/write_manifests.py b/tagging/write_manifests.py index 99a75b8088..63c36661b1 100755 --- a/tagging/write_manifests.py +++ b/tagging/write_manifests.py @@ -4,6 +4,7 @@ import argparse import datetime import logging +import platform from pathlib import Path from docker.models.containers import Container @@ -67,6 +68,11 @@ def write_manifest_file( (manifest_dir / f"{filename}.md").write_text(markdown_content) +def get_file_prefix() -> str: + machine = platform.machine() + return "amd64" if machine == "x86_64" else "aarch64" + + def write_manifests( short_image_name: str, owner: str, @@ -78,11 +84,12 @@ def write_manifests( image = f"{owner}/{short_image_name}:latest" - tags_prefix = get_tags_prefix() + file_prefix = get_file_prefix() commit_hash_tag = GitHelper.commit_hash_tag() - filename = f"{tags_prefix}{short_image_name}-{commit_hash_tag}" + filename = f"{file_prefix}-{short_image_name}-{commit_hash_tag}" with DockerRunner(image) as container: + tags_prefix = get_tags_prefix() all_tags = [tags_prefix + tagger.tag_value(container) for tagger in taggers] write_build_history_line( short_image_name, owner, hist_line_dir, filename, all_tags From 57f882f0f60aecbd1f93e261493012b8d3d0cd6f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:25:04 +0400 Subject: [PATCH 122/129] Better docs --- .github/actions/create-dev-env/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 7f874a6f3a..4e903ea6be 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -10,8 +10,9 @@ inputs: runs: using: composite steps: - # aarch64 runners do not have pre-built python3 distributions - # so, we install python3 in the aarch64 VM manually + # actions/setup-python doesn't suport Linux aarch64 runners + # See: https://github.com/actions/setup-python/issues/108 + # python3 is manually preinstalled in the aarch64 VM self-hosted runner - name: Set Up Python 🐍 uses: actions/setup-python@v4 with: From dd646ad93d150e54e105c2411960270db7a6a42a Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:27:18 +0400 Subject: [PATCH 123/129] Add --upgrade to pip requirements to have environment identical to freshly created --- .github/actions/create-dev-env/action.yml | 2 +- .github/workflows/sphinx.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml index 4e903ea6be..47e0df02c5 100644 --- a/.github/actions/create-dev-env/action.yml +++ b/.github/actions/create-dev-env/action.yml @@ -22,5 +22,5 @@ runs: - name: Install Dev Dependencies 📦 run: | pip install --upgrade pip - pip install -r requirements-dev.txt + pip install --upgrade -r requirements-dev.txt shell: bash diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index f2627a97ea..b990a6bc35 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -45,7 +45,7 @@ jobs: - name: Install Doc Dependencies 📦 run: | pip install --upgrade pip - pip install -r requirements-docs.txt + pip install --upgrade -r requirements-docs.txt - name: Build Documentation 📖 run: make docs From e78c8aa8314c9733fe6406de7614226d163c3565 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:28:40 +0400 Subject: [PATCH 124/129] Better docs --- .github/actions/download-manifests/action.yml | 2 +- .github/actions/load-image/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/download-manifests/action.yml b/.github/actions/download-manifests/action.yml index 3423caaa73..1d77b3307e 100644 --- a/.github/actions/download-manifests/action.yml +++ b/.github/actions/download-manifests/action.yml @@ -2,7 +2,7 @@ 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 +# To make this workflow fast, we manually list all manifests and history lines downloads # https://github.com/actions/download-artifact/issues/6 inputs: diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index 618e70f579..72ba67e474 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -1,5 +1,5 @@ name: Load Docker image -description: Download image artifact and load it to docker +description: Download image tar and load it to docker inputs: image: From 04f8bd5c0db04066ead442459db08d28655fe9ca Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:35:06 +0400 Subject: [PATCH 125/129] Better docs --- .github/actions/load-image/action.yml | 2 +- .github/workflows/docker.yml | 3 --- README.md | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml index 72ba67e474..99a74853b4 100644 --- a/.github/actions/load-image/action.yml +++ b/.github/actions/load-image/action.yml @@ -15,7 +15,7 @@ runs: using: composite steps: # Self-hosted runners share a state (whole VM) between runs - - name: Cleanup unwanted docker images 🗑️ + - name: Reset docker state 🗑️ run: docker system prune --all --force shell: bash diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 48a7ff9bc9..06fbb246a7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -233,9 +233,6 @@ jobs: with: platform: amd64 runsOn: ubuntu-latest - # https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations - # The strategy property is not supported in any job that calls a reusable workflow - # Using the workaround: https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2 images: >- [ "base-notebook", diff --git a/README.md b/README.md index 93a6b21c7a..4a22502ad1 100644 --- a/README.md +++ b/README.md @@ -117,4 +117,4 @@ This change is tracked in the issue [#1217](https://github.com/jupyter/docker-st - We publish containers for both `amd64` (`x86_64`) and `aarch64` platforms, except for `datascience-notebook` and `tensorflow-notebook`, which only support `amd64` for now - We do not create multi-platform images -- Instead, all arm64 images have `aarch64-` tag prefix, for example `jupyter/base-notebook:aarch64-python-3.10.5` +- Instead, all `arm64` images have _aarch64-_ tag prefix, for example `jupyter/base-notebook:aarch64-python-3.10.5` From 7c4f3bd4a0228ab89908cabe6da95c53d3a4fa1d Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:39:18 +0400 Subject: [PATCH 126/129] Remove unit_check_file --- base-notebook/Dockerfile | 1 - base-notebook/test-file.txt | 1 - tests/base-notebook/units/unit_check_file.py | 8 -------- 3 files changed, 10 deletions(-) delete mode 100644 base-notebook/test-file.txt delete mode 100644 tests/base-notebook/units/unit_check_file.py diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index df735db043..9b1e911f88 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -103,7 +103,6 @@ RUN mkdir "/home/${NB_USER}/work" && \ # Do all this in a single RUN command to avoid duplicating all of the # files across image layers when the permissions change COPY --chown="${NB_UID}:${NB_GID}" initial-condarc "${CONDA_DIR}/.condarc" -COPY --chown="${NB_UID}:${NB_GID}" test-file.txt /tmp/test-file.txt WORKDIR /tmp RUN set -x && \ arch=$(uname -m) && \ diff --git a/base-notebook/test-file.txt b/base-notebook/test-file.txt deleted file mode 100644 index bd83801f89..0000000000 --- a/base-notebook/test-file.txt +++ /dev/null @@ -1 +0,0 @@ -test-content diff --git a/tests/base-notebook/units/unit_check_file.py b/tests/base-notebook/units/unit_check_file.py deleted file mode 100644 index ecc00719de..0000000000 --- a/tests/base-notebook/units/unit_check_file.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. - -from pathlib import Path - -file = Path("/tmp/test-file.txt") -assert file.exists() -assert file.read_text() == "test-content\n" From 1c2a91e2c3e2e25a1b85a46337e027cc323b8060 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:39:33 +0400 Subject: [PATCH 127/129] Better docs --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 54ddb166cf..d105e2d364 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -31,8 +31,8 @@ Table of Contents :maxdepth: 2 :caption: Maintainer Guide - maintaining/aarch64-runner maintaining/tasks + maintaining/aarch64-runner .. toctree:: :maxdepth: 2 From 85daab3b71cb46ed3259e53bfae43d48e1f513ff Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:40:09 +0400 Subject: [PATCH 128/129] Update url --- docs/maintaining/aarch64-runner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index 908ac39310..c73ed10f7e 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -9,7 +9,7 @@ To setup a new runner: 2. Run under `root`: ```bash - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mathbunnyru/docker-stacks/asalikhov/new_build_system/aarch64-runner/setup.sh)" + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jupyter/docker-stacks/HEAD/aarch64-runner/setup.sh)" ``` This will perform initial runner setup and create a non-root user `runner-user`. From 65e0467482feb16dffed1705e0d16ee0e73fb3e8 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 5 Jul 2022 13:40:57 +0400 Subject: [PATCH 129/129] Better docs --- docs/maintaining/aarch64-runner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintaining/aarch64-runner.md b/docs/maintaining/aarch64-runner.md index c73ed10f7e..df204faa9d 100644 --- a/docs/maintaining/aarch64-runner.md +++ b/docs/maintaining/aarch64-runner.md @@ -12,7 +12,7 @@ To setup a new runner: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jupyter/docker-stacks/HEAD/aarch64-runner/setup.sh)" ``` - This will perform initial runner setup and create a non-root user `runner-user`. + This will perform initial runner setup and create a user `runner-user` without `sudo` capabilities. 3. Setup new GitHub Runner under `runner-user` using [GitHub Instructions](https://github.com/jupyter/docker-stacks/settings/actions/runners/new?arch=arm64&os=linux). Do not `./run.sh` yet.