Repository navigation
Accelerate CI image materialization with same-run snapshots #74173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zozo123
wants to merge
28
commits into
apache:main
Choose a base branch
from
zozo123:ci/ci-image-data-root-snapshot
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,036
−59
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
7ec3869
Restore the CI image from a snapshot of Docker's data directory
zozo123 c510919
Recover Docker safely when CI snapshot materialization fails
zozo123 bf3bdca
Scope CI snapshots to the current workflow run
zozo123 2c8da41
Publish authoritative caches before optional CI snapshot execution
zozo123 1e4b25b
Isolate CI snapshot creation from branch cache publishers
zozo123 ce044e0
Bind optional snapshot jobs to the workflow commit
zozo123 233c553
Avoid reloading the CI image before snapshot creation
zozo123 3883395
Execute the snapshot script from the immutable workflow commit
zozo123 3406161
Keep optional snapshots in an isolated read-only job
zozo123 770c6db
Preserve Docker state when snapshot inventory checks fail
zozo123 de202b1
Retrigger CI after provider compatibility timeout
zozo123 c64df1f
Create CI snapshots in the builder after publishing caches
zozo123 4dd967a
Write CI snapshots off the Docker data disk
zozo123 83e40de
Cache CI dependencies separately from workspace source
zozo123 538c6f7
Make dependency manifest extraction portable
zozo123 8dbb64d
Run dependency manifest extraction with Bash
zozo123 19ba711
Harden dependency manifest extraction
zozo123 3793fc0
Address CI snapshot review and separate dependency caching
zozo123 c96828a
Merge commit '785d82da5c0419aa97b0dc6e9510b0a7bd91a6c6' into ci/ci-im…
zozo123 83a085d
Name the CI image snapshot artifact v1
zozo123 2fe6e12
Keep CI image snapshots for one day
zozo123 fe39ec5
Drop snapshot-ci-images assertion per review
cursoragent 7c367ee
Keep CI image snapshots faithful across reruns and check them before …
zozo123 2d3dec6
Verify restored CI image snapshots and route them through breeze
zozo123 08c9943
Check that an unsupported image store skips pruning and publishes onl…
zozo123 6dabcd9
Sort the snapshot file-tree listing outside the container
zozo123 6da2d0f
Create CI image snapshots through breeze ci-image save
zozo123 f1510f1
Merge branch 'main' into ci/ci-image-data-root-snapshot
zozo123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| --- | ||
| name: 'Load image (CI or PROD)' | ||
| description: > | ||
| Loads the current image for one Python version: from the CI image snapshot when it fits this | ||
| runner's daemon, otherwise from the image stash. | ||
| inputs: | ||
| python: | ||
| description: 'Python version of the image to load' | ||
| required: true | ||
| platform: | ||
| description: 'Platform of the image - linux/amd64 or linux/arm64' | ||
| required: true | ||
| image-type: | ||
| description: 'Which image type to load (ci/prod)' | ||
| default: "ci" | ||
| image-stash-ref: | ||
| description: 'Ref whose image stash to restore (empty = the per-branch one)' | ||
| required: false | ||
| default: "" | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| # The metadata is a few bytes, so a snapshot that cannot fit is rejected before its download. | ||
| # A pattern, unlike a name, downloads nothing without an error when the builder made no snapshot. | ||
| # Self-hosted runners restore the stash from their own storage, which a run artifact cannot beat. | ||
| - name: "Download CI image snapshot metadata ${{ inputs.platform }}:${{ inputs.python }}" | ||
| id: snapshot-meta | ||
| continue-on-error: true | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| pattern: >- | ||
| ci-image-snapshot-v1-${{ inputs.python }}-${{ | ||
| inputs.platform == 'linux/amd64' && 'amd64' || 'arm64' }}-meta | ||
| merge-multiple: true | ||
| path: "/mnt/" | ||
| if: > | ||
| github.event_name == 'pull_request' && runner.environment == 'github-hosted' && | ||
| inputs.image-type == 'ci' && inputs.image-stash-ref == '' | ||
| - name: "Check CI image snapshot ${{ inputs.platform }}:${{ inputs.python }}" | ||
| id: snapshot-check | ||
| env: | ||
| PLATFORM: ${{ inputs.platform }} | ||
| PYTHON: ${{ inputs.python }} | ||
| run: | | ||
| if ./scripts/ci/docker_data_root_snapshot.sh check \ | ||
| "/mnt/ci-image-snapshot-${PLATFORM//\//_}-${PYTHON}.tar.zst"; then | ||
| echo "fits=true" >> "${GITHUB_OUTPUT}" | ||
| else | ||
| echo "Falling back to loading the image stash" | ||
| fi | ||
| shell: bash | ||
| if: steps.snapshot-meta.outcome == 'success' | ||
| - name: "Download CI image snapshot ${{ inputs.platform }}:${{ inputs.python }}" | ||
| id: snapshot-download | ||
| continue-on-error: true | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: >- | ||
| ci-image-snapshot-v1-${{ inputs.python }}-${{ | ||
| inputs.platform == 'linux/amd64' && 'amd64' || 'arm64' }} | ||
| path: "/mnt/" | ||
| if: steps.snapshot-check.outputs.fits == 'true' | ||
| # Falls back to the image stash below whenever the snapshot cannot be restored. | ||
| - name: "Unpack CI image snapshot ${{ inputs.platform }}:${{ inputs.python }}" | ||
| id: snapshot | ||
| env: | ||
| PLATFORM: ${{ inputs.platform }} | ||
| PYTHON: ${{ inputs.python }} | ||
| run: | | ||
| if breeze ci-image load --platform "${PLATFORM}" --python "${PYTHON}" \ | ||
| --snapshot-file "/mnt/ci-image-snapshot-${PLATFORM//\//_}-${PYTHON}.tar.zst"; then | ||
| echo "restored=true" >> "${GITHUB_OUTPUT}" | ||
| else | ||
| echo "Falling back to loading the image stash" | ||
| fi | ||
| shell: bash | ||
| if: steps.snapshot-download.outcome == 'success' | ||
| - name: > | ||
| Restore ${{ inputs.image-type }} docker image ${{ inputs.platform }}:${{ inputs.python }} | ||
| ${{ inputs.image-stash-ref != '' && format('built for ref {0}', inputs.image-stash-ref) || '' }} | ||
| uses: ./.github/actions/stash-restore | ||
| with: | ||
| key: "${{ inputs.image-type }}-image-save-v3-${{ inputs.platform }}-${{ inputs.python }}\ | ||
| ${{ inputs.image-stash-ref != '' && format('-{0}', inputs.image-stash-ref) || '' }}" | ||
| path: "/mnt/" | ||
| # Must stay true: runs on RunsOn (canaries and release-branch pushes) save these image | ||
| # stashes as S3 digests only. | ||
| only-current-branch: 'true' | ||
| fail-on-download: 'true' | ||
| if: steps.snapshot.outputs.restored != 'true' | ||
| - name: "Load ${{ inputs.image-type }} image ${{ inputs.platform }}:${{ inputs.python }}" | ||
| env: | ||
| PLATFORM: ${{ inputs.platform }} | ||
| PYTHON: ${{ inputs.python }} | ||
| IMAGE_TYPE: ${{ inputs.image-type }} | ||
| run: > | ||
| breeze ${IMAGE_TYPE}-image load --platform "${PLATFORM}" --python "${PYTHON}" --image-file-dir "/mnt" | ||
| shell: bash | ||
| if: steps.snapshot.outputs.restored != 'true' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.