From af6020607ba009a2de8543becbf1011fb02459b9 Mon Sep 17 00:00:00 2001 From: RustFS Date: Sun, 29 Nov 2026 11:04:18 +0800 Subject: [PATCH] ci: stop Actions cache thrashing, fix orphan keys, and trim paid runner waste (#9740) * ci: stop Actions cache thrashing, fix orphan keys, and trim paid runner waste Consolidate sm-standard-4 and ubuntu-latest shared Rust caches, fix six orphan cache-shared-key references and rust-cache env-hash mismatches, archive e2e_test once in dual-stack-nightly, move prebuilt fuzz and nixl-check lanes to ubuntu-latest (guarding fuzz metadata probe with RUSTUP_AUTO_INSTALL=0), and deduplicate artifact-only manual packaging runs. Refs: https://github.com/rustfs/backlog/issues/3379 * test(ci): merge step-level env in nightly e2e workflow provenance test Align BinaryProvenanceTests.test_nightly_workflow_builds_and_runs_matching_features with GitHub Actions env precedence (workflow -> job -> step) while keeping RUSTFS_E2E_LOG_DIR pointed at the gitignored fixture target dir, and assert RUSTFS_BUILD_FEATURES stays out of job-level env so Swatinem/rust-cache keys match cache-warm.yml. --- .github/workflows/README.md | 4 +- .github/workflows/build.yml | 9 ++- .github/workflows/ci.yml | 5 +- .github/workflows/dual-stack-nightly.yml | 44 +++++++++--- .github/workflows/e2e-distributed.yml | 5 ++ .github/workflows/e2e-replication-nightly.yml | 22 ++++-- .github/workflows/e2e-upgrade.yml | 8 +-- .github/workflows/fuzz.yml | 8 +-- .github/workflows/gateway-acceptance.yml | 2 +- .github/workflows/manual-main-packages.yml | 6 ++ .github/workflows/minio-interop.yml | 16 +++-- .github/workflows/nightly-gnu.yml | 6 +- .github/workflows/oidc-keycloak.yml | 10 ++- .../workflows/on-demand-migration-interop.yml | 68 +++++++++++-------- .github/workflows/rdma-feature-check.yml | 12 +++- .github/workflows/targets-integration.yml | 2 +- scripts/ci_gate.py | 11 ++- scripts/fuzz/run.sh | 6 +- scripts/security/check_cache_save_if.sh | 32 +++++++-- scripts/test_ci_plan.py | 5 +- scripts/test_e2e_binary.py | 21 ++++-- 21 files changed, 213 insertions(+), 89 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 13af9dcf4c..0f43c9a021 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -44,8 +44,8 @@ A hosted runner is also the only choice for a few things the pods cannot do: `mo `Swatinem/rust-cache` builds its key from the OS, architecture, toolchain and lockfile. It does not include the runner label or image, so a cache written on an `sm-standard-4` pod and one written on `ubuntu-latest` would overwrite each other under the same `shared-key`. - Every `shared-key` has exactly one writer. `cache-warm.yml` owns `ci-dev`, `ci-feat-proto` and `ci-uring`; every other `./.github/actions/setup` call states `cache-save-if` explicitly, and `scripts/security/check_cache_save_if.sh` fails the build when one does not. -- The `ci-dev` key ends in a digest of `warm-ci-dev`'s build commands. Changing what that job warms therefore needs a new key, or readers keep restoring the old artifacts: `scripts/ci_gate.py --check-workflow` prints the key the commands require and fails until the writer and every reader in `ci.yml` and `reference-parity.yml` name it. -- All readers of a key run on the same image as its writer. Keys that live on hosted runners say so in their name (`ci-uring` is warmed on `ubuntu-latest`; `ci-e2e-distributed-hosted`, `e2e-upgrade-server-hosted`, `e2e-upgrade-tests-hosted`). +- The `ci-dev` key ends in a digest of `warm-ci-dev`'s build commands. Changing what that job warms therefore needs a new key, or readers keep restoring the old artifacts: `scripts/ci_gate.py --check-workflow` prints the key the commands require and fails until the writer and every registered `sm-standard-4` reader (`ci.yml`, `dual-stack-nightly.yml`, `e2e-replication-nightly.yml`, `fuzz.yml`, `gateway-acceptance.yml`, `mint.yml` and `reference-parity.yml`) name it. +- All readers of a key run on the same image as its writer. Keys that live on hosted runners say so in their name (`ci-uring` is warmed on `ubuntu-latest`; `ci-e2e-distributed-hosted` is written on `ubuntu-latest` by `e2e-distributed.yml` and read without saving by hosted server/E2E lanes such as `gateway-acceptance.yml`, `on-demand-migration-interop.yml`, `oidc-keycloak.yml`, `minio-interop.yml`, `e2e-upgrade.yml` and `rdma-feature-check.yml`). - Moving a job between pools therefore means renaming its key. The new key is empty until a run from `main` (a scheduled run, or a manual dispatch of that workflow from `main`) saves it; until then that lane does a cold build. The `build.yml` aarch64 release legs append `-ubicloud-arm` for this reason. `cache-warm.yml` does not write those keys. - `CARGO_BUILD_JOBS` and every other `CARGO*`, `CC*`, `CFLAGS*`, `CXX*`, `CMAKE*` and `RUST*` variable is hashed into the key. `ci.yml` sets `CARGO_BUILD_JOBS` at step level for that reason; promoting it to job level rotates the key for every lane that shares it. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88639a5a18..2a0970b863 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,9 +50,14 @@ permissions: contents: read actions: read +# Release candidates (`workflow_call`), scheduled builds, tags, and R2 +# development-channel publications (`inputs.publish == true`) each run in an +# isolated group and never cancel in progress. Artifact-only manual dispatches +# deduplicate per ref and platform list so repeated clicks cancel superseded +# runs instead of piling up paid Ubicloud, macOS xlarge, and sm-standard-4 jobs. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.ref || github.run_id }} - cancel-in-progress: false + group: ${{ github.workflow }}-${{ (github.event_name == 'workflow_dispatch' && inputs.publish != true && !startsWith(github.ref, 'refs/tags/')) && format('dispatch-{0}-{1}', github.ref, inputs.platforms || 'all') || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'workflow_dispatch' && inputs.publish != true && !startsWith(github.ref, 'refs/tags/') }} env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebcd7ff9a7..d098236845 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -558,7 +558,6 @@ jobs: mode: [default, fips] env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" - CARGO_BUILD_JOBS: "2" steps: - name: Checkout repository uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7 @@ -569,7 +568,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-fips-provider + cache-shared-key: ci-dev-ea7eec74fe14 cache-save-if: 'false' install-build-packaging-tools: 'false' @@ -583,6 +582,8 @@ jobs: - name: Verify provider installation shell: bash + env: + CARGO_BUILD_JOBS: "2" run: | args=() if [[ '${{ matrix.mode }}' == 'fips' ]]; then diff --git a/.github/workflows/dual-stack-nightly.yml b/.github/workflows/dual-stack-nightly.yml index 7e618561b5..3b909fd677 100644 --- a/.github/workflows/dual-stack-nightly.yml +++ b/.github/workflows/dual-stack-nightly.yml @@ -41,6 +41,11 @@ concurrency: permissions: contents: read +# Matches ci.yml and cache-warm.yml so build restores the warmed ci-dev cache. +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + defaults: run: shell: bash @@ -64,7 +69,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-dev + cache-shared-key: ci-dev-ea7eec74fe14 cache-save-if: 'false' install-build-packaging-tools: 'false' @@ -81,9 +86,25 @@ jobs: if-no-files-found: error retention-days: 1 + - name: Archive E2E test binaries + env: + CARGO_BUILD_JOBS: "2" + run: python3 scripts/ci_test_artifact.py build --configuration e2e --archive "$RUNNER_TEMP/e2e-tests.tar.zst" + + - name: Upload E2E test binaries + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: dual-stack-e2e-binaries + overwrite: true + path: ${{ runner.temp }}/e2e-tests.tar.zst* + compression-level: 0 + if-no-files-found: error + retention-days: 1 + leg: name: ${{ matrix.profile }} needs: [ build ] + # Retain the producer workspace_root and image for ci_test_artifact.py verify. runs-on: sm-standard-4 timeout-minutes: 120 strategy: @@ -98,13 +119,17 @@ jobs: with: persist-credentials: false - - name: Setup Rust environment - uses: ./.github/actions/setup + - name: Install verification runtime + uses: ./.github/actions/test-runtime + + - name: Download E2E test binaries + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - rust-version: stable - cache-shared-key: ci-dev - cache-save-if: 'false' - install-build-packaging-tools: 'false' + name: dual-stack-e2e-binaries + path: ${{ runner.temp }} + + - name: Verify E2E archive identity + run: python3 scripts/ci_test_artifact.py verify --configuration e2e --archive "$RUNNER_TEMP/e2e-tests.tar.zst" - name: Download the binary uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -192,11 +217,12 @@ jobs: test -f "$RUSTFS_PERSISTENCE_CLOCK_LIBRARY" export RUSTFS_PERSISTENCE_REFERENCE_BINARY="$PERSISTENCE_REFERENCE_BINARY" fi - chmod +x target/debug/rustfs filter='not test(/^(dual_stack_differential|fake_s3_target|distributed_startup_regression_test)::/)' filter="$filter & not test(/^upgrade_compatibility_test::upgrade_write_readiness_tests::/)" filter="$filter & not test(=list_objects_v2_pagination_test::tests::test_list_objects_v2_deadline_rejects_unresponsive_peer)" - python3 scripts/e2e_binary.py run --features e2e-test-hooks -- cargo nextest run --profile "$PROFILE" -p e2e_test -E "$filter" + cargo nextest list --profile "$PROFILE" --archive-file "$RUNNER_TEMP/e2e-tests.tar.zst" --workspace-remap "$GITHUB_WORKSPACE" --extract-to "$GITHUB_WORKSPACE" --extract-overwrite -E "$filter" --message-format json > "$RUNNER_TEMP/dual-stack-${PROFILE}-list.json" + chmod +x target/debug/rustfs + python3 scripts/e2e_binary.py run --features e2e-test-hooks -- cargo nextest run --profile "$PROFILE" --cargo-metadata target/nextest/cargo-metadata.json --binaries-metadata target/nextest/binaries-metadata.json --workspace-remap "$GITHUB_WORKSPACE" --target-dir-remap "$GITHUB_WORKSPACE/target" -E "$filter" - name: Upload the leg if: always() diff --git a/.github/workflows/e2e-distributed.yml b/.github/workflows/e2e-distributed.yml index 47806f998c..f71d897468 100644 --- a/.github/workflows/e2e-distributed.yml +++ b/.github/workflows/e2e-distributed.yml @@ -50,6 +50,11 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.event_name != 'schedule' }} +# Shared compiler environment for hosted server+e2e readers of ci-e2e-distributed-hosted. +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + jobs: distributed: if: github.repository == 'rustfs/rustfs' diff --git a/.github/workflows/e2e-replication-nightly.yml b/.github/workflows/e2e-replication-nightly.yml index 01eac395d2..3a67324fd0 100644 --- a/.github/workflows/e2e-replication-nightly.yml +++ b/.github/workflows/e2e-replication-nightly.yml @@ -51,6 +51,12 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false +# Matches ci.yml and cache-warm.yml so all three jobs restore ci-dev on sm-standard-4 +# without writing separate multi-GB nightly caches into the 10GB repository quota. +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + jobs: repl-nightly: if: github.repository == 'rustfs/rustfs' @@ -62,7 +68,6 @@ jobs: timeout-minutes: 45 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" - RUSTFS_BUILD_FEATURES: "" steps: - name: Checkout repository uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7 @@ -73,8 +78,8 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-e2e-repl - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + cache-shared-key: ci-dev-ea7eec74fe14 + cache-save-if: 'false' install-build-packaging-tools: 'false' # The STS dual-node test requires awscurl and fails if it is unavailable. @@ -93,6 +98,8 @@ jobs: # Build once and carry its source/binary identity into the test invocation. - name: Build rustfs binary + env: + RUSTFS_BUILD_FEATURES: "" run: | python3 scripts/e2e_binary.py build --bins --features "$RUSTFS_BUILD_FEATURES" @@ -105,6 +112,7 @@ jobs: - name: Run replication e2e nightly suite env: + RUSTFS_BUILD_FEATURES: "" RUSTFS_E2E_LOG_DIR: ${{ runner.temp }}/rustfs-e2e-repl-nightly-logs run: python3 scripts/e2e_binary.py run --features "$RUSTFS_BUILD_FEATURES" -- cargo nextest run --profile e2e-repl-nightly -p e2e_test @@ -137,7 +145,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-e2e-nightly + cache-shared-key: ci-dev-ea7eec74fe14 cache-save-if: 'false' install-build-packaging-tools: 'false' @@ -177,7 +185,6 @@ jobs: timeout-minutes: 90 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" - RUSTFS_BUILD_FEATURES: ftps,webdav,sftp steps: - name: Checkout repository uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7 @@ -188,7 +195,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-e2e-protocols + cache-shared-key: ci-dev-ea7eec74fe14 cache-save-if: 'false' install-build-packaging-tools: 'false' @@ -199,6 +206,8 @@ jobs: ss -tn state CLOSE-WAIT >/dev/null - name: Build protocol server + env: + RUSTFS_BUILD_FEATURES: ftps,webdav,sftp run: python3 scripts/e2e_binary.py build --features "$RUSTFS_BUILD_FEATURES" # The suite owns fixed protocol ports and serializes its internal cases. @@ -211,6 +220,7 @@ jobs: - name: Run protocol e2e nightly suite env: + RUSTFS_BUILD_FEATURES: ftps,webdav,sftp RUSTFS_E2E_LOG_DIR: ${{ runner.temp }}/rustfs-protocol-e2e-logs run: | set -o pipefail diff --git a/.github/workflows/e2e-upgrade.yml b/.github/workflows/e2e-upgrade.yml index c4f2152708..94634adf64 100644 --- a/.github/workflows/e2e-upgrade.yml +++ b/.github/workflows/e2e-upgrade.yml @@ -55,8 +55,8 @@ jobs: - name: Setup Rust environment uses: ./.github/actions/setup with: - cache-shared-key: e2e-upgrade-server-hosted - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + cache-shared-key: ci-e2e-distributed-hosted + cache-save-if: "false" install-build-packaging-tools: "false" install-test-tools: "false" @@ -109,8 +109,8 @@ jobs: - name: Setup Rust environment uses: ./.github/actions/setup with: - cache-shared-key: e2e-upgrade-tests-hosted - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + cache-shared-key: ci-e2e-distributed-hosted + cache-save-if: "false" install-build-packaging-tools: "false" install-test-tools: "false" diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 96316e0514..90c3f32187 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -253,8 +253,8 @@ jobs: (github.event_name == 'workflow_dispatch' && (github.event.inputs.profile == 'smoke' || github.event.inputs.profile == 'both')) ) - # Runs prebuilt binary on matching self-hosted runner architecture. - runs-on: sm-standard-4 + # Runs only the downloaded prebuilt binary on matching Ubuntu 24.04 x86_64; needs no Cargo cache or self-hosted disk. + runs-on: ubuntu-latest timeout-minutes: 30 strategy: fail-fast: false @@ -362,8 +362,8 @@ jobs: inputs.mode == '' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && (github.event.inputs.profile == 'nightly' || github.event.inputs.profile == 'both'))) - # Runs prebuilt binary on matching self-hosted runner architecture. - runs-on: sm-standard-4 + # Runs only the downloaded prebuilt binary on matching Ubuntu 24.04 x86_64; needs no Cargo cache or self-hosted disk. + runs-on: ubuntu-latest timeout-minutes: 60 strategy: fail-fast: false diff --git a/.github/workflows/gateway-acceptance.yml b/.github/workflows/gateway-acceptance.yml index d709e3346e..90a97301c2 100644 --- a/.github/workflows/gateway-acceptance.yml +++ b/.github/workflows/gateway-acceptance.yml @@ -93,7 +93,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-dev + cache-shared-key: ci-dev-ea7eec74fe14 cache-save-if: 'false' install-build-packaging-tools: 'false' diff --git a/.github/workflows/manual-main-packages.yml b/.github/workflows/manual-main-packages.yml index 40b8fc5267..b63424d712 100644 --- a/.github/workflows/manual-main-packages.yml +++ b/.github/workflows/manual-main-packages.yml @@ -35,6 +35,12 @@ on: permissions: contents: read +# Artifact-only manual packaging; cancel superseded runs of the identical +# (ref, architecture, version) tuple while keeping distinct targets independent. +concurrency: + group: manual-linux-packages-${{ inputs.ref || 'main' }}-${{ inputs.architecture }}-${{ inputs.version || 'auto' }} + cancel-in-progress: true + env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 diff --git a/.github/workflows/minio-interop.yml b/.github/workflows/minio-interop.yml index e22b42048b..e5cfe75549 100644 --- a/.github/workflows/minio-interop.yml +++ b/.github/workflows/minio-interop.yml @@ -57,6 +57,10 @@ concurrency: permissions: contents: read +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + jobs: minio-interop: name: MinIO interop (EC + SSE read parity) @@ -65,8 +69,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 40 env: - # Fixed 32-byte test KMS key baked into the fixture lab; not a secret. - RUSTFS_MINIO_STATIC_KMS_KEY_B64: IyqsU3kMFloCNup4BsZtf/rmfHVcTgznO2F25CkEH1g= # Single definition of "the interop tests", shared by the guard step and # the run step so the two cannot drift apart. # @@ -91,10 +93,14 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-minio-interop - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + cache-shared-key: ci-e2e-distributed-hosted + cache-save-if: 'false' - name: Generate real MinIO fixtures via Docker + env: + # Fixed 32-byte test KMS key baked into the fixture lab; not a secret. + # Kept at step level so RUSTFS_* does not alter the rust-cache key hash. + RUSTFS_MINIO_STATIC_KMS_KEY_B64: IyqsU3kMFloCNup4BsZtf/rmfHVcTgznO2F25CkEH1g= run: bash crates/rio-v2/tests/minio_fixture_lab/capture_via_docker.sh # `binary(...)` at least dies loudly when nothing matches, but `test(...)` @@ -122,6 +128,8 @@ jobs: fi - name: Run MinIO interop reader tests + env: + RUSTFS_MINIO_STATIC_KMS_KEY_B64: IyqsU3kMFloCNup4BsZtf/rmfHVcTgznO2F25CkEH1g= run: | cargo nextest run --run-ignored ignored-only --no-tests=fail \ -p "$INTEROP_PACKAGE" --features "$INTEROP_FEATURES" \ diff --git a/.github/workflows/nightly-gnu.yml b/.github/workflows/nightly-gnu.yml index 0b60c8b000..963959c592 100644 --- a/.github/workflows/nightly-gnu.yml +++ b/.github/workflows/nightly-gnu.yml @@ -681,10 +681,10 @@ jobs: # Dedicated key: rust-cache cannot tell runner images apart, so # sharing a key with an sm-standard lane would let two different # system images overwrite each other's artifacts (same reasoning as - # ci.yml's ci-uring lane). Saved from this nightly job itself so the - # next night starts warm. + # ci.yml's ci-uring lane). Saved from main runs so the next night + # starts warm without branch dispatches polluting the cache quota. cache-shared-key: kms-vault-lane - cache-save-if: 'true' + cache-save-if: ${{ github.ref == 'refs/heads/main' }} install-build-packaging-tools: 'false' install-test-tools: 'false' diff --git a/.github/workflows/oidc-keycloak.yml b/.github/workflows/oidc-keycloak.yml index 8843128cb6..8f84b77b98 100644 --- a/.github/workflows/oidc-keycloak.yml +++ b/.github/workflows/oidc-keycloak.yml @@ -50,6 +50,10 @@ concurrency: group: oidc-keycloak-live-${{ github.event_name }}-${{ github.ref }} cancel-in-progress: ${{ github.event_name != 'schedule' }} +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + jobs: oidc-keycloak-live: name: OIDC Keycloak live gate @@ -66,8 +70,10 @@ jobs: - name: Setup Rust environment uses: ./.github/actions/setup with: - cache-shared-key: oidc-keycloak-live - cache-save-if: "true" + # Reuse the hosted server cache instead of writing PR-scoped entries + # into the 10GB repository cache quota. + cache-shared-key: ci-e2e-distributed-hosted + cache-save-if: "false" install-build-packaging-tools: "false" install-test-tools: "false" diff --git a/.github/workflows/on-demand-migration-interop.yml b/.github/workflows/on-demand-migration-interop.yml index 765a0bd2b3..1ebcc3dac5 100644 --- a/.github/workflows/on-demand-migration-interop.yml +++ b/.github/workflows/on-demand-migration-interop.yml @@ -80,15 +80,8 @@ jobs: # unattended in any clone that enables it. MINIO_ROOT_USER: rustfsodminterop MINIO_ROOT_PASSWORD: rustfsodminteropsecret - RUSTFS_ODM_INTEROP_PROVIDER: minio - RUSTFS_ODM_INTEROP_ENDPOINT: http://127.0.0.1:9100 - RUSTFS_ODM_INTEROP_REGION: auto - RUSTFS_ODM_INTEROP_BUCKET: odm-interop-source - RUSTFS_ODM_INTEROP_PATH_STYLE: path - RUSTFS_ODM_INTEROP_ACCESS_KEY: rustfsodminterop - RUSTFS_ODM_INTEROP_SECRET_KEY: rustfsodminteropsecret - RUSTFS_ODM_INTEROP_BACKFILL_OBJECTS: "5000" - RUSTFS_ODM_INTEROP_REPORT_DIR: ${{ github.workspace }}/artifacts/odm-interop/minio/cases + MINIO_INTEROP_ENDPOINT: http://127.0.0.1:9100 + MINIO_INTEROP_BUCKET: odm-interop-source NEXTEST_LISTING: ${{ github.workspace }}/artifacts/odm-interop/minio/selection.json steps: - name: Checkout repository @@ -99,8 +92,8 @@ jobs: - name: Setup Rust environment uses: ./.github/actions/setup with: - cache-shared-key: ci-odm-interop - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + cache-shared-key: ci-e2e-distributed-hosted + cache-save-if: 'false' install-build-packaging-tools: 'false' - name: Start MinIO source @@ -131,8 +124,8 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ env.MINIO_ROOT_PASSWORD }} AWS_DEFAULT_REGION: us-east-1 run: | - aws --endpoint-url "${RUSTFS_ODM_INTEROP_ENDPOINT}" \ - s3api create-bucket --bucket "${RUSTFS_ODM_INTEROP_BUCKET}" + aws --endpoint-url "${MINIO_INTEROP_ENDPOINT}" \ + s3api create-bucket --bucket "${MINIO_INTEROP_BUCKET}" - name: Build the RustFS binary under test run: python3 scripts/e2e_binary.py build --bins @@ -147,6 +140,16 @@ jobs: - name: Run the interop cases against MinIO env: + # Scoped to the runtime step so RUSTFS_* does not alter rust-cache's key hash. + RUSTFS_ODM_INTEROP_PROVIDER: minio + RUSTFS_ODM_INTEROP_ENDPOINT: ${{ env.MINIO_INTEROP_ENDPOINT }} + RUSTFS_ODM_INTEROP_REGION: auto + RUSTFS_ODM_INTEROP_BUCKET: ${{ env.MINIO_INTEROP_BUCKET }} + RUSTFS_ODM_INTEROP_PATH_STYLE: path + RUSTFS_ODM_INTEROP_ACCESS_KEY: ${{ env.MINIO_ROOT_USER }} + RUSTFS_ODM_INTEROP_SECRET_KEY: ${{ env.MINIO_ROOT_PASSWORD }} + RUSTFS_ODM_INTEROP_BACKFILL_OBJECTS: "5000" + RUSTFS_ODM_INTEROP_REPORT_DIR: ${{ github.workspace }}/artifacts/odm-interop/minio/cases RUSTFS_E2E_LOG_DIR: ${{ runner.temp }}/rustfs-e2e-logs run: python3 scripts/e2e_binary.py run -- cargo nextest run --profile e2e-odm-interop -p e2e_test --no-tests=fail @@ -155,7 +158,7 @@ jobs: uses: ./.github/actions/odm-interop-report with: provider: minio - cases-dir: ${{ env.RUSTFS_ODM_INTEROP_REPORT_DIR }} + cases-dir: ${{ github.workspace }}/artifacts/odm-interop/minio/cases junit: target/nextest/e2e-odm-interop/junit.xml output: artifacts/odm-interop/minio/report.json @@ -204,14 +207,6 @@ jobs: secret_prefix: GCS_HMAC path_style: virtual env: - RUSTFS_ODM_INTEROP_PROVIDER: ${{ matrix.provider }} - RUSTFS_ODM_INTEROP_PATH_STYLE: ${{ matrix.path_style }} - RUSTFS_ODM_INTEROP_ENDPOINT: ${{ secrets[format('ODM_INTEROP_{0}_ENDPOINT', matrix.secret_prefix)] }} - RUSTFS_ODM_INTEROP_REGION: ${{ secrets[format('ODM_INTEROP_{0}_REGION', matrix.secret_prefix)] }} - RUSTFS_ODM_INTEROP_BUCKET: ${{ secrets[format('ODM_INTEROP_{0}_BUCKET', matrix.secret_prefix)] }} - RUSTFS_ODM_INTEROP_ACCESS_KEY: ${{ secrets[format('ODM_INTEROP_{0}_ACCESS_KEY_ID', matrix.secret_prefix)] }} - RUSTFS_ODM_INTEROP_SECRET_KEY: ${{ secrets[format('ODM_INTEROP_{0}_SECRET_ACCESS_KEY', matrix.secret_prefix)] }} - RUSTFS_ODM_INTEROP_REPORT_DIR: ${{ github.workspace }}/artifacts/odm-interop/${{ matrix.provider }}/cases NEXTEST_LISTING: ${{ github.workspace }}/artifacts/odm-interop/${{ matrix.provider }}/selection.json steps: # Absent secrets are the normal state, not a failure: the lane reports @@ -220,13 +215,19 @@ jobs: # secret's existence. - name: Check for provider credentials id: credentials + env: + ODM_ENDPOINT: ${{ secrets[format('ODM_INTEROP_{0}_ENDPOINT', matrix.secret_prefix)] }} + ODM_REGION: ${{ secrets[format('ODM_INTEROP_{0}_REGION', matrix.secret_prefix)] }} + ODM_BUCKET: ${{ secrets[format('ODM_INTEROP_{0}_BUCKET', matrix.secret_prefix)] }} + ODM_ACCESS_KEY: ${{ secrets[format('ODM_INTEROP_{0}_ACCESS_KEY_ID', matrix.secret_prefix)] }} + ODM_SECRET_KEY: ${{ secrets[format('ODM_INTEROP_{0}_SECRET_ACCESS_KEY', matrix.secret_prefix)] }} run: | set -euo pipefail - if [ -z "${RUSTFS_ODM_INTEROP_ENDPOINT}" ] \ - || [ -z "${RUSTFS_ODM_INTEROP_REGION}" ] \ - || [ -z "${RUSTFS_ODM_INTEROP_BUCKET}" ] \ - || [ -z "${RUSTFS_ODM_INTEROP_ACCESS_KEY}" ] \ - || [ -z "${RUSTFS_ODM_INTEROP_SECRET_KEY}" ]; then + if [ -z "${ODM_ENDPOINT}" ] \ + || [ -z "${ODM_REGION}" ] \ + || [ -z "${ODM_BUCKET}" ] \ + || [ -z "${ODM_ACCESS_KEY}" ] \ + || [ -z "${ODM_SECRET_KEY}" ]; then echo "present=false" >> "$GITHUB_OUTPUT" { echo "### On-demand migration interop: \`${{ matrix.provider }}\`" @@ -250,7 +251,7 @@ jobs: if: steps.credentials.outputs.present == 'true' uses: ./.github/actions/setup with: - cache-shared-key: ci-odm-interop + cache-shared-key: ci-e2e-distributed-hosted cache-save-if: 'false' install-build-packaging-tools: 'false' @@ -276,6 +277,15 @@ jobs: - name: Run the three-case minimum if: steps.credentials.outputs.present == 'true' + env: + RUSTFS_ODM_INTEROP_PROVIDER: ${{ matrix.provider }} + RUSTFS_ODM_INTEROP_PATH_STYLE: ${{ matrix.path_style }} + RUSTFS_ODM_INTEROP_ENDPOINT: ${{ secrets[format('ODM_INTEROP_{0}_ENDPOINT', matrix.secret_prefix)] }} + RUSTFS_ODM_INTEROP_REGION: ${{ secrets[format('ODM_INTEROP_{0}_REGION', matrix.secret_prefix)] }} + RUSTFS_ODM_INTEROP_BUCKET: ${{ secrets[format('ODM_INTEROP_{0}_BUCKET', matrix.secret_prefix)] }} + RUSTFS_ODM_INTEROP_ACCESS_KEY: ${{ secrets[format('ODM_INTEROP_{0}_ACCESS_KEY_ID', matrix.secret_prefix)] }} + RUSTFS_ODM_INTEROP_SECRET_KEY: ${{ secrets[format('ODM_INTEROP_{0}_SECRET_ACCESS_KEY', matrix.secret_prefix)] }} + RUSTFS_ODM_INTEROP_REPORT_DIR: ${{ github.workspace }}/artifacts/odm-interop/${{ matrix.provider }}/cases run: | python3 scripts/e2e_binary.py run -- cargo nextest run --profile e2e-odm-interop -p e2e_test \ -E "${CLOUD_CASE_FILTER}" --no-tests=fail @@ -285,7 +295,7 @@ jobs: uses: ./.github/actions/odm-interop-report with: provider: ${{ matrix.provider }} - cases-dir: ${{ env.RUSTFS_ODM_INTEROP_REPORT_DIR }} + cases-dir: ${{ github.workspace }}/artifacts/odm-interop/${{ matrix.provider }}/cases junit: target/nextest/e2e-odm-interop/junit.xml output: artifacts/odm-interop/${{ matrix.provider }}/report.json diff --git a/.github/workflows/rdma-feature-check.yml b/.github/workflows/rdma-feature-check.yml index 57d916b24f..ef93492f49 100644 --- a/.github/workflows/rdma-feature-check.yml +++ b/.github/workflows/rdma-feature-check.yml @@ -29,10 +29,16 @@ concurrency: group: rdma-feature-check-${{ github.ref }} cancel-in-progress: true +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + jobs: nixl-check: name: cargo check and unit tests (nixl) - runs-on: sm-standard-4 + # Metadata-only check of rustfs plus host-memory unit tests of rustfs-nixl; + # needs no RDMA device and fits inside GitHub-hosted disk with the hosted cache. + runs-on: ubuntu-latest timeout-minutes: 60 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" @@ -46,7 +52,7 @@ jobs: uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-feat-nixl + cache-shared-key: ci-e2e-distributed-hosted cache-save-if: 'false' install-build-packaging-tools: 'false' @@ -79,7 +85,7 @@ jobs: - uses: ./.github/actions/setup with: rust-version: stable - cache-shared-key: ci-feat-cuobject + cache-shared-key: ci-e2e-distributed-hosted cache-save-if: 'false' install-build-packaging-tools: 'false' - name: Check the cuObject crates without the NVIDIA SDK diff --git a/.github/workflows/targets-integration.yml b/.github/workflows/targets-integration.yml index e2fb6740ee..b523d8e013 100644 --- a/.github/workflows/targets-integration.yml +++ b/.github/workflows/targets-integration.yml @@ -61,7 +61,7 @@ jobs: uses: ./.github/actions/setup with: cache-shared-key: targets-live-lane-hosted - cache-save-if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }} + cache-save-if: ${{ github.ref == 'refs/heads/main' }} install-build-packaging-tools: 'false' install-test-tools: 'false' diff --git a/scripts/ci_gate.py b/scripts/ci_gate.py index 6e539b7db2..f36c948fa0 100644 --- a/scripts/ci_gate.py +++ b/scripts/ci_gate.py @@ -641,7 +641,16 @@ def check_lint_lane(jobs: dict) -> list[str]: def ci_dev_workflows(root: Path) -> tuple[dict[str, dict], dict]: """The jobs of every workflow that reads ci-dev, by file name, and cache-warm.yml's jobs.""" - readers = {name: workflow_document((root / ".github/workflows" / name).read_text())["jobs"] for name in ("ci.yml", "reference-parity.yml")} + reader_files = ( + "ci.yml", + "dual-stack-nightly.yml", + "e2e-replication-nightly.yml", + "fuzz.yml", + "gateway-acceptance.yml", + "mint.yml", + "reference-parity.yml", + ) + readers = {name: workflow_document((root / ".github/workflows" / name).read_text())["jobs"] for name in reader_files} return readers, workflow_document((root / ".github/workflows/cache-warm.yml").read_text())["jobs"] diff --git a/scripts/fuzz/run.sh b/scripts/fuzz/run.sh index ae3da6d695..5cdb956384 100755 --- a/scripts/fuzz/run.sh +++ b/scripts/fuzz/run.sh @@ -139,7 +139,11 @@ if [ "$BUILD_ONLY" = "1" ]; then exit 0 fi -toolchain=$(rustc +nightly --version 2>/dev/null || rustc --version 2>/dev/null || printf 'unknown') +if [ "$USE_PREBUILT_BINARY" = "1" ]; then + toolchain=${FUZZ_BUILD_TOOLCHAIN:-$(RUSTUP_AUTO_INSTALL=0 rustc +nightly --version 2>/dev/null || printf 'prebuilt')} +else + toolchain=$(RUSTUP_AUTO_INSTALL=0 rustc +nightly --version 2>/dev/null || RUSTUP_AUTO_INSTALL=0 rustc --version 2>/dev/null || printf 'unknown') +fi # Phase 2: run each target (incremental — no recompilation if already built) for target in $targets; do diff --git a/scripts/security/check_cache_save_if.sh b/scripts/security/check_cache_save_if.sh index 27abc65451..a71660a02f 100755 --- a/scripts/security/check_cache_save_if.sh +++ b/scripts/security/check_cache_save_if.sh @@ -76,13 +76,31 @@ compiler_env() { ' "$1" | sort } -ci_env="$(compiler_env .github/workflows/ci.yml)" warm_env="$(compiler_env .github/workflows/cache-warm.yml)" -if [ "$ci_env" != "$warm_env" ]; then - echo "CI and cache-warm compiler environments differ; rust-cache keys will not match:" >&2 - diff -u <(printf '%s\n' "$ci_env") <(printf '%s\n' "$warm_env") >&2 || true - exit 1 -fi +shared_cache_workflows=( + .github/workflows/ci.yml + .github/workflows/dual-stack-nightly.yml + .github/workflows/e2e-replication-nightly.yml + .github/workflows/fuzz.yml + .github/workflows/gateway-acceptance.yml + .github/workflows/mint.yml + .github/workflows/reference-parity.yml + .github/workflows/e2e-distributed.yml + .github/workflows/e2e-upgrade.yml + .github/workflows/minio-interop.yml + .github/workflows/oidc-keycloak.yml + .github/workflows/on-demand-migration-interop.yml + .github/workflows/rdma-feature-check.yml +) -echo "OK: cache-warm and CI compiler environments match" +for reader in "${shared_cache_workflows[@]}"; do + reader_env="$(compiler_env "$reader")" + if [ "$reader_env" != "$warm_env" ]; then + echo "$reader and cache-warm compiler environments differ; rust-cache keys will not match:" >&2 + diff -u <(printf '%s\n' "$reader_env") <(printf '%s\n' "$warm_env") >&2 || true + exit 1 + fi +done + +echo "OK: cache-warm and shared-cache reader compiler environments match" diff --git a/scripts/test_ci_plan.py b/scripts/test_ci_plan.py index 58b35ac08f..0023e3ec81 100644 --- a/scripts/test_ci_plan.py +++ b/scripts/test_ci_plan.py @@ -643,9 +643,10 @@ class GateTests(unittest.TestCase): 'warm-ci-feat-proto builds after an exact cache hit'), ] warm_key = key(json.loads(original)['cache-warm.yml'], 'warm-ci-dev')['cache-shared-key'] - readers = [(workflow, job) for workflow in ('ci.yml', 'reference-parity.yml') for job, block in json.loads(original)[workflow].items() + reader_workflows = [name for name in json.loads(original) if name != 'cache-warm.yml'] + readers = [(workflow, job) for workflow in reader_workflows for job, block in json.loads(original)[workflow].items() if any(item.get('with', {}).get('cache-shared-key') == warm_key for item in block.get('steps', []))] - self.assertEqual(len(readers), 6) + self.assertEqual(len(readers), 14) for workflow, job in (('cache-warm.yml', 'warm-ci-dev'), ('ci.yml', 'workspace-clippy'), ('reference-parity.yml', 'build-candidate')): mutations.append((lambda d, workflow=workflow, job=job: key(d[workflow], job).update({'cache-shared-key': 'ci-dev-0'}), f'{workflow} {job} uses cache key ci-dev-0; the ci-dev key for these warm commands is {warm_key}')) diff --git a/scripts/test_e2e_binary.py b/scripts/test_e2e_binary.py index 30cc0a68fb..f01f2d143d 100644 --- a/scripts/test_e2e_binary.py +++ b/scripts/test_e2e_binary.py @@ -215,24 +215,33 @@ if os.environ.get("FAKE_BUILD_MUTATE"): import yaml workflow = Path(__file__).resolve().parents[1] / ".github/workflows/e2e-replication-nightly.yml" - jobs = yaml.safe_load(workflow.read_text())["jobs"] + doc = yaml.safe_load(workflow.read_text()) + workflow_env = {k: str(v) for k, v in (doc.get("env") or {}).items()} + jobs = doc["jobs"] for job_name, expected in (("repl-nightly", set()), ("protocols-nightly", {"ftps", "webdav", "sftp"})): job = jobs[job_name] + job_env = {**workflow_env, **{k: str(v) for k, v in (job.get("env") or {}).items()}} steps = {step["name"]: step for step in job["steps"]} build = next(step for name, step in steps.items() if name.startswith("Build ")) run = next(step for name, step in steps.items() if name.startswith("Run ")) with self.subTest(job=job_name): - features = job["env"].get("RUSTFS_BUILD_FEATURES", "") - env = dict(self.env, RUSTFS_BUILD_FEATURES=features, RUSTFS_E2E_LOG_DIR=str(self.root / "target/logs")) - result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", build["run"]], cwd=self.root, env=env, capture_output=True, text=True) + # Keep RUSTFS_BUILD_FEATURES step-scoped so ./.github/actions/setup + # does not hash it into the shared Swatinem/rust-cache key. + self.assertNotIn("RUSTFS_BUILD_FEATURES", job_env) + base_env = {**self.env, **job_env} + log_override = {"RUSTFS_E2E_LOG_DIR": str(self.root / "target/logs")} + build_env = {**base_env, **{k: str(v) for k, v in (build.get("env") or {}).items()}, **log_override} + run_env = {**base_env, **{k: str(v) for k, v in (run.get("env") or {}).items()}, **log_override} + result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", build["run"]], cwd=self.root, env=build_env, capture_output=True, text=True) self.assertEqual(result.returncode, 0, result.stderr) manifest = json.loads(self.sidecar.read_text()) self.assertEqual(set(manifest["requested_features"]), expected) self.assertEqual(set(manifest["features"]), expected | {"default", "ftps", "webdav"}) for status in (0, 23): - result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(env, FAKE_TEST_EXIT=str(status)), capture_output=True, text=True) + result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(run_env, FAKE_TEST_EXIT=str(status)), capture_output=True, text=True) self.assertEqual(result.returncode, status, result.stderr) - result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(env, RUSTFS_BUILD_FEATURES=features + ",unexpected-feature"), capture_output=True, text=True) + features = run_env.get("RUSTFS_BUILD_FEATURES", "") + result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(run_env, RUSTFS_BUILD_FEATURES=features + ",unexpected-feature"), capture_output=True, text=True) self.assertNotEqual(result.returncode, 0) self.assertIn("build features/profile differ", result.stdout + result.stderr)