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