1
0
mirror of https://github.com/docker/setup-qemu-action.git synced 2025-05-14 23:12:49 +08:00

rename: local-cache-path -> cache-image-path

This commit is contained in:
문성하 2025-02-02 22:13:36 +09:00
parent 28a18910d7
commit 02897d02f5
No known key found for this signature in database
7 changed files with 16 additions and 17 deletions

View File

@ -26,9 +26,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
local-cache-path: cache-image-path:
- /tmp/cache - /tmp/cache
# - ''
steps: steps:
- -
@ -39,7 +38,7 @@ jobs:
id: qemu id: qemu
uses: ./ uses: ./
with: with:
local-cache-path: ${{ matrix.local-cache-path }} cache-image-path: ${{ matrix.cache-image-path }}
- -
name: Available platforms name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }} run: echo ${{ steps.qemu.outputs.platforms }}

View File

@ -23,7 +23,7 @@ describe('getInputs', () => {
image: 'docker.io/tonistiigi/binfmt:latest', image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'all', platforms: 'all',
cacheImage: true, cacheImage: true,
localCachePath: '' cacheImagePath: ''
} as context.Inputs } as context.Inputs
], ],
[ [
@ -37,7 +37,7 @@ describe('getInputs', () => {
image: 'docker/binfmt:latest', image: 'docker/binfmt:latest',
platforms: 'arm64,riscv64,arm', platforms: 'arm64,riscv64,arm',
cacheImage: false, cacheImage: false,
localCachePath: '' cacheImagePath: ''
} as context.Inputs } as context.Inputs
], ],
[ [
@ -50,7 +50,7 @@ describe('getInputs', () => {
image: 'docker.io/tonistiigi/binfmt:latest', image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'arm64,riscv64,arm', platforms: 'arm64,riscv64,arm',
cacheImage: true, cacheImage: true,
localCachePath: '' cacheImagePath: ''
} as context.Inputs } as context.Inputs
], ],
[ [
@ -58,13 +58,13 @@ describe('getInputs', () => {
new Map<string, string>([ new Map<string, string>([
['platforms', 'arm64'], ['platforms', 'arm64'],
['cache-image', 'false'], ['cache-image', 'false'],
['local-cache-path', '/tmp/cache'], ['cache-image-path', '/tmp/cache'],
]), ]),
{ {
image: 'docker.io/tonistiigi/binfmt:latest', image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'arm64', platforms: 'arm64',
cacheImage: false, cacheImage: false,
localCachePath: '/tmp/cache' cacheImagePath: '/tmp/cache'
} as context.Inputs } as context.Inputs
] ]
])( ])(

View File

@ -19,7 +19,7 @@ inputs:
description: 'Cache binfmt image to GitHub Actions cache backend' description: 'Cache binfmt image to GitHub Actions cache backend'
default: 'true' default: 'true'
required: false required: false
local-cache-path: cache-image-path:
description: > description: >
Local path to store the binfmt image. Using this enables local caching instead of GitHub Actions cache. Local path to store the binfmt image. Using this enables local caching instead of GitHub Actions cache.
Note: The "latest" tag won't auto-update - delete the cached file to fetch updates. Note: The "latest" tag won't auto-update - delete the cached file to fetch updates.

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ export interface Inputs {
image: string; image: string;
platforms: string; platforms: string;
cacheImage: boolean; cacheImage: boolean;
localCachePath: string; cacheImagePath: string;
} }
export function getInputs(): Inputs { export function getInputs(): Inputs {
@ -13,6 +13,6 @@ export function getInputs(): Inputs {
image: core.getInput('image') || 'docker.io/tonistiigi/binfmt:latest', image: core.getInput('image') || 'docker.io/tonistiigi/binfmt:latest',
platforms: Util.getInputList('platforms').join(',') || 'all', platforms: Util.getInputList('platforms').join(',') || 'all',
cacheImage: core.getBooleanInput('cache-image'), cacheImage: core.getBooleanInput('cache-image'),
localCachePath: core.getInput('local-cache-path') || '' cacheImagePath: core.getInput('cache-image-path') || ''
}; };
} }

View File

@ -20,9 +20,9 @@ actionsToolkit.run(
await Docker.printInfo(); await Docker.printInfo();
}); });
if (input.localCachePath !== '') { if (input.cacheImagePath !== '') {
await core.group(`Pulling binfmt Docker image with local cache`, async () => { await core.group(`Pulling binfmt Docker image with local cache`, async () => {
await loadDockerImageFromCache(input.localCachePath, input.image); await loadDockerImageFromCache(input.cacheImagePath, input.image);
}); });
} else { } else {
await core.group(`Pulling binfmt Docker image`, async () => { await core.group(`Pulling binfmt Docker image`, async () => {
@ -68,9 +68,9 @@ actionsToolkit.run(
// post // post
async () => { async () => {
const input: context.Inputs = context.getInputs(); const input: context.Inputs = context.getInputs();
if (input.localCachePath !== '') { if (input.cacheImagePath !== '') {
await core.group(`Saving binfmt Docker image`, async () => { await core.group(`Saving binfmt Docker image`, async () => {
await saveDockerImageToCache(input.localCachePath, input.image); await saveDockerImageToCache(input.cacheImagePath, input.image);
}); });
} }
} }