Skip to content

Commit

Permalink
buildx: info logs on install
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Feb 19, 2023
1 parent 139fb39 commit 89ecd37
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/buildx/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export class Install {
}

public async installStandalone(toolPath: string, dest?: string): Promise<string> {
core.info('Standalone mode');
dest = dest || this.context.tmpDir();
const toolBinPath = path.join(toolPath, os.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx');
const binDir = path.join(dest, 'bin');
Expand All @@ -111,13 +112,19 @@ export class Install {
const filename: string = os.platform() == 'win32' ? 'buildx.exe' : 'buildx';
const buildxPath: string = path.join(binDir, filename);
fs.copyFileSync(toolBinPath, buildxPath);

core.info('Fixing perms');
fs.chmodSync(buildxPath, '0755');

core.addPath(binDir);
core.debug(`Install.installStandalone buildxPath: ${buildxPath}`);
core.info('Added Buildx to PATH');

core.info(`Binary path: ${buildxPath}`);
return buildxPath;
}

public async installPlugin(toolPath: string, dest?: string): Promise<string> {
core.info('Docker plugin mode');
dest = dest || Docker.configDir;
const toolBinPath = path.join(toolPath, os.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx');
const pluginsDir: string = path.join(dest, 'cli-plugins');
Expand All @@ -127,8 +134,11 @@ export class Install {
const filename: string = os.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
const pluginPath: string = path.join(pluginsDir, filename);
fs.copyFileSync(toolBinPath, pluginPath);

core.info('Fixing perms');
fs.chmodSync(pluginPath, '0755');
core.debug(`Install.installPlugin pluginPath: ${pluginPath}`);

core.info(`Plugin path: ${pluginPath}`);
return pluginPath;
}

Expand Down Expand Up @@ -172,9 +182,9 @@ export class Install {
private async fetchBinary(version: string): Promise<string> {
const targetFile: string = os.platform() == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
const downloadURL = util.format('https://github.com/docker/buildx/releases/download/v%s/%s', version, this.filename(version));
core.info(`Downloading ${downloadURL}`);
const downloadPath = await tc.downloadTool(downloadURL);
core.debug(`downloadURL: ${downloadURL}`);
core.debug(`downloadPath: ${downloadPath}`);
core.debug(`Install.fetchBinary downloadPath: ${downloadPath}`);
return await tc.cacheFile(downloadPath, targetFile, 'buildx', version);
}

Expand Down

0 comments on commit 89ecd37

Please sign in to comment.