Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/services/sysroot-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ describe('buildSysrootStageService', () => {
expect(service.command[0]).toContain('.awf-sysroot-ready');
});

it('escapes $d as $$d for Docker Compose variable interpolation', () => {
const service = buildSysrootStageService({
config: makeConfig({ runnerTopology: 'arc-dind' }),
registry: 'ghcr.io/github/gh-aw-firewall',
imageTag: 'latest',
});
// Docker Compose treats $var as variable interpolation; $$ escapes to literal $
expect(service.command[0]).toContain('/$$d');
expect(service.command[0]).not.toMatch(/\/\$d[^$]/);
});

it('uses network_mode none (no network needed for copy)', () => {
const service = buildSysrootStageService({
config: makeConfig({ runnerTopology: 'arc-dind' }),
Expand Down
4 changes: 3 additions & 1 deletion src/services/sysroot-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export function buildSysrootStageService(params: SysrootServiceParams): any {
'fi; ' +
'echo "Copying sysroot filesystem..."; ' +
'for d in usr lib bin sbin etc; do ' +
' [ -d "/$d" ] && cp -a "/$d" /sysroot/; ' +
// Use $$ to escape Docker Compose variable interpolation — Compose
// treats bare $d as a variable reference and replaces it with "".
' [ -d "/$$d" ] && cp -a "/$$d" /sysroot/; ' +
'done; ' +
'if [ -d /lib64 ]; then cp -a /lib64 /sysroot/; fi; ' +
'touch /sysroot/.awf-sysroot-ready; ' +
Expand Down
Loading