1
0
Fork 0
mirror of https://github.com/docker/setup-qemu-action.git synced 2024-12-22 15:02:23 +00:00

Uninstall current emulators

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-10-08 19:08:44 +02:00
parent e81a89b173
commit 3496826faa
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
7 changed files with 43 additions and 17 deletions

View file

@ -2,7 +2,7 @@ name: ci
on:
schedule:
- cron: '0 10 * * *' # everyday at 10am
- cron: '0 10 * * *'
push:
branches:
- 'master'
@ -40,9 +40,6 @@ jobs:
-
name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
-
name: Dump context
uses: crazy-max/ghaction-dump-context@v1
error:
runs-on: ubuntu-latest
@ -67,7 +64,23 @@ jobs:
echo "::error::Should have failed"
exit 1
fi
reset:
runs-on: ubuntu-latest
steps:
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1
name: Checkout
uses: actions/checkout@v3
-
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 }}

View file

@ -39,18 +39,19 @@ jobs:
Following inputs can be used as `step.with` keys
| Name | Type | Description |
|-------------|--------|---------------------------------------------------------------------------------------------------------------------------|
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
| Name | Type | Default | Description |
|-------------|--------|-------------------------------------------------------------------------------|-------------------------------------------------|
| `image` | String | [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | QEMU static binaries Docker image |
| `platforms` | String | `all` | Platforms to install |
| `reset` | Bool | `false` | Uninstall current emulators before installation |
### outputs
Following outputs are available
| Name | Type | Description |
|---------------|---------|---------------------------------------|
| `platforms` | String | Available platforms (comma separated) |
| Name | Type | Description |
|-------------|---------|---------------------------------------|
| `platforms` | String | Available platforms (comma separated) |
## Contributing

View file

@ -15,6 +15,10 @@ inputs:
description: 'Platforms to install (e.g. arm64,riscv64,arm)'
default: 'all'
required: false
reset:
description: 'Uninstall current emulators before installation'
default: 'false'
required: false
outputs:
platforms:

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

@ -3,11 +3,13 @@ import * as core from '@actions/core';
export interface Inputs {
image: string;
platforms: string;
reset: boolean;
}
export function getInputs(): Inputs {
return {
image: core.getInput('image') || 'tonistiigi/binfmt:latest',
platforms: core.getInput('platforms') || 'all'
platforms: core.getInput('platforms') || 'all',
reset: core.getBooleanInput('reset')
};
}

View file

@ -24,6 +24,12 @@ async function run(): Promise<void> {
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 exec.exec('docker', ['image', 'inspect', input.image]);
});