docker: set default standalone
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -2,26 +2,30 @@ import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
export class Docker {
|
||||
public static async isAvailable(): Promise<boolean> {
|
||||
return await exec
|
||||
public static isAvailable(): boolean {
|
||||
let dockerAvailable = false;
|
||||
exec
|
||||
.getExecOutput('docker', undefined, {
|
||||
ignoreReturnCode: true,
|
||||
silent: true
|
||||
})
|
||||
.then(res => {
|
||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||
return false;
|
||||
dockerAvailable = false;
|
||||
} else {
|
||||
dockerAvailable = res.exitCode == 0;
|
||||
}
|
||||
return res.exitCode == 0;
|
||||
})
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
.catch(error => {
|
||||
return false;
|
||||
dockerAvailable = false;
|
||||
});
|
||||
return dockerAvailable;
|
||||
}
|
||||
|
||||
public static async info(standalone?: boolean) {
|
||||
if (standalone) {
|
||||
const dockerAvailable = standalone ?? !Docker.isAvailable();
|
||||
if (dockerAvailable) {
|
||||
core.info(`Docker info skipped in standalone mode`);
|
||||
} else {
|
||||
await exec.exec('docker', ['version'], {
|
||||
|
||||
Reference in New Issue
Block a user