setup regctl and undock

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-04-24 11:44:54 +02:00
parent b7bb1d4426
commit 63f2e57f85
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
2 changed files with 60 additions and 2 deletions

View File

@ -305,3 +305,27 @@ jobs:
docker info
env:
DOCKER_HOST: ${{ steps.setup_docker.outputs.tcp }}
undock-regctl-version:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
undock_version:
- ''
- v0.9.0
regctl_version:
- ''
- v0.8.2
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker
uses: ./
with:
version: type=image
env:
UNDOCK_VERSION: ${{ matrix.undock_version }}
REGCTL_VERSION: ${{ matrix.regctl_version }}

View File

@ -5,10 +5,17 @@ import * as core from '@actions/core';
import * as actionsToolkit from '@docker/actions-toolkit';
import {Install} from '@docker/actions-toolkit/lib/docker/install';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install';
import {Regctl} from '@docker/actions-toolkit/lib/regclient/regctl';
import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install';
import {Undock} from '@docker/actions-toolkit/lib/undock/undock';
import * as context from './context';
import * as stateHelper from './state-helper';
const regctlDefaultVersion = 'v0.8.3';
const undockDefaultVersion = 'v0.10.0';
actionsToolkit.run(
// main
async () => {
@ -19,6 +26,29 @@ actionsToolkit.run(
throw new Error(`'default' context cannot be used.`);
}
if (input.source.type === 'image') {
await core.group(`Download and install regctl`, async () => {
const regclientInstall = new RegclientInstall();
const regclientBinPath = await regclientInstall.download(
process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim()
? process.env.REGCTL_VERSION
: regctlDefaultVersion,
true
);
await regclientInstall.install(regclientBinPath);
});
await core.group(`Download and install undock`, async () => {
const undockInstall = new UndockInstall();
const undockBinPath = await undockInstall.download(
process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim()
? process.env.UNDOCK_VERSION
: undockDefaultVersion,
true
);
await undockInstall.install(undockBinPath);
});
}
let tcpPort: number | undefined;
let tcpAddress: string | undefined;
if (input.tcpPort) {
@ -32,7 +62,9 @@ actionsToolkit.run(
rootless: input.rootless,
contextName: input.context || 'setup-docker-action',
daemonConfig: input.daemonConfig,
localTCPPort: tcpPort
localTCPPort: tcpPort,
regctl: new Regctl(),
undock: new Undock()
});
let toolDir;
if (!(await Docker.isAvailable()) || input.source) {
@ -71,7 +103,9 @@ actionsToolkit.run(
return;
}
const install = new Install({
runDir: stateHelper.runDir
runDir: stateHelper.runDir,
regctl: new Regctl(),
undock: new Undock()
});
await install.tearDown();
}