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
3 changes: 2 additions & 1 deletion .github/workflows/smoke-docker-sbx.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .github/workflows/smoke-playwright-docker-sbx.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion scripts/ci/postprocess-smoke-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ const SBX_INSTALL_AND_AUTH_STEPS =
' sbx daemon stop || true\n' +
' sbx policy reset --force || true\n' +
' sbx policy init allow-all\n' +
' nohup sbx daemon start > /tmp/sbx-daemon.log 2>&1 &\n' +
' DOCKER_SANDBOXES_PROXY=http://host.docker.internal:3128 \\\n' +
' nohup sbx daemon start > /tmp/sbx-daemon.log 2>&1 &\n' +
' disown\n' +
' for i in $(seq 1 10); do\n' +
' if sbx daemon status 2>/dev/null | grep -q "running"; then break; fi\n' +
Expand Down Expand Up @@ -209,6 +210,20 @@ for (const sbxLockPath of sbxLockPaths) {
} else {
console.log(` WARNING: Could not find lockdown anchor; sbx install/auth steps not injected`);
}
} else if (
!sbxContent.includes(
'sbx policy init allow-all\n' +
' DOCKER_SANDBOXES_PROXY=http://host.docker.internal:3128 \\\n' +
' nohup sbx daemon start > /tmp/sbx-daemon.log 2>&1 &',
)
) {
const sbxInstallAuthRegex = / {6}- name: Install Docker sbx CLI\n[\s\S]*?(?= {6}- name: Determine automatic lockdown mode)/;
if (sbxInstallAuthRegex.test(sbxContent)) {
sbxContent = sbxContent.replace(sbxInstallAuthRegex, SBX_INSTALL_AND_AUTH_STEPS);
console.log(` Updated sbx CLI install and daemon auth steps with proxy enforcement`);
} else {
console.log(` WARNING: Could not update sbx auth steps`);
}
} else {
console.log(` sbx CLI install and auth steps already present`);
}
Expand Down
21 changes: 21 additions & 0 deletions scripts/ci/smoke-docker-sbx-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const workflowsDir = path.resolve(__dirname, '../../.github/workflows');
const sourcePath = path.join(workflowsDir, 'smoke-docker-sbx.md');
const lockPath = path.join(workflowsDir, 'smoke-docker-sbx.lock.yml');

const playwrightLockPath = path.join(
workflowsDir,
'smoke-playwright-docker-sbx.lock.yml',
);

describe('smoke docker-sbx workflow output targeting', () => {
it('explicitly targets the pull request in the source prompt', () => {
const workflow = fs.readFileSync(sourcePath, 'utf8');
Expand All @@ -20,4 +25,20 @@ describe('smoke docker-sbx workflow output targeting', () => {
'GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || inputs.item_number }}',
);
});

it('starts the final sbx daemon instance with AWF Squid proxy enforcement', () => {
const workflow = fs.readFileSync(lockPath, 'utf8');

expect(workflow).toContain(
'sbx policy init allow-all\n DOCKER_SANDBOXES_PROXY=http://host.docker.internal:3128 \\\n nohup sbx daemon start > /tmp/sbx-daemon.log 2>&1 &',
);
});

it('enforces Squid proxy on final sbx daemon instance in playwright smoke workflow', () => {
const workflow = fs.readFileSync(playwrightLockPath, 'utf8');

expect(workflow).toContain(
'sbx policy init allow-all\n DOCKER_SANDBOXES_PROXY=http://host.docker.internal:3128 \\\n nohup sbx daemon start > /tmp/sbx-daemon.log 2>&1 &',
);
});
Comment thread
Copilot marked this conversation as resolved.
});
Loading