Skip to content

Commit

Permalink
buildx(install): rename lab to cloud
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Dec 12, 2024
1 parent 1d49775 commit e1103fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
24 changes: 16 additions & 8 deletions __tests__/buildx/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
Expand All @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/buildx/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ export class Install {
version = repoKey;
repoKey = 'official';
}
if (repoKey === 'lab') {
repoKey = 'cloud';
}
switch (repoKey) {
case 'official': {
return {
Expand All @@ -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,
Expand Down

0 comments on commit e1103fd

Please sign in to comment.