mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-20 06:07:55 +00:00
Add debug logs when registry secrets are being used
If you unknowingly have a `secrets.json` file that has incorrect credentials, it can be really hard to debug why you're builds will start failing with the error: ``` unauthorized: incorrect username or password ``` This change adds extra logging that will make it more obvious what's going on when you use `--debug`. Change-type: patch Signed-off-by: Lucian Buzzo <lucian.buzzo@gmail.com>
This commit is contained in:
parent
f55dd81a19
commit
edc7195126
@ -910,6 +910,7 @@ export async function getRegistrySecrets(
|
|||||||
sdk: BalenaSDK,
|
sdk: BalenaSDK,
|
||||||
inputFilename?: string,
|
inputFilename?: string,
|
||||||
): Promise<MultiBuild.RegistrySecrets> {
|
): Promise<MultiBuild.RegistrySecrets> {
|
||||||
|
const logger = await Logger.getLogger();
|
||||||
if (inputFilename != null) {
|
if (inputFilename != null) {
|
||||||
return await parseRegistrySecrets(inputFilename);
|
return await parseRegistrySecrets(inputFilename);
|
||||||
}
|
}
|
||||||
@ -923,6 +924,7 @@ export async function getRegistrySecrets(
|
|||||||
|
|
||||||
for (const potentialPath of potentialPaths) {
|
for (const potentialPath of potentialPaths) {
|
||||||
if (await exists(potentialPath)) {
|
if (await exists(potentialPath)) {
|
||||||
|
logger.logDebug(`Found registry secrets file: ${potentialPath}`);
|
||||||
return await parseRegistrySecrets(potentialPath);
|
return await parseRegistrySecrets(potentialPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,6 +530,13 @@ async function assignDockerBuildOpts(
|
|||||||
|
|
||||||
globalLogger.logDebug(`Using ${images.length} on-device images for cache...`);
|
globalLogger.logDebug(`Using ${images.length} on-device images for cache...`);
|
||||||
|
|
||||||
|
if (opts.registrySecrets && Object.keys(opts.registrySecrets).length > 0) {
|
||||||
|
globalLogger.logDebug('Using secrets for the following registries:');
|
||||||
|
for (const registry of Object.keys(opts.registrySecrets)) {
|
||||||
|
globalLogger.logDebug(` ${registry}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
buildTasks.map(async (task: BuildTask) => {
|
buildTasks.map(async (task: BuildTask) => {
|
||||||
task.dockerOpts = {
|
task.dockerOpts = {
|
||||||
|
Loading…
Reference in New Issue
Block a user