Skip to content

Commit

Permalink
chore(IDX): extract repository_cache
Browse files Browse the repository at this point in the history
This specifies a default `--repository_cache` so that it doesn't have to
be set for each job
  • Loading branch information
nmattia committed Feb 11, 2025
1 parent f906ca2 commit fbd74c4
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows-source/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
# check if PR title contains release and set timeout filters accordingly
BAZEL_EXTRA_ARGS: ${{ env.BAZEL_EXTRA_ARGS }}
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows-source/release-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_nightly"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand All @@ -96,7 +96,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_staging"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand All @@ -115,7 +115,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_hotfix"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/dre:guest_os_qualification"
BAZEL_CI_CONFIG: "--config=systest --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=systest"
BAZEL_EXTRA_ARGS: "--keep_going --test_timeout=7200 --test_env=OLD_VERSION=${{ matrix.version }}"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows-source/schedule-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
bazel clean
env:
BAZEL_STARTUP_ARGS: "--output_base=/var/tmp/bazel-output/"
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
ZH2_DLL01_CSV_SECRETS: "${{ secrets.ZH2_DLL01_CSV_SECRETS }}"
ZH2_FILE_SHARE_KEY: "${{ secrets.ZH2_FILE_SHARE_KEY }}"

Expand All @@ -114,7 +114,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/ledger_suite/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=fi_tests_nightly --test_env=SSH_AUTH_SOCK --test_timeout=43200"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
SSH_PRIVATE_KEY_BACKUP_POD: ${{ secrets.SSH_PRIVATE_KEY_BACKUP_POD }}
Expand All @@ -134,7 +134,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/nns/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=nns_tests_nightly --test_env=SSH_AUTH_SOCK --test_env=NNS_CANISTER_UPGRADE_SEQUENCE=all"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
SSH_PRIVATE_KEY_BACKUP_POD: ${{ secrets.SSH_PRIVATE_KEY_BACKUP_POD }}
Expand All @@ -159,7 +159,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: ${{ env.BENCHMARK_TARGETS }}
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
# note: there's just one performance cluster, so the job can't be parallelized
BAZEL_EXTRA_ARGS: "--test_tag_filters=system_test_benchmark --//bazel:enable_upload_perf_systest_results=True --keep_going --jobs 1"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows-source/schedule-hourly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_hourly"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
# check if PR title contains release and set timeout filters accordingly
BAZEL_EXTRA_ARGS: ${{ env.BAZEL_EXTRA_ARGS }}
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
with:
BAZEL_COMMAND: "build"
BAZEL_TARGETS: "//rs/..."
BAZEL_EXTRA_ARGS: "--keep_going --config=fuzzing --build_tag_filters=libfuzzer"
BAZEL_EXTRA_ARGS: "--keep_going --config=fuzzing --build_tag_filters=libfuzzer --repository_cache="
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Upload bazel-bep
# runs only if previous step succeeded or failed;
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
with:
BAZEL_COMMAND: "build"
BAZEL_TARGETS: "//rs/..."
BAZEL_EXTRA_ARGS: "--keep_going --config=afl"
BAZEL_EXTRA_ARGS: "--keep_going --config=afl --repository_cache="
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Upload bazel-bep
# runs only if previous step succeeded or failed;
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_nightly"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_staging"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_hotfix"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/tests/dre:guest_os_qualification"
BAZEL_CI_CONFIG: "--config=systest --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=systest"
BAZEL_EXTRA_ARGS: "--keep_going --test_timeout=7200 --test_env=OLD_VERSION=${{ matrix.version }}"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/schedule-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
bazel clean
env:
BAZEL_STARTUP_ARGS: "--output_base=/var/tmp/bazel-output/"
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
ZH2_DLL01_CSV_SECRETS: "${{ secrets.ZH2_DLL01_CSV_SECRETS }}"
ZH2_FILE_SHARE_KEY: "${{ secrets.ZH2_FILE_SHARE_KEY }}"
fi-tests-nightly:
Expand All @@ -90,7 +90,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/ledger_suite/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=fi_tests_nightly --test_env=SSH_AUTH_SOCK --test_timeout=43200"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
SSH_PRIVATE_KEY_BACKUP_POD: ${{ secrets.SSH_PRIVATE_KEY_BACKUP_POD }}
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/nns/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=nns_tests_nightly --test_env=SSH_AUTH_SOCK --test_env=NNS_CANISTER_UPGRADE_SEQUENCE=all"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
SSH_PRIVATE_KEY_BACKUP_POD: ${{ secrets.SSH_PRIVATE_KEY_BACKUP_POD }}
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: ${{ env.BENCHMARK_TARGETS }}
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
# note: there's just one performance cluster, so the job can't be parallelized
BAZEL_EXTRA_ARGS: "--test_tag_filters=system_test_benchmark --//bazel:enable_upload_perf_systest_results=True --keep_going --jobs 1"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule-hourly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//rs/..."
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_EXTRA_ARGS: "--keep_going --test_tag_filters=system_test_hourly"
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule-rust-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: |
./ci/scripts/rust-benchmarks.sh
env:
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_COMMAND: "run"
BAZEL_STARTUP_ARGS: "--output_base=/var/tmp/bazel-output/"
CI_JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
Expand Down
35 changes: 22 additions & 13 deletions ci/bazel-scripts/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,30 @@ stream_awk_program='
# Finally, record the URL
END { if (stream_url != null) print stream_url > url_out }'

bazel_args=(
${BAZEL_STARTUP_ARGS}
${BAZEL_COMMAND}
--color=yes
${BAZEL_CI_CONFIG}
--build_metadata=BUILDBUDDY_LINKS="[CI Job](${CI_JOB_URL})"
--ic_version="${CI_COMMIT_SHA}"
--ic_version_rc_only="${ic_version_rc_only}"
--release_build="${release_build}"
--s3_upload="${s3_upload:-"False"}"
${BAZEL_EXTRA_ARGS:-}
${BAZEL_TARGETS}
)

# Unless explicitly provided, we set a default --repository_cache to a volume mounted
# inside our runners
if [[ ! " ${bazel_args[*]} " =~ [[:space:]]--repository_cache[[:space:]] ]]; then
echo "setting default repository cache"
bazel_args+=(--repository_cache=/cache/bazel)
fi

# shellcheck disable=SC2086
# ${BAZEL_...} variables are expected to contain several arguments. We have `set -f` set above to disable globbing (and therefore only allow splitting)"
bazel \
${BAZEL_STARTUP_ARGS} \
${BAZEL_COMMAND} \
--color=yes \
${BAZEL_CI_CONFIG} \
--build_metadata=BUILDBUDDY_LINKS="[CI Job](${CI_JOB_URL})" \
--ic_version="${CI_COMMIT_SHA}" \
--ic_version_rc_only="${ic_version_rc_only}" \
--release_build="${release_build}" \
--s3_upload="${s3_upload:-"False"}" \
${BAZEL_EXTRA_ARGS:-} \
${BAZEL_TARGETS} \
2>&1 | awk -v url_out="$url_out" "$stream_awk_program"
bazel "${bazel_args[@]}" 2>&1 | awk -v url_out="$url_out" "$stream_awk_program"

# Write the bes link & summary
echo "Build results uploaded to $(<"$url_out")"
Expand Down

0 comments on commit fbd74c4

Please sign in to comment.