mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-26 22:26:08 +08:00
docker: info method
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
aae4a2d7bc
commit
595e2417e8
@ -15,3 +15,20 @@ describe('isAvailable', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('info', () => {
|
||||||
|
it('standard', () => {
|
||||||
|
const execSpy = jest.spyOn(exec, 'exec');
|
||||||
|
Docker.info();
|
||||||
|
expect(execSpy).toHaveBeenCalledWith(`docker`, ['version'], {
|
||||||
|
failOnStdErr: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('standalone', () => {
|
||||||
|
const execSpy = jest.spyOn(exec, 'exec');
|
||||||
|
Docker.info(true);
|
||||||
|
expect(execSpy).not.toHaveBeenCalledWith(`docker`, ['version'], {
|
||||||
|
failOnStdErr: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
export class Docker {
|
export class Docker {
|
||||||
@ -18,4 +19,17 @@ export class Docker {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async info(standalone?: boolean) {
|
||||||
|
if (standalone) {
|
||||||
|
core.info(`Docker info skipped in standalone mode`);
|
||||||
|
} else {
|
||||||
|
await exec.exec('docker', ['version'], {
|
||||||
|
failOnStdErr: false
|
||||||
|
});
|
||||||
|
await exec.exec('docker', ['info'], {
|
||||||
|
failOnStdErr: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user