Skip to content

Commit 98e2814

Browse files
chrmartiCopilot
andcommitted
Fix rootless Podman tests on hosted runners
Override the static Podman bundle's single-owner storage option with a minimal rootless user configuration before Feature builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5f49670 commit 98e2814

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎src/test/cli.podman.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import * as assert from 'assert';
77
import * as path from 'path';
8+
import { mkdir, writeFile } from 'fs/promises';
89
import { shellExec } from './testUtils';
910

1011
const pkg = require('../../package.json');
@@ -18,6 +19,22 @@ describe('Dev Containers CLI using Podman', function () {
1819
before('Install', async () => {
1920
await shellExec(`rm -rf ${tmp}/node_modules`);
2021
await shellExec(`mkdir -p ${tmp}`);
22+
if (process.env.GITHUB_ACTIONS === 'true') {
23+
// The hosted runner's static Podman bundle enables single-owner
24+
// storage, which prevents APT's _apt user from writing during builds.
25+
await shellExec('podman system reset --force');
26+
const storageConfig = path.join(process.env.HOME!, '.config', 'containers', 'storage.conf');
27+
await mkdir(path.dirname(storageConfig), { recursive: true });
28+
await writeFile(storageConfig, [
29+
'[storage]',
30+
'driver = "overlay"',
31+
'[storage.options.overlay]',
32+
'ignore_chown_errors = "false"',
33+
'',
34+
].join('\n'));
35+
const { stdout } = await shellExec('podman info --format \'{{json .Store.GraphOptions}}\'');
36+
assert.strictEqual(JSON.parse(stdout)['overlay.ignore_chown_errors'], 'false');
37+
}
2138
await shellExec(`npm --prefix ${tmp} install devcontainers-cli-${pkg.version}.tgz`);
2239
});
2340

0 commit comments

Comments
 (0)