Skip to content

Commit

Permalink
Use pull tag push strategy to fix released docker images (#623)
Browse files Browse the repository at this point in the history
* revert latest tag to make docker-compose workable again

* pull/retag/push instead
  • Loading branch information
Janpot authored Jul 4, 2022
1 parent 634d4c2 commit 3da69ba
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions scripts/releaseDocker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
}
}

Expand Down Expand Up @@ -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];

Expand Down

0 comments on commit 3da69ba

Please sign in to comment.