mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-03 20:20:29 +00:00
fix(ci): make shared checks portable across runners (#8124)
* fix(ci): isolate monitor argument checks from runner tools * fix(ci): install the Typos action download dependency * fix(ci): make release policy matching portable across awk variants
This commit is contained in:
@@ -24,6 +24,7 @@ TEST_THREADS ?= 1
|
||||
.PHONY: script-tests
|
||||
script-tests: ## Run shell script tests
|
||||
@echo "Running script tests..."
|
||||
trap 'status=$$?; printf "ERROR: script-tests failed (exit %s): %s\n" "$$status" "$$BASH_COMMAND" >&2; exit "$$status"' ERR
|
||||
./scripts/test_build_rustfs_options.sh
|
||||
./scripts/test_docker_runtime_timezone.sh
|
||||
./scripts/test_entrypoint_credentials.sh
|
||||
|
||||
@@ -104,6 +104,10 @@ jobs:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install typos download dependency
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends wget
|
||||
- name: Typos check with custom config file
|
||||
uses: crate-ci/typos@512fc24f32f44ab01972217aaaf3dc86ec234d53 # v1.50.2
|
||||
|
||||
|
||||
@@ -129,15 +129,15 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
require_cmd gh
|
||||
require_cmd jq
|
||||
require_cmd date
|
||||
|
||||
if ! [[ "${RUNS}" =~ ^[0-9]+$ ]] || (( RUNS == 0 )); then
|
||||
if ! [[ "${RUNS}" =~ ^[0-9]+$ && "${RUNS}" =~ [1-9] ]]; then
|
||||
echo "ERROR: --runs must be a positive integer" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
require_cmd gh
|
||||
require_cmd jq
|
||||
require_cmd date
|
||||
|
||||
run_failed=0
|
||||
active_found=0
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ require_line "$release_script" " gh api --method POST \"repos/\${GITHUB_REPOSIT
|
||||
require_line "$release_script" " local create_args=(release create \"\$tag\" --title \"\$title\" --notes-file \"\$notes_file\" --latest=false --draft)" "draft release creation with a notes file"
|
||||
|
||||
release_channel_block=$(awk '
|
||||
$0 == " if [[ \"\$BUILD_TYPE\" == \"release\" ]]; then" { in_block = 1 }
|
||||
$0 == " if [[ \"$BUILD_TYPE\" == \"release\" ]]; then" { in_block = 1 }
|
||||
in_block { print }
|
||||
in_block && $0 == " fi" { exit }
|
||||
' "$build_workflow")
|
||||
|
||||
@@ -182,25 +182,42 @@ if ! rg -q "ERROR: --admin-token cannot be combined with --access-key/--secret-k
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bash scripts/monitor_manual_transition_ci.sh --help >/tmp/monitor_manual_transition_ci.help
|
||||
rg -q "Usage:" /tmp/monitor_manual_transition_ci.help
|
||||
if bash scripts/monitor_manual_transition_ci.sh --issues >/tmp/monitor_manual_transition_ci.err 2>&1; then
|
||||
bash scripts/monitor_manual_transition_ci.sh --help >"$TMP_DIR/monitor.help"
|
||||
rg -q "Usage:" "$TMP_DIR/monitor.help"
|
||||
mkdir -p "$TMP_DIR/no-monitor-tools"
|
||||
if PATH="$TMP_DIR/no-monitor-tools" "$BASH" scripts/monitor_manual_transition_ci.sh --issues >"$TMP_DIR/monitor.err" 2>&1; then
|
||||
echo "monitor script should fail when --issues has no value" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! rg -q "ERROR: missing value for --issues" /tmp/monitor_manual_transition_ci.err; then
|
||||
if ! rg -qx "ERROR: missing value for --issues" "$TMP_DIR/monitor.err"; then
|
||||
echo "monitor script missing missing-value guard for --issues" >&2
|
||||
cat "$TMP_DIR/monitor.err" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if bash scripts/monitor_manual_transition_ci.sh --runs 0 >/tmp/monitor_manual_transition_ci.err 2>&1; then
|
||||
echo "monitor script should fail on invalid --runs" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! rg -q "ERROR: --runs must be a positive integer" /tmp/monitor_manual_transition_ci.err; then
|
||||
echo "monitor script missing invalid --runs guard output" >&2
|
||||
exit 1
|
||||
fi
|
||||
for runs in 0 00 -1 abc; do
|
||||
if PATH="$TMP_DIR/no-monitor-tools" "$BASH" scripts/monitor_manual_transition_ci.sh --runs "$runs" >"$TMP_DIR/monitor.err" 2>&1; then
|
||||
echo "monitor script should fail on invalid --runs: $runs" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$(cat "$TMP_DIR/monitor.err")" != "ERROR: --runs must be a positive integer" ]]; then
|
||||
echo "monitor script missing invalid --runs guard output for: $runs" >&2
|
||||
cat "$TMP_DIR/monitor.err" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for runs in 1 8 100; do
|
||||
if PATH="$TMP_DIR/no-monitor-tools" "$BASH" scripts/monitor_manual_transition_ci.sh --runs "$runs" >"$TMP_DIR/monitor.err" 2>&1; then
|
||||
echo "monitor script should still require its tools for valid --runs: $runs" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$(cat "$TMP_DIR/monitor.err")" != "ERROR: required command not found: gh" ]]; then
|
||||
echo "monitor script missing dependency guard for valid --runs: $runs" >&2
|
||||
cat "$TMP_DIR/monitor.err" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
bash "$FAILURE_SAMPLES" --help >/tmp/manual_transition_failure_samples.help
|
||||
rg -q "Usage:" /tmp/manual_transition_failure_samples.help
|
||||
|
||||
Reference in New Issue
Block a user