Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db6372e84f | ||
|
|
ed273243e8 | ||
|
|
749fc87fb2 | ||
|
|
9f6ff3da7f | ||
|
|
c2a62c4476 | ||
|
|
8dfe7ecbd9 | ||
|
|
d19019dc11 | ||
|
|
1362d80447 | ||
|
|
05607289aa | ||
|
|
91444bd3bd | ||
|
|
cc17e76a52 | ||
|
|
8672cc70f4 | ||
|
|
31cb9c3bde | ||
|
|
781874f7fa | ||
|
|
54e0f74a84 | ||
|
|
15a9f92044 | ||
|
|
0b611e6c46 | ||
|
|
4980de30fc |
6
.github/docker-releases.json
vendored
6
.github/docker-releases.json
vendored
@@ -5,6 +5,12 @@
|
||||
"html_url": "https://github.com/moby/moby/releases/tag/v27.3.1",
|
||||
"assets": []
|
||||
},
|
||||
"v27.4.0-rc.1": {
|
||||
"id": 185528936,
|
||||
"tag_name": "v27.4.0-rc.1",
|
||||
"html_url": "https://github.com/moby/moby/releases/tag/v27.4.0-rc.1",
|
||||
"assets": []
|
||||
},
|
||||
"v23.0.15": {
|
||||
"id": 178729348,
|
||||
"tag_name": "v23.0.15",
|
||||
|
||||
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@@ -43,10 +43,10 @@ jobs:
|
||||
shell: bash
|
||||
-
|
||||
name: Upload coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
if: env.RUN_CODECOV == 'true'
|
||||
with:
|
||||
file: ./coverage/clover.xml
|
||||
files: ./coverage/clover.xml
|
||||
flags: unit
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -98,7 +98,6 @@ jobs:
|
||||
- ubuntu-latest
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- macos-12
|
||||
- windows-latest
|
||||
steps:
|
||||
-
|
||||
@@ -163,9 +162,9 @@ jobs:
|
||||
shell: bash
|
||||
-
|
||||
name: Upload coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
if: env.RUN_CODECOV == 'true'
|
||||
with:
|
||||
file: ./coverage/clover.xml
|
||||
files: ./coverage/clover.xml
|
||||
flags: itg
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -23,7 +23,7 @@ import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docke
|
||||
import {Docker} from '../../src/docker/docker';
|
||||
import {Exec} from '../../src/exec';
|
||||
|
||||
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-itg-'));
|
||||
const tmpDir = () => fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-itg-'));
|
||||
|
||||
describe('install', () => {
|
||||
const originalEnv = process.env;
|
||||
@@ -51,7 +51,7 @@ aarch64:https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-g
|
||||
await ensureNoSystemContainerd();
|
||||
const install = new Install({
|
||||
source: source,
|
||||
runDir: tmpDir,
|
||||
runDir: tmpDir(),
|
||||
contextName: 'foo',
|
||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`
|
||||
});
|
||||
@@ -74,7 +74,7 @@ describe('rootless', () => {
|
||||
await ensureNoSystemContainerd();
|
||||
const install = new Install({
|
||||
source: source,
|
||||
runDir: tmpDir,
|
||||
runDir: tmpDir(),
|
||||
contextName: 'foo',
|
||||
daemonConfig: `{"debug":true}`,
|
||||
rootless: true
|
||||
|
||||
@@ -279,3 +279,10 @@ describe('tag', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getCommitDate', () => {
|
||||
it('head', async () => {
|
||||
const date = await Git.commitDate('HEAD');
|
||||
await expect(date).toBeInstanceOf(Date);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -170,7 +170,11 @@ export class Install {
|
||||
if (this.rootless) {
|
||||
core.info(`Downloading Docker rootless extras ${version} from ${this.source.channel} at download.docker.com`);
|
||||
const extrasFolder = await this.downloadStaticArchive('docker-rootless-extras', this.source);
|
||||
fs.copyFileSync(path.join(extrasFolder, 'dockerd-rootless.sh'), path.join(extractFolder, 'dockerd-rootless.sh'));
|
||||
fs.readdirSync(extrasFolder).forEach(file => {
|
||||
const src = path.join(extrasFolder, file);
|
||||
const dest = path.join(extractFolder, file);
|
||||
fs.copyFileSync(src, dest);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -275,9 +279,14 @@ export class Install {
|
||||
core.info(limaCfg);
|
||||
});
|
||||
|
||||
const qemuArch = await Install.qemuArch();
|
||||
if (!(await Install.qemuInstalled())) {
|
||||
await core.group('Installing QEMU', async () => {
|
||||
await Exec.exec('brew', ['install', 'qemu'], {env: envs});
|
||||
});
|
||||
}
|
||||
const qemuBin = await Install.qemuBin();
|
||||
await core.group('QEMU version', async () => {
|
||||
await Exec.exec(`qemu-system-${qemuArch} --version`);
|
||||
await Exec.exec(qemuBin, ['--version']);
|
||||
});
|
||||
|
||||
// lima might already be started on the runner so env var added in download
|
||||
@@ -492,6 +501,13 @@ EOF`,
|
||||
throw new Error(`Unsupported platform: ${os.platform()}`);
|
||||
}
|
||||
}
|
||||
|
||||
await core.group(`Cleaning up toolDir`, async () => {
|
||||
if (!this._toolDir) {
|
||||
return;
|
||||
}
|
||||
fs.rmSync(this._toolDir, {recursive: true, force: true});
|
||||
});
|
||||
}
|
||||
|
||||
private async tearDownDarwin(): Promise<void> {
|
||||
@@ -541,6 +557,9 @@ EOF`,
|
||||
await core.group('Removing Docker context', async () => {
|
||||
await Docker.exec(['context', 'rm', '-f', this.contextName]);
|
||||
});
|
||||
await core.group('Stopping Docker daemon service', async () => {
|
||||
await Exec.exec('powershell', ['-Command', `Stop-Service -Name docker -Force`]);
|
||||
});
|
||||
}
|
||||
|
||||
private downloadURL(component: 'docker' | 'docker-rootless-extras', version: string, channel: string): string {
|
||||
@@ -603,29 +622,42 @@ EOF`,
|
||||
return await io
|
||||
.which('lima', true)
|
||||
.then(res => {
|
||||
core.debug(`docker.Install.limaAvailable ok: ${res}`);
|
||||
core.debug(`docker.Install.limaInstalled ok: ${res}`);
|
||||
return true;
|
||||
})
|
||||
.catch(error => {
|
||||
core.debug(`docker.Install.limaAvailable error: ${error}`);
|
||||
core.debug(`docker.Install.limaInstalled error: ${error}`);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private static async qemuArch(): Promise<string> {
|
||||
private static async qemuBin(): Promise<string> {
|
||||
switch (os.arch()) {
|
||||
case 'x64': {
|
||||
return 'x86_64';
|
||||
return `qemu-system-x86_64`;
|
||||
}
|
||||
case 'arm64': {
|
||||
return 'aarch64';
|
||||
return `qemu-system-aarch64`;
|
||||
}
|
||||
default: {
|
||||
return os.arch();
|
||||
return `qemu-system-${os.arch()}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async qemuInstalled(): Promise<boolean> {
|
||||
return await io
|
||||
.which(await Install.qemuBin(), true)
|
||||
.then(res => {
|
||||
core.debug(`docker.Install.qemuInstalled ok: ${res}`);
|
||||
return true;
|
||||
})
|
||||
.catch(error => {
|
||||
core.debug(`docker.Install.qemuInstalled error: ${error}`);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
public static async getRelease(version: string): Promise<GitHubRelease> {
|
||||
const url = `https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/docker-releases.json`;
|
||||
const http: httpm.HttpClient = new httpm.HttpClient('docker-actions-toolkit');
|
||||
|
||||
@@ -163,4 +163,8 @@ export class Git {
|
||||
return res.stdout.trim();
|
||||
});
|
||||
}
|
||||
|
||||
public static async commitDate(ref: string): Promise<Date> {
|
||||
return new Date(await Git.exec(['show', '-s', '--format="%ci"', ref]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3403,13 +3403,13 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3":
|
||||
version: 7.0.3
|
||||
resolution: "cross-spawn@npm:7.0.3"
|
||||
version: 7.0.6
|
||||
resolution: "cross-spawn@npm:7.0.6"
|
||||
dependencies:
|
||||
path-key: ^3.1.0
|
||||
shebang-command: ^2.0.0
|
||||
which: ^2.0.1
|
||||
checksum: 671cc7c7288c3a8406f3c69a3ae2fc85555c04169e9d611def9a675635472614f1c0ed0ef80955d5b6d4e724f6ced67f0ad1bb006c2ea643488fcfef994d7f52
|
||||
checksum: 8d306efacaf6f3f60e0224c287664093fa9185680b2d195852ba9a863f85d02dcc737094c6e512175f8ee0161f9b87c73c6826034c2422e39de7d6569cf4503b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user