add debug output to mergeExistingDockerAuthJson
This commit is contained in:
parent
7650773bc5
commit
4e0794511b
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -62169,10 +62169,12 @@ function mergeArgRegistryAuthJson(registryAuthJson) {
|
|||||||
|
|
||||||
function mergeExistingDockerAuthJson(registryAuthJson, targetFile) {
|
function mergeExistingDockerAuthJson(registryAuthJson, targetFile) {
|
||||||
if (!core.getBooleanInput('merge_existing_auth_json')) {
|
if (!core.getBooleanInput('merge_existing_auth_json')) {
|
||||||
|
console.log('merge_existing_auth_json is disabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!external_fs_.existsSync(targetFile)) {
|
if (!external_fs_.existsSync(targetFile)) {
|
||||||
|
console.log(`${targetFile} does not exist`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62180,13 +62182,18 @@ function mergeExistingDockerAuthJson(registryAuthJson, targetFile) {
|
|||||||
const existingJsonStr = external_fs_.readFileSync(targetFile, {encoding: 'utf-8'});
|
const existingJsonStr = external_fs_.readFileSync(targetFile, {encoding: 'utf-8'});
|
||||||
const existingJson = JSON.parse(existingJsonStr);
|
const existingJson = JSON.parse(existingJsonStr);
|
||||||
|
|
||||||
if (existingJson.auths != null && typeof existingJson === 'object') {
|
if (existingJson.auths != null && typeof existingJson.auths === 'object') {
|
||||||
for (const key in existingJson.auths) {
|
for (const key in existingJson.auths) {
|
||||||
|
console.log(`existingJson.auths.${key}`);
|
||||||
if (existingJson.auths.hasOwnProperty(key)) {
|
if (existingJson.auths.hasOwnProperty(key)) {
|
||||||
|
console.log(`existingJson.auths.${key} has own property, assigning value`);
|
||||||
registryAuthJson.auths[key] = existingJson.auths[key];
|
registryAuthJson.auths[key] = existingJson.auths[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
console.log('existingJson.auths is ' + typeof existingJson.auths);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.log(`Failed to parse existing docker auth json in file: ${targetFile}"`);
|
console.log(`Failed to parse existing docker auth json in file: ${targetFile}"`);
|
||||||
@ -62478,7 +62485,6 @@ try {
|
|||||||
console.log('determined .docker/config.json location: ', dockerConfigFile);
|
console.log('determined .docker/config.json location: ', dockerConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const registryAuthJson = {auths: {}};
|
const registryAuthJson = {auths: {}};
|
||||||
mergeExistingDockerAuthJson(registryAuthJson);
|
mergeExistingDockerAuthJson(registryAuthJson);
|
||||||
addCiRegistryAuth(ci_registry, registryAuthJson);
|
addCiRegistryAuth(ci_registry, registryAuthJson);
|
||||||
|
|||||||
@ -62,10 +62,12 @@ export function mergeArgRegistryAuthJson(registryAuthJson) {
|
|||||||
|
|
||||||
export function mergeExistingDockerAuthJson(registryAuthJson, targetFile) {
|
export function mergeExistingDockerAuthJson(registryAuthJson, targetFile) {
|
||||||
if (!core.getBooleanInput('merge_existing_auth_json')) {
|
if (!core.getBooleanInput('merge_existing_auth_json')) {
|
||||||
|
console.log('merge_existing_auth_json is disabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(targetFile)) {
|
if (!fs.existsSync(targetFile)) {
|
||||||
|
console.log(`${targetFile} does not exist`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +75,18 @@ export function mergeExistingDockerAuthJson(registryAuthJson, targetFile) {
|
|||||||
const existingJsonStr = fs.readFileSync(targetFile, {encoding: 'utf-8'});
|
const existingJsonStr = fs.readFileSync(targetFile, {encoding: 'utf-8'});
|
||||||
const existingJson = JSON.parse(existingJsonStr);
|
const existingJson = JSON.parse(existingJsonStr);
|
||||||
|
|
||||||
if (existingJson.auths != null && typeof existingJson === 'object') {
|
if (existingJson.auths != null && typeof existingJson.auths === 'object') {
|
||||||
for (const key in existingJson.auths) {
|
for (const key in existingJson.auths) {
|
||||||
|
console.log(`existingJson.auths.${key}`);
|
||||||
if (existingJson.auths.hasOwnProperty(key)) {
|
if (existingJson.auths.hasOwnProperty(key)) {
|
||||||
|
console.log(`existingJson.auths.${key} has own property, assigning value`);
|
||||||
registryAuthJson.auths[key] = existingJson.auths[key];
|
registryAuthJson.auths[key] = existingJson.auths[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
console.log('existingJson.auths is ' + typeof existingJson.auths);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.log(`Failed to parse existing docker auth json in file: ${targetFile}"`);
|
console.log(`Failed to parse existing docker auth json in file: ${targetFile}"`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user