From e1103fddef4d1f1fbce9b8a18f2528a4e2be9550 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:39:17 +0100 Subject: [PATCH] buildx(install): rename lab to cloud Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- __tests__/buildx/install.test.ts | 24 ++++++++++++++++-------- src/buildx/install.ts | 5 ++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/__tests__/buildx/install.test.ts b/__tests__/buildx/install.test.ts index ed5b3580..945a381a 100644 --- a/__tests__/buildx/install.test.ts +++ b/__tests__/buildx/install.test.ts @@ -134,22 +134,30 @@ describe('getDownloadVersion', () => { expect(version.releasesURL).toEqual('https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/buildx-releases.json'); }); - it('returns lab latest download version', async () => { - const version = await Install.getDownloadVersion('lab:latest'); - expect(version.key).toEqual('lab'); + it('returns cloud latest download version', async () => { + const version = await Install.getDownloadVersion('cloud:latest'); + expect(version.key).toEqual('cloud'); expect(version.version).toEqual('latest'); expect(version.downloadURL).toEqual('https://github.com/docker/buildx-desktop/releases/download/v%s/%s'); expect(version.releasesURL).toEqual('https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/buildx-lab-releases.json'); }); - it('returns lab v0.11.2-desktop.2 download version', async () => { - const version = await Install.getDownloadVersion('lab:v0.11.2-desktop.2'); - expect(version.key).toEqual('lab'); + it('returns cloud v0.11.2-desktop.2 download version', async () => { + const version = await Install.getDownloadVersion('cloud:v0.11.2-desktop.2'); + expect(version.key).toEqual('cloud'); expect(version.version).toEqual('v0.11.2-desktop.2'); expect(version.downloadURL).toEqual('https://github.com/docker/buildx-desktop/releases/download/v%s/%s'); expect(version.releasesURL).toEqual('https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/buildx-lab-releases.json'); }); + it('returns cloud for lab version', async () => { + const version = await Install.getDownloadVersion('lab:latest'); + expect(version.key).toEqual('cloud'); + expect(version.version).toEqual('latest'); + expect(version.downloadURL).toEqual('https://github.com/docker/buildx-desktop/releases/download/v%s/%s'); + expect(version.releasesURL).toEqual('https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/buildx-lab-releases.json'); + }); + it('unknown repo', async () => { await expect(Install.getDownloadVersion('foo:bar')).rejects.toThrow(new Error('Cannot find buildx version for foo:bar')); }); @@ -172,8 +180,8 @@ describe('getRelease', () => { expect(release?.html_url).toEqual('https://github.com/docker/buildx/releases/tag/v0.10.1'); }); - it('returns v0.11.2-desktop.2 lab GitHub release', async () => { - const version = await Install.getDownloadVersion('lab:v0.11.2-desktop.2'); + it('returns v0.11.2-desktop.2 cloud GitHub release', async () => { + const version = await Install.getDownloadVersion('cloud:v0.11.2-desktop.2'); const release = await Install.getRelease(version); expect(release).not.toBeNull(); expect(release?.id).toEqual(118213369); diff --git a/src/buildx/install.ts b/src/buildx/install.ts index a78d51d1..f072f145 100644 --- a/src/buildx/install.ts +++ b/src/buildx/install.ts @@ -276,6 +276,9 @@ export class Install { version = repoKey; repoKey = 'official'; } + if (repoKey === 'lab') { + repoKey = 'cloud'; + } switch (repoKey) { case 'official': { return { @@ -285,7 +288,7 @@ export class Install { releasesURL: 'https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/buildx-releases.json' }; } - case 'lab': { + case 'cloud': { return { key: repoKey, version: version,