Skip to content

Commit bb3dfbb

Browse files
committed
CI: Revert to simpler sudo -E approach
The explicit PATH passing wasn't working due to sudo's environment restrictions. Reverting to the simpler approach that was working before commit 5c391a1.
1 parent ebad2c4 commit bb3dfbb

1 file changed

Lines changed: 8 additions & 34 deletions

File tree

.github/workflows/tests.yml

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,7 @@ jobs:
8080
8181
- name: Setup Rust environment and install nextest
8282
run: |
83-
# Source the cargo environment - try ci user first, fallback to current user
84-
if [ -f /home/ci/.cargo/env ]; then
85-
source /home/ci/.cargo/env
86-
else
87-
source ~/.cargo/env
88-
fi
83+
source ~/.cargo/env
8984
9085
# Install nextest if not already present
9186
if ! command -v cargo-nextest &> /dev/null; then
@@ -94,54 +89,33 @@ jobs:
9489
9590
- name: Build
9691
run: |
97-
if [ -f /home/ci/.cargo/env ]; then
98-
source /home/ci/.cargo/env
99-
else
100-
source ~/.cargo/env
101-
fi
92+
source ~/.cargo/env
10293
# Use incremental compilation for faster builds
10394
export CARGO_INCREMENTAL=1
10495
cargo build --verbose
10596
10697
- name: Run unit tests
10798
run: |
108-
if [ -f /home/ci/.cargo/env ]; then
109-
source /home/ci/.cargo/env
110-
else
111-
source ~/.cargo/env
112-
fi
99+
source ~/.cargo/env
113100
cargo nextest run --profile ci --bins --verbose
114101
115102
- name: Run smoke tests
116103
run: |
117-
if [ -f /home/ci/.cargo/env ]; then
118-
source /home/ci/.cargo/env
119-
else
120-
source ~/.cargo/env
121-
fi
104+
source ~/.cargo/env
122105
cargo nextest run --profile ci --test smoke_test --verbose
123106
124107
- name: Run Linux jail integration tests
125108
run: |
126-
if [ -f /home/ci/.cargo/env ]; then
127-
source /home/ci/.cargo/env
128-
else
129-
source ~/.cargo/env
130-
fi
109+
source ~/.cargo/env
131110
# Run all tests without CI workarounds since this is a self-hosted runner
132-
# Use sudo with env to preserve the full environment
133-
sudo env "PATH=$PATH" "CARGO_HOME=$CARGO_HOME" "RUSTUP_HOME=$RUSTUP_HOME" $(which cargo) nextest run --profile ci --test linux_integration --verbose
111+
sudo -E $(which cargo) nextest run --profile ci --test linux_integration --verbose
134112
135113
- name: Run isolated cleanup tests
136114
run: |
137-
if [ -f /home/ci/.cargo/env ]; then
138-
source /home/ci/.cargo/env
139-
else
140-
source ~/.cargo/env
141-
fi
115+
source ~/.cargo/env
142116
# Run only the comprehensive cleanup and sigint tests with the feature flag
143117
# These tests need to run in isolation from other tests
144-
sudo env "PATH=$PATH" "CARGO_HOME=$CARGO_HOME" "RUSTUP_HOME=$RUSTUP_HOME" $(which cargo) test --test linux_integration --features isolated-cleanup-tests -- test_comprehensive_resource_cleanup test_cleanup_after_sigint
118+
sudo -E $(which cargo) test --test linux_integration --features isolated-cleanup-tests -- test_comprehensive_resource_cleanup test_cleanup_after_sigint
145119
146120
test-weak:
147121
name: Weak Mode Integration Tests (Linux)

0 commit comments

Comments
 (0)