Skip to content

ci: cache pip downloads for WSL ansible-base install - #397

Open
lowlydba wants to merge 4 commits into
mainfrom
lowlydba-ci-pip-caching-wsl-install
Open

ci: cache pip downloads for WSL ansible-base install#397
lowlydba wants to merge 4 commits into
mainfrom
lowlydba-ci-pip-caching-wsl-install

Conversation

@lowlydba

@lowlydba lowlydba commented Sep 5, 2026

Copy link
Copy Markdown
Owner

The Install ansible-base step runs inside a WSL guest and pip-installs setuptools, pypsrp, and an ansible tarball from a GitHub archive URL, with no caching between runs. pip's default cache dir (~/.cache/pip) lives inside the WSL rootfs, which actions/cache can't reach from the Windows host.

Sets PIP_CACHE_DIR to .pip-cache, relative to github.workspace. wsl.exe maps that Windows path into WSL via drvfs, so it's the same files on disk that actions/cache (running on the Windows host) can key and restore directly, no separate WSL virtual disk involved. wsl-bash launches wsl.exe directly rather than a login shell, so WSLENV: PIP_CACHE_DIR/u is also needed to actually forward the variable into the guest. Cache key includes github.run_id per matrix.ansible/matrix.group so every run saves a fresh cache instead of getting stuck on the first successful save, with restore-keys falling back to the latest matching prefix.

setuptools/pypsrp should get full cache hits. The ansible tarball still rebuilds each time since it's not a normal versioned PyPI package, but the download itself gets reused from cache.

Also swaps the inline ConfigureRemotingForAnsible.ps1 download-and-run step for lowlysre/config-ansible-remote-action@v1.0.0, a composite action wrapping the same script at the same pinned commit, pinned here by full commit SHA.

Testing

This is a Windows/WSL runner quirk (drvfs path translation, actions/cache running on the host side vs. pip inside the WSL guest) that's hard to verify outside CI. CI on this PR is the actual validation.

Adds a job-level PIP_CACHE_DIR (.pip-cache, relative to github.workspace) and an actions/cache step keyed on matrix.ansible so pip's cache directory lands on NTFS where actions/cache (running on the Windows host) can reach it. The wsl-bash steps share the same github.workspace cwd via drvfs, so the cache is the literal same files on disk.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 5, 2026 14:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The cache variable is not propagated into WSL, and the fixed key prevents future cache updates.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds host-accessible pip caching for Windows/WSL CI.

Changes:

  • Configures a workspace-relative pip cache.
  • Restores pip downloads and wheels with actions/cache.
File summaries
File Description
.github/workflows/ansible-test-windows.yml Adds pip cache configuration to Windows integration tests.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ansible-test-windows.yml
Comment thread .github/workflows/ansible-test-windows.yml Outdated
lowlydba and others added 3 commits September 5, 2026 10:08
wsl-bash launches wsl.exe directly, which only imports Windows env vars listed in WSLENV; without it pip inside WSL kept using ~/.cache/pip. Also switch the cache key to include github.run_id per matrix leg so pip-installed wheels/archives actually get saved on a miss, falling back to the latest matching key via restore-keys instead of one permanently-fixed key that never updates.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replaces the inline ConfigureRemotingForAnsible.ps1 download-and-run step with the reusable composite action, pinned to v1.0.0 (89ef423) by full commit SHA. Same upstream script SHA (b8cf495) is used as this action's default, so behavior is unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ng-wsl-install

# Conflicts:
#	.github/workflows/ansible-test-windows.yml
@lowlydba
lowlydba enabled auto-merge (squash) September 5, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants