mirror of
https://github.com/docker/setup-qemu-action
synced 2024-11-10 06:41:40 +00:00
Uninstall current emulators
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
e81a89b173
commit
3496826faa
7 changed files with 43 additions and 17 deletions
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
|
@ -2,7 +2,7 @@ name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *' # everyday at 10am
|
- cron: '0 10 * * *'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
|
@ -40,9 +40,6 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Available platforms
|
name: Available platforms
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
||||||
-
|
|
||||||
name: Dump context
|
|
||||||
uses: crazy-max/ghaction-dump-context@v1
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -67,7 +64,23 @@ jobs:
|
||||||
echo "::error::Should have failed"
|
echo "::error::Should have failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
reset:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
-
|
-
|
||||||
name: Dump context
|
name: Checkout
|
||||||
if: always()
|
uses: actions/checkout@v3
|
||||||
uses: crazy-max/ghaction-dump-context@v1
|
-
|
||||||
|
name: Install multiarch/qemu-user-static
|
||||||
|
run: |
|
||||||
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
id: qemu
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
reset: true
|
||||||
|
-
|
||||||
|
name: Available platforms
|
||||||
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
||||||
|
|
11
README.md
11
README.md
|
@ -39,17 +39,18 @@ jobs:
|
||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Default | Description |
|
||||||
|-------------|--------|---------------------------------------------------------------------------------------------------------------------------|
|
|-------------|--------|-------------------------------------------------------------------------------|-------------------------------------------------|
|
||||||
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
|
| `image` | String | [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | QEMU static binaries Docker image |
|
||||||
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
|
| `platforms` | String | `all` | Platforms to install |
|
||||||
|
| `reset` | Bool | `false` | Uninstall current emulators before installation |
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
Following outputs are available
|
Following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------|---------|---------------------------------------|
|
|-------------|---------|---------------------------------------|
|
||||||
| `platforms` | String | Available platforms (comma separated) |
|
| `platforms` | String | Available platforms (comma separated) |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
@ -15,6 +15,10 @@ inputs:
|
||||||
description: 'Platforms to install (e.g. arm64,riscv64,arm)'
|
description: 'Platforms to install (e.g. arm64,riscv64,arm)'
|
||||||
default: 'all'
|
default: 'all'
|
||||||
required: false
|
required: false
|
||||||
|
reset:
|
||||||
|
description: 'Uninstall current emulators before installation'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
platforms:
|
platforms:
|
||||||
|
|
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -3,11 +3,13 @@ import * as core from '@actions/core';
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
image: string;
|
image: string;
|
||||||
platforms: string;
|
platforms: string;
|
||||||
|
reset: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
return {
|
return {
|
||||||
image: core.getInput('image') || 'tonistiigi/binfmt:latest',
|
image: core.getInput('image') || 'tonistiigi/binfmt:latest',
|
||||||
platforms: core.getInput('platforms') || 'all'
|
platforms: core.getInput('platforms') || 'all',
|
||||||
|
reset: core.getBooleanInput('reset')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,12 @@ async function run(): Promise<void> {
|
||||||
await exec.exec('docker', ['pull', input.image]);
|
await exec.exec('docker', ['pull', input.image]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (input.reset) {
|
||||||
|
await core.group(`Uninstalling current emulators`, async () => {
|
||||||
|
await exec.exec('docker', ['run', '--rm', '--privileged', input.image, '--uninstall', 'qemu-*']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
await core.group(`Image info`, async () => {
|
await core.group(`Image info`, async () => {
|
||||||
await exec.exec('docker', ['image', 'inspect', input.image]);
|
await exec.exec('docker', ['image', 'inspect', input.image]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue