add more logging

This commit is contained in:
James Brumond 2023-08-18 20:37:14 -07:00
parent 93dd6aca70
commit cd3d61058b
Signed by: james
GPG Key ID: E8F2FC44BAA3357A
3 changed files with 9 additions and 3 deletions

5
dist/index.js vendored
View File

@ -2870,9 +2870,10 @@ async function main() {
new_tags: core.getInput('new-tags').trim().split('\n'),
};
console.log('Tagging %s:%s with new tags', input.image, input.old_tag, input);
console.log('Tagging %s/%s:%s with new tags', input.registry, input.image, input.old_tag, input.new_tags);
const manifest = await get_manifest(`${input.registry}/v2/${input.image}/manifests/${input.old_tag}`);
const promises = input.new_tags.map((new_tag) => {
return put_manifest(`${input.registry}/v2/${input.image}/manifests/${new_tag}`, manifest);
});
@ -2892,6 +2893,7 @@ async function get_manifest(url_str) {
});
if (status !== 200) {
console.error('get manifest response', { status, body });
throw new Error('failed to fetch existing manifest');
}
@ -2904,6 +2906,7 @@ async function put_manifest(url_str, manifest) {
}, manifest);
if (status >= 400) {
console.error('get manifest response', { status, body });
throw new Error('failed to put manifest');
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -17,9 +17,10 @@ async function main() {
new_tags: core.getInput('new-tags').trim().split('\n'),
};
console.log('Tagging %s:%s with new tags', input.image, input.old_tag, input);
console.log('Tagging %s/%s:%s with new tags', input.registry, input.image, input.old_tag, input.new_tags);
const manifest = await get_manifest(`${input.registry}/v2/${input.image}/manifests/${input.old_tag}`);
const promises = input.new_tags.map((new_tag) => {
return put_manifest(`${input.registry}/v2/${input.image}/manifests/${new_tag}`, manifest);
});
@ -39,6 +40,7 @@ async function get_manifest(url_str) {
});
if (status !== 200) {
console.error('get manifest response', { status, body });
throw new Error('failed to fetch existing manifest');
}
@ -51,6 +53,7 @@ async function put_manifest(url_str, manifest) {
}, manifest);
if (status >= 400) {
console.error('get manifest response', { status, body });
throw new Error('failed to put manifest');
}
}