Skip to content

Commit 847887b

Browse files
committed
some debug logs
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent d998421 commit 847887b

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

src/buildx/buildx.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import fs from 'fs';
1818
import path from 'path';
19+
import * as core from '@actions/core';
1920
import * as exec from '@actions/exec';
2021
import * as semver from 'semver';
2122

@@ -123,9 +124,12 @@ export class Buildx {
123124
public async versionSatisfies(range: string, version?: string): Promise<boolean> {
124125
const ver = version ?? (await this.version);
125126
if (!ver) {
127+
core.debug(`Buildx.versionSatisfies false: undefined version`);
126128
return false;
127129
}
128-
return semver.satisfies(ver, range) || /^[0-9a-f]{7}$/.exec(ver) !== null;
130+
const res = semver.satisfies(ver, range) || /^[0-9a-f]{7}$/.exec(ver) !== null;
131+
core.debug(`Buildx.versionSatisfies ${ver} statisfies ${range}: ${res}`);
132+
return res;
129133
}
130134

131135
public static resolveCertsDriverOpts(driver: string, endpoint: string, cert: Cert): Array<string> {

src/buildx/install.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class Install {
8080
} else {
8181
vspec = await Git.getRemoteSha(repo, ref);
8282
}
83-
core.debug(`Tool version spec ${vspec}`);
83+
core.debug(`Install.build: tool version spec ${vspec}`);
8484

8585
let toolPath: string;
8686
toolPath = tc.find('buildx', vspec);
@@ -112,16 +112,16 @@ export class Install {
112112

113113
let buildStandalone = false;
114114
if (this.standalone && buildxStandaloneFound) {
115-
core.debug(`Buildx standalone found, build with it`);
115+
core.debug(`Install.buildCommand: Buildx standalone found, build with it`);
116116
buildStandalone = true;
117117
} else if (!this.standalone && buildxPluginFound) {
118-
core.debug(`Buildx plugin found, build with it`);
118+
core.debug(`Install.buildCommand: Buildx plugin found, build with it`);
119119
buildStandalone = false;
120120
} else if (buildxStandaloneFound) {
121-
core.debug(`Buildx plugin not found, but standalone found so trying to build with it`);
121+
core.debug(`Install.buildCommand: Buildx plugin not found, but standalone found so trying to build with it`);
122122
buildStandalone = true;
123123
} else if (buildxPluginFound) {
124-
core.debug(`Buildx standalone not found, but plugin found so trying to build with it`);
124+
core.debug(`Install.buildCommand: Buildx standalone not found, but plugin found so trying to build with it`);
125125
buildStandalone = false;
126126
} else {
127127
throw new Error(`Neither buildx standalone or plugin have been found to build from ref ${gitContext}`);

src/docker.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import os from 'os';
1818
import path from 'path';
19+
import * as core from '@actions/core';
1920
import * as exec from '@actions/exec';
2021

2122
export class Docker {
@@ -32,31 +33,36 @@ export class Docker {
3233
})
3334
.then(res => {
3435
if (res.stderr.length > 0 && res.exitCode != 0) {
36+
core.debug(`Docker.isAvailable error: ${res.stderr}`);
3537
dockerAvailable = false;
3638
} else {
39+
core.debug(`Docker.isAvailable ok`);
3740
dockerAvailable = res.exitCode == 0;
3841
}
3942
})
4043
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4144
.catch(error => {
45+
core.debug(`Docker.isAvailable failed: ${error}`);
4246
dockerAvailable = false;
4347
});
4448
return dockerAvailable;
4549
}
4650

47-
public static async printVersion(standalone?: boolean) {
51+
public static async printVersion(standalone?: boolean): Promise<void> {
4852
const noDocker = standalone ?? !Docker.isAvailable;
4953
if (noDocker) {
54+
core.debug('Docker.printVersion: Docker is not available, skipping.');
5055
return;
5156
}
5257
await exec.exec('docker', ['version'], {
5358
failOnStdErr: false
5459
});
5560
}
5661

57-
public static async printInfo(standalone?: boolean) {
62+
public static async printInfo(standalone?: boolean): Promise<void> {
5863
const noDocker = standalone ?? !Docker.isAvailable;
5964
if (noDocker) {
65+
core.debug('Docker.printInfo: Docker is not available, skipping.');
6066
return;
6167
}
6268
await exec.exec('docker', ['info'], {

0 commit comments

Comments
 (0)