Repository navigation
feat: implement issue #894 — [Fleet Monitor] petry-projects/.github — .github/workflows/ci.yml #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
efb39e5
feat: implement issue #894 — [Fleet Monitor] petry-projects/.github —…
donpetry-bot 638ae71
fix(reviews): address review comments [skip ci-relay]
donpetry-bot 8c1df1d
fix(bot): address bot feedback [skip ci-relay]
donpetry-bot 3486ab8
fix(reviews): address review comments [skip ci-relay]
donpetry-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Regression guard for the flaky "Lint GitHub Actions" download in ci.yml | ||
| # (issue #894): every curl download in ci.yml must carry bounded retries so a | ||
| # transient GitHub Releases blip retries instead of failing the job. | ||
| # See test/workflows/ci/install-resilience.bats. | ||
| name: CI Workflow Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/ci.yml' | ||
| - 'test/workflows/ci/**' | ||
| - '.github/workflows/ci-tests.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - '.github/workflows/ci.yml' | ||
| - 'test/workflows/ci/**' | ||
| - '.github/workflows/ci-tests.yml' | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: ci-tests-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: bats | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install bats | ||
| run: | | ||
| set -euo pipefail | ||
| for attempt in {1..3}; do | ||
| if sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends bats; then | ||
| exit 0 | ||
| fi | ||
| if [ "$attempt" -lt 3 ]; then | ||
| echo "Apt install failed, retrying in 5 seconds..." >&2 | ||
| sleep 5 | ||
| fi | ||
| done | ||
| echo "Apt install failed after 3 attempts" >&2 | ||
| exit 1 | ||
|
|
||
|
qodo-code-review[bot] marked this conversation as resolved.
|
||
| - name: bats | ||
| run: bats --print-output-on-failure test/workflows/ci/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
| # Common test helpers for the ci.yml bats suite. | ||
| # Mirrors the pattern in test/workflows/pr-review-mention/helpers/setup.bash. | ||
|
|
||
| # Repo root, regardless of where bats is invoked from. | ||
| TT_REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../../.." && pwd)" | ||
| export TT_REPO_ROOT | ||
|
|
||
| TT_WORKFLOW="${TT_REPO_ROOT}/.github/workflows/ci.yml" | ||
| export TT_WORKFLOW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bats | ||
| # Regression guard for the flaky "Lint GitHub Actions" step in | ||
| # .github/workflows/ci.yml. | ||
| # | ||
| # Pins issue #894: ci.yml intermittently fails (~14% of runs) because the pinned | ||
| # rhysd/actionlint binary is fetched from GitHub Releases — which redirects to | ||
| # objects.githubusercontent.com — with a bare `curl` that aborts on the first | ||
| # transient network/5xx blip. This is the same failure mode fixed for | ||
| # pr-review-mention-tests.yml under #739. AGENTS.md requires CI to be reliable; | ||
| # the one unavoidable network fetch must therefore retry on transient errors. | ||
| # These tests assert every download in ci.yml carries bounded curl retries, so a | ||
| # future edit can't silently reintroduce a bare download. | ||
|
|
||
| load 'helpers/setup' | ||
|
|
||
| @test "install: the ci workflow exists" { | ||
| [ -f "$TT_WORKFLOW" ] | ||
| } | ||
|
|
||
| @test "install: every curl download in ci.yml uses bounded retries" { | ||
| [ -f "$TT_WORKFLOW" ] | ||
|
|
||
| # Parse the workflow joining backslash-continued lines so that a curl command | ||
| # split across multiple lines is treated as a single logical invocation. | ||
| # This avoids false failures when flags appear on continuation lines, and | ||
| # avoids false passes when a bare `curl` is split from its flags. | ||
| local curls=() | ||
| local current="" | ||
| while IFS= read -r line || [[ -n "$line" ]]; do | ||
| line="${line%$'\r'}" | ||
| if [[ "$line" == *\\ ]]; then | ||
| current+="${line%\\} " | ||
|
don-petry marked this conversation as resolved.
|
||
| else | ||
| current+="$line" | ||
| if [[ "$current" == *curl* ]] && ! [[ "$current" =~ ^[[:space:]]*# ]] && ! [[ "$current" =~ ^[[:space:]]*-?[[:space:]]*(name|uses|with): ]]; then | ||
| curls+=("$current") | ||
| fi | ||
| current="" | ||
| fi | ||
| done < "$TT_WORKFLOW" | ||
|
|
||
| # At least one curl invocation must be present so the test remains meaningful. | ||
| [ "${#curls[@]}" -ge 1 ] | ||
| for cmd in "${curls[@]}"; do | ||
| # A finite retry budget (not unbounded) so a truly-down mirror still fails fast. | ||
| [[ "$cmd" =~ --retry[[:space:]=][1-9] ]] | ||
| # Retry on connection refused, which curl otherwise treats as non-transient. | ||
| [[ "$cmd" == *"--retry-connrefused"* ]] | ||
| # Retry on transient HTTP 5xx too, not just connection-level errors. | ||
| [[ "$cmd" == *"--retry-all-errors"* ]] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| done | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.