debug
This commit is contained in:
parent
82ec3f239f
commit
d4b182543e
54
dist/index.js
vendored
54
dist/index.js
vendored
@ -62095,12 +62095,15 @@ const gBase64 = {
|
||||
// and finally,
|
||||
|
||||
|
||||
// EXTERNAL MODULE: external "path"
|
||||
var external_path_ = __nccwpck_require__(1017);
|
||||
;// CONCATENATED MODULE: ./src/lib.js
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function processAdditionalRegistries(targetRegistries) {
|
||||
const additionalRegistries = core.getInput('additional_registries');
|
||||
if (additionalRegistries != null && additionalRegistries.length > 0) {
|
||||
@ -62154,7 +62157,7 @@ function mergeArgRegistryAuthJson(registryAuthJson) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
catch (error) {
|
||||
console.log('Failed to parse registry auth json', e);
|
||||
core.setFailed(error.message);
|
||||
process.exit(1);
|
||||
@ -62162,8 +62165,9 @@ function mergeArgRegistryAuthJson(registryAuthJson) {
|
||||
}
|
||||
}
|
||||
|
||||
function writeRegistryAuthJson(registryAuthJson, path) {
|
||||
external_fs_.writeFileSync(path, JSON.stringify(registryAuthJson, null, 2));
|
||||
function writeRegistryAuthJson(registryAuthJson, targetFile) {
|
||||
external_fs_.mkdirSync(external_path_.dirname(targetFile), {recursive: true});
|
||||
external_fs_.writeFileSync(targetFile, JSON.stringify(registryAuthJson, null, 2));
|
||||
}
|
||||
|
||||
function collectTags() {
|
||||
@ -62236,32 +62240,40 @@ function prepareDestinations(registries, tags) {
|
||||
|
||||
|
||||
|
||||
const action_information = collect_all(true, false);
|
||||
const debug = !!core.getInput('debug');
|
||||
|
||||
let targetRegistries = [];
|
||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||
try {
|
||||
const information = collect_all(true, false);
|
||||
const debug = !!core.getInput('debug');
|
||||
|
||||
let ci_registry = false;
|
||||
if (core.getBooleanInput('add_ci_registry_target')) {
|
||||
ci_registry = action_information.ci_hostname + '/' + repoStr;
|
||||
let targetRegistries = [];
|
||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||
|
||||
let ci_registry = false;
|
||||
if (core.getBooleanInput('add_ci_registry_target')) {
|
||||
ci_registry = information.ci_hostname + '/' + repoStr;
|
||||
targetRegistries.push(ci_registry);
|
||||
}
|
||||
}
|
||||
|
||||
processAdditionalRegistries();
|
||||
const registryAuthJson = {auths: {}};
|
||||
addCiRegistryAuth(ci_registry, registryAuthJson);
|
||||
mergeArgRegistryAuthJson(registryAuthJson);
|
||||
writeRegistryAuthJson(registryAuthJson, '/home/runner/.docker/config.json');
|
||||
processAdditionalRegistries();
|
||||
const registryAuthJson = {auths: {}};
|
||||
addCiRegistryAuth(ci_registry, registryAuthJson);
|
||||
mergeArgRegistryAuthJson(registryAuthJson);
|
||||
writeRegistryAuthJson(registryAuthJson, '/home/runner/.docker/config.json');
|
||||
|
||||
const tags = collectTags();
|
||||
if (debug) {
|
||||
const tags = collectTags();
|
||||
if (debug) {
|
||||
console.log('tags:', JSON.stringify(tags, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
const destinations = prepareDestinations(targetRegistries, tags);
|
||||
if (debug) {
|
||||
const destinations = prepareDestinations(targetRegistries, tags);
|
||||
if (debug) {
|
||||
console.log('destinations:', JSON.stringify(tags, null, 2));
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log('Failed to build docker image', e);
|
||||
core.setFailed(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@ -10,30 +10,38 @@ import {
|
||||
writeRegistryAuthJson
|
||||
} from './lib';
|
||||
|
||||
const information = action_information.collect_all(true, false);
|
||||
const debug = !!core.getInput('debug');
|
||||
|
||||
let targetRegistries = [];
|
||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||
try {
|
||||
const information = action_information.collect_all(true, false);
|
||||
const debug = !!core.getInput('debug');
|
||||
|
||||
let ci_registry = false;
|
||||
if (core.getBooleanInput('add_ci_registry_target')) {
|
||||
let targetRegistries = [];
|
||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||
|
||||
let ci_registry = false;
|
||||
if (core.getBooleanInput('add_ci_registry_target')) {
|
||||
ci_registry = information.ci_hostname + '/' + repoStr;
|
||||
targetRegistries.push(ci_registry);
|
||||
}
|
||||
}
|
||||
|
||||
processAdditionalRegistries();
|
||||
const registryAuthJson = {auths: {}};
|
||||
addCiRegistryAuth(ci_registry, registryAuthJson);
|
||||
mergeArgRegistryAuthJson(registryAuthJson);
|
||||
writeRegistryAuthJson(registryAuthJson, '/home/runner/.docker/config.json');
|
||||
processAdditionalRegistries();
|
||||
const registryAuthJson = {auths: {}};
|
||||
addCiRegistryAuth(ci_registry, registryAuthJson);
|
||||
mergeArgRegistryAuthJson(registryAuthJson);
|
||||
writeRegistryAuthJson(registryAuthJson, '/home/runner/.docker/config.json');
|
||||
|
||||
const tags = collectTags();
|
||||
if (debug) {
|
||||
const tags = collectTags();
|
||||
if (debug) {
|
||||
console.log('tags:', JSON.stringify(tags, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
const destinations = prepareDestinations(targetRegistries, tags);
|
||||
if (debug) {
|
||||
const destinations = prepareDestinations(targetRegistries, tags);
|
||||
if (debug) {
|
||||
console.log('destinations:', JSON.stringify(tags, null, 2));
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log('Failed to build docker image', e);
|
||||
core.setFailed(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
import * as fs from 'fs';
|
||||
import {Base64} from 'js-base64';
|
||||
import * as path from 'path';
|
||||
|
||||
export function processAdditionalRegistries(targetRegistries) {
|
||||
const additionalRegistries = core.getInput('additional_registries');
|
||||
@ -56,7 +57,7 @@ export function mergeArgRegistryAuthJson(registryAuthJson) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
catch (error) {
|
||||
console.log('Failed to parse registry auth json', e);
|
||||
core.setFailed(error.message);
|
||||
process.exit(1);
|
||||
@ -64,8 +65,9 @@ export function mergeArgRegistryAuthJson(registryAuthJson) {
|
||||
}
|
||||
}
|
||||
|
||||
export function writeRegistryAuthJson(registryAuthJson, path) {
|
||||
fs.writeFileSync(path, JSON.stringify(registryAuthJson, null, 2));
|
||||
export function writeRegistryAuthJson(registryAuthJson, targetFile) {
|
||||
fs.mkdirSync(path.dirname(targetFile), {recursive: true});
|
||||
fs.writeFileSync(targetFile, JSON.stringify(registryAuthJson, null, 2));
|
||||
}
|
||||
|
||||
export function collectTags() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user