Fix Intel CI env corruption and remove Python 3.14 pinning#1291
Fix Intel CI env corruption and remove Python 3.14 pinning#1291sbryngelson merged 1 commit intoMFlowCode:masterfrom
Conversation
- Replace `printenv >> $GITHUB_ENV` with a before/after diff that exports only vars added/changed by Intel setvars.sh. The old approach dumped all env vars including shell internals with special characters, causing "Invalid format" errors in GitHub Actions. - Remove explicit Python 3.14 setup from test.yml and lint-toolchain.yml (runners already have a suitable Python). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude Code ReviewHead SHA: e53ec1a Summary
Findings
The before/after diff pattern is a well-known workaround for this class of GITHUB_ENV corruption: printenv | sort > /tmp/env_before
source /opt/intel/oneapi/setvars.sh
printenv | sort > /tmp/env_after
diff /tmp/env_before /tmp/env_after | grep '^>' | sed 's/^> //' >> $GITHUB_ENVIt correctly handles:
One minor edge case to be aware of: if any env var value contains a literal newline,
Removing the pinned Improvement Opportunities (optional, non-blocking)
|
Review Summary by QodoFix Intel CI env corruption and remove Python 3.14 pinning
WalkthroughsDescription• Fix Intel CI environment corruption by exporting only new/changed vars - Replace printenv >> $GITHUB_ENV with before/after diff approach - Prevents shell internals with special characters from corrupting GITHUB_ENV • Remove explicit Python 3.14 setup from CI workflows - Runners already have suitable Python versions available Diagramflowchart LR
A["Intel setvars.sh<br/>environment setup"] -->|"before/after<br/>diff approach"| B["Export only<br/>new/changed vars"]
B -->|"prevents corruption"| C["Clean GITHUB_ENV<br/>parsing"]
D["Remove explicit<br/>Python 3.14 setup"] -->|"simplify CI"| E["Use runner<br/>default Python"]
File Changes1. .github/workflows/lint-toolchain.yml
|
Code Review by Qodo
1. Env diff pipeline can fail
|
Claude Code ReviewHead SHA: e53ec1a
Summary
Findings🔴 Bug:
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request modifies two GitHub Actions workflow files. The lint-toolchain workflow removes a Python setup step that configured version 3.14. The test workflow updates how environment variables are exported to GitHub by introducing a selective export mechanism that captures environment state before and after sourcing the Intel setvars script, extracts only the changed variables using diff and sed, and appends them to the GitHub environment. The same Python 3.14 setup step is also removed from this workflow. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Updates CI workflows to avoid corrupting GitHub Actions environment exports when sourcing Intel oneAPI setvars.sh, and removes explicit Python 3.14 setup steps in favor of the runner’s default Python.
Changes:
- Replaces
printenv >> $GITHUB_ENVwith a before/after environment comparison intended to export only new/changed variables aftersetvars.sh. - Removes
actions/setup-python@v5pinning to Python 3.14 from the Intel job intest.ymland fromlint-toolchain.yml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/test.yml | Changes how Intel oneAPI environment variables are persisted into GITHUB_ENV; removes Python 3.14 setup in that job. |
| .github/workflows/lint-toolchain.yml | Removes the explicit Python 3.14 setup step. |
| with: | ||
| python-version: '3.14' | ||
| printenv | sort > /tmp/env_after | ||
| diff /tmp/env_before /tmp/env_after | grep '^>' | sed 's/^> //' >> $GITHUB_ENV |
There was a problem hiding this comment.
diff exits with status 1 when the files differ, and with GitHub Actions’ default bash -e -o pipefail this will fail the step even when differences are expected. Additionally, grep '^>' will exit 1 (and fail the step) if there are no added/changed vars. Consider using an approach that returns success in these cases (e.g., comm -13 on the sorted env snapshots, or otherwise ensure the pipeline ignores diff/grep non-zero statuses) while still appending only the desired KEY=VALUE lines to $GITHUB_ENV.
| diff /tmp/env_before /tmp/env_after | grep '^>' | sed 's/^> //' >> $GITHUB_ENV | |
| comm -13 /tmp/env_before /tmp/env_after >> "$GITHUB_ENV" |
| printenv | sort > /tmp/env_before | ||
| source /opt/intel/oneapi/setvars.sh | ||
| printenv >> $GITHUB_ENV | ||
|
|
||
| - name: Set up Python 3.14 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.14' | ||
| printenv | sort > /tmp/env_after | ||
| diff /tmp/env_before /tmp/env_after | grep '^>' | sed 's/^> //' >> $GITHUB_ENV |
There was a problem hiding this comment.
1. Env diff pipeline can fail 🐞 Bug ⛯ Reliability
The Intel setup now uses a diff | grep | sed >> $GITHUB_ENV pipeline where diff commonly exits 1 when it finds changes (expected) and grep exits 1 when there are no matches. In environments where pipeline failures propagate (as this workflow appears to rely on for fallbacks), this can fail the Intel setup step and block CI.
Agent Prompt
### Issue description
The Intel oneAPI env export uses a `diff | grep | sed` pipeline that can return non-zero exit codes in normal/success cases (e.g., `diff` returns 1 when it finds differences). In CI environments where pipeline failures propagate, this can fail the step and break Intel CI.
### Issue Context
This is in the `Setup Ubuntu (Intel)` step that writes environment changes to `$GITHUB_ENV` for subsequent steps.
### Fix Focus Areas
- .github/workflows/test.yml[126-133]
- .github/workflows/test.yml[129-132]
### Suggested change
Wrap the pipeline with `|| true` (and optionally filter to `KEY=VALUE` lines) so expected non-zero statuses don’t fail the job.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
printenv >> $GITHUB_ENVwith a before/after diff that exports only vars added/changed by Intelsetvars.sh. The old approach dumped all env vars including shell internals with special characters, causing"Invalid format 'sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB'"errors in GitHub Actions.test.ymlandlint-toolchain.yml(runners already have a suitable Python).Test plan
🤖 Generated with Claude Code