Compare commits

..

18 Commits

Author SHA1 Message Date
CrazyMax
db6372e84f Merge pull request #491 from docker/dependabot/github_actions/codecov/codecov-action-5
Some checks failed
publish / publish (push) Has been cancelled
build(deps): bump codecov/codecov-action from 4 to 5
2024-11-18 16:42:10 +01:00
CrazyMax
ed273243e8 Merge pull request #495 from docker/dependabot/npm_and_yarn/cross-spawn-7.0.6
build(deps): bump cross-spawn from 7.0.3 to 7.0.6
2024-11-18 16:38:48 +01:00
CrazyMax
749fc87fb2 ci: fix deprecated input for codecov-action
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-18 16:17:16 +01:00
dependabot[bot]
9f6ff3da7f build(deps): bump cross-spawn from 7.0.3 to 7.0.6
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 15:16:48 +00:00
CrazyMax
c2a62c4476 Merge pull request #494 from crazy-max/ci-drop-macos-12
ci: remove deprecated macos-12 runner
2024-11-18 16:14:54 +01:00
CrazyMax
8dfe7ecbd9 ci: remove deprecated macos-12 runner
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-18 15:51:00 +01:00
CrazyMax
d19019dc11 Merge pull request #493 from crazy-max/qemu-check-installed
docker(install): check qemu is installed
2024-11-18 15:45:47 +01:00
CrazyMax
1362d80447 docker(install): check qemu is installed
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-18 15:19:43 +01:00
CrazyMax
05607289aa Merge pull request #492 from docker/bot/docker-releases-json
Update `.github/docker-releases.json`
2024-11-18 14:02:28 +01:00
crazy-max
91444bd3bd github: update .github/docker-releases.json
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-15 00:29:29 +00:00
dependabot[bot]
cc17e76a52 build(deps): bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-14 22:27:55 +00:00
CrazyMax
8672cc70f4 Merge pull request #489 from trim21/get-commit-data
Some checks failed
publish / publish (push) Has been cancelled
feat: add method to get commit date from git
2024-11-13 13:39:55 +01:00
Trim21
31cb9c3bde feat: add method to get commit date from git
Signed-off-by: Trim21 <trim21.me@gmail.com>
2024-11-13 20:11:46 +08:00
CrazyMax
781874f7fa Merge pull request #486 from vvoland/docker-install-rootless2
docker/install: Fix rootless install, make teardown also cleanup the toolDir
2024-11-13 12:04:15 +01:00
Paweł Gronowski
54e0f74a84 docker/install: Stop docker service on Windows
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 18:07:31 +01:00
Paweł Gronowski
15a9f92044 docker/install: Copy all rootless-extras files
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 17:58:08 +01:00
Paweł Gronowski
0b611e6c46 docker/install: Clean up toolDir in teardown
The `toolDir` is added to `PATH` on install, so make sure the binaries
aren't accessible after a teardown.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 17:58:05 +01:00
Paweł Gronowski
4980de30fc test/install: Use separate runDir for each test
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-08 17:58:03 +01:00
7 changed files with 68 additions and 20 deletions

View File

@@ -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",

View File

@@ -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 }}

View File

@@ -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

View File

@@ -279,3 +279,10 @@ describe('tag', () => {
});
});
});
describe('getCommitDate', () => {
it('head', async () => {
const date = await Git.commitDate('HEAD');
await expect(date).toBeInstanceOf(Date);
});
});

View File

@@ -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');

View File

@@ -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]));
}
}

View File

@@ -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