buildx: certsDir

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-02-10 11:34:16 +01:00
parent 5e365b5a48
commit b223e0a42b
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 22 additions and 0 deletions

View File

@ -68,6 +68,24 @@ describe('configDir', () => {
});
});
describe('certsDir', () => {
const originalEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {
...originalEnv,
BUILDX_CONFIG: '/var/docker/buildx'
};
});
afterEach(() => {
process.env = originalEnv;
});
it('returns default', async () => {
process.env.BUILDX_CONFIG = '/var/docker/buildx';
expect(Buildx.certsDir).toEqual(path.join('/var/docker/buildx', 'certs'));
});
});
describe('isAvailable', () => {
it('docker cli', async () => {
const execSpy = jest.spyOn(exec, 'getExecOutput');

View File

@ -47,6 +47,10 @@ export class Buildx {
return process.env.BUILDX_CONFIG || path.join(Docker.configDir, 'buildx');
}
static get certsDir(): string {
return path.join(Buildx.configDir, 'certs');
}
public getCommand(args: Array<string>) {
return {
command: this.standalone ? 'buildx' : 'docker',