From 4a838aa89c3e22daf07d9485763a9bd8a94c6156 Mon Sep 17 00:00:00 2001 From: andybrown668 Date: Wed, 1 Jul 2026 13:16:35 +0000 Subject: [PATCH] ci: use user-writable Rust paths on self-hosted runners Lab runners expose root-owned /usr/local/{rustup,cargo}, which causes rustup toolchain installs to fail with permission denied. Co-authored-by: Cursor --- .github/actions/rust-paths/action.yml | 29 +++++++++++++++++++++++++++ .github/actions/setup/action.yml | 4 ++++ .github/workflows/ci.yml | 4 ++++ 3 files changed, 37 insertions(+) create mode 100644 .github/actions/rust-paths/action.yml diff --git a/.github/actions/rust-paths/action.yml b/.github/actions/rust-paths/action.yml new file mode 100644 index 0000000000..47a99957f6 --- /dev/null +++ b/.github/actions/rust-paths/action.yml @@ -0,0 +1,29 @@ +# Copyright 2024 RustFS Team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Configure Rust Paths" +description: "Use user-writable Rust paths on self-hosted lab runners" + +runs: + using: "composite" + steps: + - name: Configure user-writable Rust paths + if: runner.environment == 'self-hosted' + shell: bash + run: | + set -euo pipefail + mkdir -p "$HOME/.rustup" "$HOME/.cargo/bin" + echo "RUSTUP_HOME=$HOME/.rustup" >> "$GITHUB_ENV" + echo "CARGO_HOME=$HOME/.cargo" >> "$GITHUB_ENV" + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index c3cad3d90c..d3944b1bc1 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -71,6 +71,10 @@ runs: with: version: "25.12.19" + # Lab runners ship root-owned /usr/local/{rustup,cargo}; rustup cannot update toolchains there. + - name: Configure user-writable Rust paths + uses: ./.github/actions/rust-paths + - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3959982991..5628e59340 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,6 +98,7 @@ jobs: runs-on: [self-hosted, lab-small] steps: - uses: actions/checkout@v6 + - uses: ./.github/actions/rust-paths - uses: dtolnay/rust-toolchain@stable - name: Typos check with custom config file uses: crate-ci/typos@master @@ -196,6 +197,9 @@ jobs: - name: Make binary executable run: chmod +x ./target/debug/rustfs + - name: Configure user-writable Rust paths + uses: ./.github/actions/rust-paths + - name: Setup Rust toolchain for s3s-e2e installation uses: dtolnay/rust-toolchain@stable