Skip to content

Commit 779136b

Browse files
authored
Merge pull request #813 from crazy-max/docker-install-fix-version
docker(install): fix source archive version
2 parents 907e9d8 + 0c5ce44 commit 779136b

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
}
117117
includes.push({ os: os, test: test, test_name: 'root', docker_install_type: 'archive', docker_install_version: 'v26.1.4' });
118118
includes.push({ os: os, test: test, test_name: 'root', docker_install_type: 'archive', docker_install_version: 'latest' });
119+
includes.push({ os: os, test: test, test_name: 'root', docker_install_type: 'archive', docker_install_version: 'v29.0.0-rc.1', docker_install_channel: 'test' });
119120
if (os === 'ubuntu-latest') {
120121
includes.push({ os: os, test: test, test_name: 'rootless', docker_install_type: 'image', docker_install_version: 'latest' });
121122
includes.push({ os: os, test: test, test_name: 'rootless', docker_install_type: 'archive', docker_install_version: 'latest' });
@@ -208,6 +209,7 @@ jobs:
208209
TEST_FOR_SUMMARY: ${{ secrets.TEST_FOR_SUMMARY }}
209210
DOCKER_INSTALL_TYPE: ${{ matrix.docker_install_type }}
210211
DOCKER_INSTALL_VERSION: ${{ matrix.docker_install_version }}
212+
DOCKER_INSTALL_CHANNEL: ${{ matrix.docker_install_channel }}
211213
-
212214
name: Check coverage
213215
run: |

__tests__/docker/install.test.itg.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ async function ensureNoSystemContainerd() {
153153
function getSources(root: boolean): Array<InstallSource> {
154154
const dockerInstallType = process.env.DOCKER_INSTALL_TYPE;
155155
const dockerInstallVersion = process.env.DOCKER_INSTALL_VERSION;
156+
const dockerInstallChannel = process.env.DOCKER_INSTALL_CHANNEL || 'stable';
156157
if (dockerInstallType && dockerInstallVersion) {
157158
if (dockerInstallType === 'archive') {
158159
// prettier-ignore
159160
return [
160-
{ type: dockerInstallType, version: dockerInstallVersion, channel: 'stable'} as InstallSourceArchive
161+
{ type: dockerInstallType, version: dockerInstallVersion, channel: dockerInstallChannel} as InstallSourceArchive
161162
];
162163
} else {
163164
// prettier-ignore
@@ -173,7 +174,8 @@ function getSources(root: boolean): Array<InstallSource> {
173174
{type: 'image', tag: 'master'} as InstallSourceImage,
174175
{type: 'image', tag: 'latest'} as InstallSourceImage,
175176
{type: 'archive', version: 'v26.1.4', channel: 'stable'} as InstallSourceArchive,
176-
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive
177+
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive,
178+
{type: 'archive', version: 'v29.0.0-rc.1', channel: 'test'} as InstallSourceArchive
177179
];
178180
} else {
179181
// prettier-ignore

__tests__/docker/install.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ describe('download', () => {
5353
[archive('v20.10.22', 'stable'), 'linux'],
5454
[archive('v20.10.22', 'stable'), 'darwin'],
5555
[archive('v20.10.22', 'stable'), 'win32'],
56+
[archive('v29.0.0-rc.1', 'test'), 'linux'],
5657

5758
[image('master'), 'linux'],
5859
[image('master'), 'win32'],
@@ -81,14 +82,22 @@ describe('getRelease', () => {
8182
expect(release?.tag_name).not.toEqual('');
8283
});
8384

84-
it('returns v23.0.0 buildx GitHub release', async () => {
85+
it('returns v23.0.0 docker GitHub release', async () => {
8586
const release = await Install.getRelease('v23.0.0');
8687
expect(release).not.toBeNull();
8788
expect(release?.id).toEqual(91109643);
8889
expect(release?.tag_name).toEqual('v23.0.0');
8990
expect(release?.html_url).toEqual('https://github.com/moby/moby/releases/tag/v23.0.0');
9091
});
9192

93+
it('returns v29.0.0-rc.1 docker GitHub release', async () => {
94+
const release = await Install.getRelease('v29.0.0-rc.1');
95+
expect(release).not.toBeNull();
96+
expect(release?.id).toEqual(252020476);
97+
expect(release?.tag_name).toEqual('docker-v29.0.0-rc.1');
98+
expect(release?.html_url).toEqual('https://github.com/moby/moby/releases/tag/docker-v29.0.0-rc.1');
99+
});
100+
92101
it('unknown release', async () => {
93102
await expect(Install.getRelease('foo')).rejects.toThrow(new Error('Cannot find Docker release foo in https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/docker-releases.json'));
94103
});

src/docker/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class Install {
204204

205205
private async downloadSourceArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive): Promise<string> {
206206
const release: GitHubRelease = await Install.getRelease(src.version);
207-
this._version = release.tag_name.replace(/^v+|v+$/g, '');
207+
this._version = release.tag_name.replace(/^(docker-)?v+/, '');
208208
core.debug(`docker.Install.downloadSourceArchive version: ${this._version}`);
209209

210210
const downloadURL = this.downloadURL(component, this._version, src.channel);

0 commit comments

Comments
 (0)