mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-26 22:26:08 +08:00
buildx: install method
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
8cb1698b20
commit
2abe456e6b
@ -88,6 +88,14 @@ describe('certsDir', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('install', () => {
|
||||
it('acquires buildx v0.9.1', async () => {
|
||||
const buildx = new Buildx({context: new Context()});
|
||||
const buildxBin = await buildx.install('v0.9.1', tmpDir);
|
||||
expect(fs.existsSync(buildxBin)).toBe(true);
|
||||
}, 100000);
|
||||
});
|
||||
|
||||
describe('isAvailable', () => {
|
||||
it('docker cli', async () => {
|
||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
||||
|
@ -34,16 +34,16 @@ export interface BuildxOpts {
|
||||
export class Buildx {
|
||||
private readonly context: Context;
|
||||
private _version: string | undefined;
|
||||
private _install: Install;
|
||||
|
||||
public readonly inputs: Inputs;
|
||||
public readonly install: Install;
|
||||
public readonly standalone: boolean;
|
||||
|
||||
constructor(opts: BuildxOpts) {
|
||||
this.context = opts.context;
|
||||
this.inputs = new Inputs(this.context);
|
||||
this.install = new Install({standalone: opts.standalone});
|
||||
this.standalone = opts?.standalone ?? !Docker.isAvailable;
|
||||
this._install = new Install({standalone: opts.standalone});
|
||||
}
|
||||
|
||||
static get configDir(): string {
|
||||
@ -61,6 +61,10 @@ export class Buildx {
|
||||
};
|
||||
}
|
||||
|
||||
public async install(version: string, dest: string): Promise<string> {
|
||||
return await this._install.install(version, dest);
|
||||
}
|
||||
|
||||
public async isAvailable(): Promise<boolean> {
|
||||
const cmd = this.getCommand([]);
|
||||
return await exec
|
||||
|
Loading…
Reference in New Issue
Block a user