From 3da69ba399b53ed995634a3f5cba3a5b1f4d0d31 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Mon, 4 Jul 2022 12:11:13 +0200 Subject: [PATCH] Use pull tag push strategy to fix released docker images (#623) * revert latest tag to make docker-compose workable again * pull/retag/push instead --- scripts/releaseDocker.mjs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/scripts/releaseDocker.mjs b/scripts/releaseDocker.mjs index ea025ea21e9..5876405c42f 100644 --- a/scripts/releaseDocker.mjs +++ b/scripts/releaseDocker.mjs @@ -22,19 +22,18 @@ async function checkTagExists(image, tag) { } async function dockerCreateTag(image, srcTag, destTags) { - const { exitCode, stderr } = await execa( - 'docker', - [ - 'buildx', - 'imagetools', - 'create', - `${image}:${srcTag}`, - ...destTags.flatMap((tag) => ['--tag', `${image}:${tag}`]), - ], - { stdio: 'inherit' }, - ); - if (exitCode !== 0) { - throw new Error(stderr); + const srImage = `${image}:${srcTag}`; + try { + await execa('docker', ['pull', srImage], { stdio: 'inherit' }); + await Promise.all( + destTags.map(async (destTag) => { + const destImage = `${image}:${destTag}`; + await execa('docker', ['tag', srImage, destImage], { stdio: 'inherit' }); + await execa('docker', ['push', destImage], { stdio: 'inherit' }); + }), + ); + } finally { + await execa('docker', ['rmi', srImage], { stdio: 'inherit' }); } } @@ -118,7 +117,7 @@ async function main({ yes, force, commit, releaseTag, 'no-latest': noLatest }) { } const parsedVersion = semver.parse(releaseTag); - const isPrerelease = parsedVersion.prerelease.length > 0; + const isPrerelease = parsedVersion ? parsedVersion.prerelease.length > 0 : true; const tags = [releaseTag];