Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ on:
required: false
description: "Optional sub-key to append to the image name for build layer caching"
type: string
cache-scope:
required: false
description: "Optional scope for isolated cache writes with shared-cache fallback"
type: string
cache-fallback-scope:
required: false
description: "Optional canonical scope to read before the legacy shared cache"
type: string
platforms:
required: false
description: "Platforms for which to build (default: linux/amd64,linux/arm64)"
Expand Down Expand Up @@ -125,10 +133,32 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute cache key
id: cache
env:
CACHE_SCOPE: ${{ inputs.cache-scope }}
CACHE_FALLBACK_SCOPE: ${{ inputs.cache-fallback-scope }}
run: |
KEY="${{ matrix.arch }}-${{ inputs.image-name }}"
[ -z "${{ inputs.cache-key }}" ] || KEY="${KEY}-${{ inputs.cache-key }}"
echo "ref=${{ needs.prepare.outputs.registry }}/buildcache:${KEY}" >> "$GITHUB_OUTPUT"
LEGACY_REF="${{ needs.prepare.outputs.registry }}/buildcache:${KEY}"
if [ -n "$CACHE_SCOPE" ]; then
SCOPE_HASH=$(printf '%s' "$CACHE_SCOPE" | sha256sum | cut -c1-12)
WRITE_REF="${LEGACY_REF}-ref-${SCOPE_HASH}"
{
echo 'sources<<EOF'
echo "type=registry,ref=${WRITE_REF}"
if [ -n "$CACHE_FALLBACK_SCOPE" ]; then
FALLBACK_HASH=$(printf '%s' "$CACHE_FALLBACK_SCOPE" | sha256sum | cut -c1-12)
FALLBACK_REF="${LEGACY_REF}-ref-${FALLBACK_HASH}"
[ "$FALLBACK_REF" = "$WRITE_REF" ] || echo "type=registry,ref=${FALLBACK_REF}"
fi
echo "type=registry,ref=${LEGACY_REF}"
echo 'EOF'
echo "destination=type=registry,ref=${WRITE_REF},mode=max"
} >> "$GITHUB_OUTPUT"
else
echo "sources=type=registry,ref=${LEGACY_REF}" >> "$GITHUB_OUTPUT"
echo "destination=type=registry,ref=${LEGACY_REF},mode=max" >> "$GITHUB_OUTPUT"
fi
- name: Build and push by digest
id: docker-build
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
Expand All @@ -146,8 +176,8 @@ jobs:
secrets: |
${{ inputs.object-storage-secrets && format('s3_access_key_id={0}', secrets.SCCACHE_S3_ACCESS_KEY_ID) || '' }}
${{ inputs.object-storage-secrets && format('s3_secret_access_key={0}', secrets.SCCACHE_S3_SECRET_ACCESS_KEY) || '' }}
cache-from: type=registry,ref=${{ steps.cache.outputs.ref }}
cache-to: type=registry,ref=${{ steps.cache.outputs.ref }},mode=max
cache-from: ${{ steps.cache.outputs.sources }}
cache-to: ${{ steps.cache.outputs.destination }}
- name: Export digest
id: export
run: echo "digest-${{ matrix.arch }}=${{ steps.docker-build.outputs.digest }}" >> "$GITHUB_OUTPUT"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/vllm-tensorizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- ".github/configurations/vllm-tensorizer.yml"
- ".github/workflows/vllm-tensorizer.yml"

concurrency:
group: vllm-tensorizer-${{ github.ref }}
queue: max

jobs:
get-config:
Expand Down Expand Up @@ -35,6 +38,8 @@ jobs:
folder: vllm-tensorizer
tag-suffix: ${{ matrix.tag-suffix }}
cache-key: ${{ matrix.cache-key }}
cache-scope: ${{ github.ref_name }}
cache-fallback-scope: main
build-contexts: |
common=common
object-storage-secrets: true
Expand Down
Loading