Skip to content

fix(ci): serve spec readable by nginx and run demo/bench on PRs - #66

Merged
Arkptz merged 5 commits into
mainfrom
fix/ci-pr-triggers-and-swagger-ui
Aug 1, 2026
Merged

fix(ci): serve spec readable by nginx and run demo/bench on PRs#66
Arkptz merged 5 commits into
mainfrom
fix/ci-pr-triggers-and-swagger-ui

Conversation

@Arkptz

@Arkptz Arkptz commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

The demo GIF still showed Failed to load API definition / Forbidden ./openapi.yaml after #65. That fix moved openapi.yaml into nginx's web root but kept it a bind-mount, so the file retained the host uid/perms. nginx workers run as the unprivileged nginx user and still could not read it — hence the 403.

This copies the spec into the container instead and chmod 644s it, then fails fast if the spec is not actually fetchable.

Both workflows also now run on pull_request when their own inputs change, so CI changes are verifiable before merging to main rather than after.

Type of Change

  • Bug fix (non-breaking)
  • CI / build / tooling

Checklist

  • cargo fmt --all clean (no Rust changes)
  • cargo clippy --all-targets --all-features -- -D warnings clean (no Rust changes)
  • cargo test passes locally (no Rust changes)
  • Added or updated tests for the change
  • Updated README / CLI help text if user-facing behavior changed
  • Added entry to CHANGELOG.md under [Unreleased] (if user-facing)
  • Used conventional commit style in commit messages (feat:, fix:, docs:, etc.)

Testing

Reproduced the root cause locally and verified the fix:

  1. Confirmed the cause — nginx runs workers as nginx, not root:

    $ docker run --rm -v $PWD/perm600.yaml:/usr/share/nginx/html/openapi.yaml:ro \
        --entrypoint sh swaggerapi/swagger-ui \
        -c 'su -s /bin/sh nginx -c "cat /usr/share/nginx/html/openapi.yaml"'
    cat: can't open '/usr/share/nginx/html/openapi.yaml': Permission denied
    
  2. Verified the fix with a deliberately 0600 spec (the CI failure condition) — docker cp + chmod makes it readable and it serves HTTP 200.

  3. Ran the real phase3.spec.ts against a 0600 spec: passes, and the recorded video's final frame shows the spec rendered (Test API 1.0.0 OAS 3.0) with no error banner and zero browser console errors.

Workflow changes

  • pull_request trigger on both workflows, path-filtered to their own inputs
  • checkout uses github.head_ref || github.ref_name (PR checkouts are otherwise detached HEAD)
  • Artifacts push to the originating branch, not main
  • Pushes skipped for fork PRs, whose tokens are read-only

Related Issues

Follow-up to #65

Arkptz and others added 5 commits August 1, 2026 22:07
The previous fix put openapi.yaml in nginx's web root but kept it a
bind-mount, so it retained the host uid/perms. nginx workers run as the
unprivileged `nginx` user and still could not read it — Swagger UI kept
showing 'Forbidden ./openapi.yaml'. Copy the spec into the container and
chmod it instead, and fail fast if it is not fetchable.

Both workflows now also run on pull_request when their own inputs change,
check out the head branch, and push generated artifacts back to that
branch instead of main. Pushes are skipped for fork PRs (read-only token).
Both workflows now push to the same branch, so whichever finishes second
hits a non-fast-forward. Rebase onto the branch tip first.
@Arkptz
Arkptz merged commit 26eca12 into main Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant