debug
This commit is contained in:
parent
c4e48e687b
commit
67f86d06da
70
dist/index.js
vendored
70
dist/index.js
vendored
@ -61803,13 +61803,13 @@ var external_fs_ = __nccwpck_require__(7147);
|
|||||||
|
|
||||||
|
|
||||||
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) {
|
||||||
const additionalRegistriesArr = additionalRegistries.split(",");
|
const additionalRegistriesArr = additionalRegistries.split(',');
|
||||||
for (let registry of additionalRegistriesArr) {
|
for (let registry of additionalRegistriesArr) {
|
||||||
registry = registry.trim();
|
registry = registry.trim();
|
||||||
if (!registry.endsWith(":")) {
|
if (!registry.endsWith(':')) {
|
||||||
registry += ":";
|
registry += ':';
|
||||||
}
|
}
|
||||||
targetRegistries.push(registry);
|
targetRegistries.push(registry);
|
||||||
}
|
}
|
||||||
@ -61822,34 +61822,30 @@ function base64ToBytes(base64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addCiRegistryAuth(ci_registry, registryAuthJson) {
|
function addCiRegistryAuth(ci_registry, registryAuthJson) {
|
||||||
if (!core.getBooleanInput("add_ci_registry_auth")) {
|
if (!core.getBooleanInput('add_ci_registry_auth')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci_registry === false || ci_registry.length <= 0) {
|
if (ci_registry === false || ci_registry.length <= 0) {
|
||||||
console.log(
|
console.log(
|
||||||
"WARNING: add_ci_registry_auth enabled but ci_registry is not set",
|
'WARNING: add_ci_registry_auth enabled but ci_registry is not set'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const argCiRegistryPassword = (
|
const argCiRegistryPassword = (core.getInput('ci_registry_password') ?? '').trim();
|
||||||
core.getInput("ci_registry_password") ?? ""
|
|
||||||
).trim();
|
|
||||||
if (argCiRegistryPassword == null || argCiRegistryPassword.length <= 0) {
|
if (argCiRegistryPassword == null || argCiRegistryPassword.length <= 0) {
|
||||||
console.log(
|
console.log('WARNING: add_ci_registry_auth enabled but ci_registry_password env is empty');
|
||||||
"WARNING: add_ci_registry_auth enabled but ci_registry_password env is empty",
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
registryAuthJson.auths[ci_registry] = base64ToBytes(
|
registryAuthJson.auths[ci_registry] = base64ToBytes(
|
||||||
"token:" + argCiRegistryPassword,
|
'token:' + argCiRegistryPassword
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeArgRegistryAuthJson(registryAuthJson) {
|
function mergeArgRegistryAuthJson(registryAuthJson) {
|
||||||
const argRegistryAuthJson = process.env["REGISTRY_AUTH_JSON"];
|
const argRegistryAuthJson = process.env['REGISTRY_AUTH_JSON'];
|
||||||
if (argRegistryAuthJson != null && argRegistryAuthJson.trim().length > 0) {
|
if (argRegistryAuthJson != null && argRegistryAuthJson.trim().length > 0) {
|
||||||
try {
|
try {
|
||||||
const argRegistryAuth = JSON.parse(argRegistryAuthJson);
|
const argRegistryAuth = JSON.parse(argRegistryAuthJson);
|
||||||
@ -61860,8 +61856,9 @@ function mergeArgRegistryAuthJson(registryAuthJson) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}
|
||||||
console.log("Failed to parse registry auth json", e);
|
catch (e) {
|
||||||
|
console.log('Failed to parse registry auth json', e);
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -61873,29 +61870,29 @@ function writeRegistryAuthJson(registryAuthJson, path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function collectTags() {
|
function collectTags() {
|
||||||
const tags = [];
|
const tags = [];
|
||||||
let foundSemverTag = false;
|
let foundSemverTag = false;
|
||||||
let tagPrefix = (core.getInput("tag_prefix") ?? "").trim();
|
let tagPrefix = (core.getInput('tag_prefix') ?? '').trim();
|
||||||
let tagSuffix = (core.getInput("tag_suffix") ?? "").trim();
|
let tagSuffix = (core.getInput('tag_suffix') ?? '').trim();
|
||||||
let tagCommitPrefix = (core.getInput("tag_suffix") ?? "").trim();
|
let tagCommitPrefix = (core.getInput('tag_suffix') ?? '').trim();
|
||||||
|
|
||||||
// handle semver
|
// handle semver
|
||||||
if (
|
if (
|
||||||
core.getBooleanInput("tag_semver_major") &&
|
core.getBooleanInput('tag_semver_major') &&
|
||||||
information.semver_major != null
|
information.semver_major != null
|
||||||
) {
|
) {
|
||||||
tags.push(tagPrefix + information.semver_major);
|
tags.push(tagPrefix + information.semver_major);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
core.getBooleanInput("tag_semver_minor") &&
|
core.getBooleanInput('tag_semver_minor') &&
|
||||||
information.semver_minor != null
|
information.semver_minor != null
|
||||||
) {
|
) {
|
||||||
tags.push(tagPrefix + information.semver_minor);
|
tags.push(tagPrefix + information.semver_minor);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
core.getBooleanInput("tag_semver_patch") &&
|
core.getBooleanInput('tag_semver_patch') &&
|
||||||
information.semver_patch != null
|
information.semver_patch != null
|
||||||
) {
|
) {
|
||||||
tags.push(tagPrefix + information.semver_patch);
|
tags.push(tagPrefix + information.semver_patch);
|
||||||
@ -61904,7 +61901,7 @@ function collectTags() {
|
|||||||
|
|
||||||
// handle git tag/branch
|
// handle git tag/branch
|
||||||
if (
|
if (
|
||||||
core.getBooleanInput("tag_ref_normalized_enable") &&
|
core.getBooleanInput('tag_ref_normalized_enable') &&
|
||||||
foundSemverTag === false
|
foundSemverTag === false
|
||||||
) {
|
) {
|
||||||
if (information.git_tag != null) {
|
if (information.git_tag != null) {
|
||||||
@ -61918,7 +61915,7 @@ function collectTags() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle commit sha
|
// handle commit sha
|
||||||
if (core.getBooleanInput("tag_commit_enable")) {
|
if (core.getBooleanInput('tag_commit_enable')) {
|
||||||
tags.push(tagPrefix + tagCommitPrefix + github.context.sha + tagSuffix);
|
tags.push(tagPrefix + tagCommitPrefix + github.context.sha + tagSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61943,32 +61940,31 @@ function prepareDestinations(registries, tags) {
|
|||||||
|
|
||||||
|
|
||||||
const action_information = collect_all(true, false);
|
const action_information = collect_all(true, false);
|
||||||
const debug = !!core.getInput("debug");
|
const debug = !!core.getInput('debug');
|
||||||
|
|
||||||
let targetRegistries = [];
|
let targetRegistries = [];
|
||||||
const repoStr = github.context.repo.owner + "/" + github.context.repo.repo;
|
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||||
|
|
||||||
if (core.getBooleanInput("add_ci_registry_target")) {
|
let ci_registry = false;
|
||||||
const ci_registry = action_information.ci_hostname + "/" + repoStr;
|
if (core.getBooleanInput('add_ci_registry_target')) {
|
||||||
|
ci_registry = action_information.ci_hostname + '/' + repoStr;
|
||||||
targetRegistries.push(ci_registry);
|
targetRegistries.push(ci_registry);
|
||||||
} else {
|
|
||||||
const ci_registry = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processAdditionalRegistries();
|
processAdditionalRegistries();
|
||||||
const registryAuthJson = { auths: {} };
|
const registryAuthJson = {auths: {}};
|
||||||
addCiRegistryAuth(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));
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@ -16,17 +16,15 @@ const debug = !!core.getInput('debug');
|
|||||||
let targetRegistries = [];
|
let targetRegistries = [];
|
||||||
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
const repoStr = github.context.repo.owner + '/' + github.context.repo.repo;
|
||||||
|
|
||||||
|
let ci_registry = false;
|
||||||
if (core.getBooleanInput('add_ci_registry_target')) {
|
if (core.getBooleanInput('add_ci_registry_target')) {
|
||||||
const ci_registry = information.ci_hostname + '/' + repoStr;
|
ci_registry = information.ci_hostname + '/' + repoStr;
|
||||||
targetRegistries.push(ci_registry);
|
targetRegistries.push(ci_registry);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
const ci_registry = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
processAdditionalRegistries();
|
processAdditionalRegistries();
|
||||||
const registryAuthJson = {auths: {}};
|
const registryAuthJson = {auths: {}};
|
||||||
addCiRegistryAuth(registryAuthJson);
|
addCiRegistryAuth(ci_registry, registryAuthJson);
|
||||||
mergeArgRegistryAuthJson(registryAuthJson);
|
mergeArgRegistryAuthJson(registryAuthJson);
|
||||||
writeRegistryAuthJson(registryAuthJson, '/home/runner/.docker/config.json');
|
writeRegistryAuthJson(registryAuthJson, '/home/runner/.docker/config.json');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user