Skip to content

Commit 9317bae

Browse files
aatchisonclaude
andauthored
ci(release): rebuild Pulumi venv on prod runner; exclude it from artifact (#979)
The Pulumi venv built in merge.yml lives at pulumi/venv and was being shipped wholesale inside pulumi.tbz. Its bin/python is an absolute symlink into /opt/hostedtoolcache/Python/<patch>/x64/bin/python, which only resolves on the runner that built it. When release.yml extracts the artifact on a different runner whose Python tool cache was refreshed to a different 3.13.x patch, the symlink dangles and Pulumi fails with: fork/exec /home/runner/work/.../pulumi/venv/bin/python: no such file or directory This bit r-0437's prod publish (run 27723066505); prior releases worked only when the stage and prod runners happened to have the same cached patch version. - merge.yml: exclude pulumi/venv from the tarball. Shrinks pulumi.tbz from ~55 MB to ~10 KB and stops shipping a non-portable venv. - release.yml: rebuild the venv from requirements.txt on the prod runner after extraction. The rm -rf venv keeps already-published drafts (whose artifact still contains the stage-runner venv) working without re-cutting the release. Recovery for r-0437 after this merges: convert the release back to draft and re-publish to re-fire release.yml against the fixed workflow. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent db2a06b commit 9317bae

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/merge.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,12 @@ jobs:
197197
if: env.BUILD_ACCOUNTS == 'true'
198198
shell: bash
199199
run: |
200-
tar -cvjf pulumi.tbz pulumi/
200+
# Exclude the venv: it was built on THIS runner with bin/python as an
201+
# absolute symlink into /opt/hostedtoolcache/Python/<patch>/..., so it
202+
# isn't portable to the prod runner (different cached patch version =>
203+
# dangling symlink => pulumi fails on venv/bin/python). release.yml
204+
# rebuilds the venv from requirements.txt on the prod runner.
205+
tar --exclude='pulumi/venv' -cvjf pulumi.tbz pulumi/
201206
202207
- name: Archive the Pulumi artifact
203208
id: iac-archive

.github/workflows/release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,30 @@ jobs:
7474
shell: bash
7575
run: |
7676
tar -xvf pulumi.tbz
77-
77+
7878
- name: Set up Python ${{ vars.PYTHON_VERSION}}
7979
uses: actions/setup-python@v5
8080
with:
8181
python-version: ${{ vars.PYTHON_VERSION}}
8282

83+
# Build the Pulumi venv on THIS runner. Older pulumi.tbz artifacts shipped
84+
# a venv built on the stage runner, whose bin/python was an absolute
85+
# symlink into /opt/hostedtoolcache/Python/<patch>/... — that path doesn't
86+
# exist on the prod runner whenever the cached patch version differs, and
87+
# pulumi blows up trying to call venv/bin/python. We now exclude the venv
88+
# from the artifact (see merge.yml) and rebuild here. The `rm -rf venv`
89+
# handles already-published drafts whose artifact still contains the
90+
# stage-runner venv.
91+
- name: Rebuild Pulumi venv on prod runner
92+
shell: bash
93+
run: |
94+
cd pulumi
95+
rm -rf venv
96+
python -m pip install virtualenv
97+
virtualenv ./venv
98+
source ./venv/bin/activate
99+
pip install -Ur requirements.txt
100+
83101
- name: Install Pulumi
84102
shell: bash
85103
run: |

0 commit comments

Comments
 (0)