ci: enhance Kubernetes tests and add safe mode for fork PRs#961
ci: enhance Kubernetes tests and add safe mode for fork PRs#961SB2318 wants to merge 1 commit intoTracer-Cloud:mainfrom
Conversation
Greptile SummaryThis PR introduces "safe mode" guards across all CI jobs so that fork PRs without access to repository secrets skip credential-dependent tests rather than failing, while trusted pushes to Confidence Score: 5/5Safe to merge; all remaining findings are P2 style/quality suggestions that do not affect correctness. The core logic — skipping secret-dependent tests for fork PRs while preserving full execution for trusted environments — is sound and correct. The two P2 findings (wasteful setup for k8s-titled fork PRs and limited No files require special attention for merging. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CI Triggered] --> B{Event type?}
B -->|push to main, own repo| C[Full mode: all jobs run with secrets]
B -->|pull_request| D{Fork PR?}
D -->|No - trusted PR| E[Full mode: all jobs run with secrets]
D -->|Yes - fork PR| F[Safe mode]
F --> G[test job: Run safe tests\n--ignore=e2e --ignore=synthetic]
F --> H{k8s or kubernetes\nin PR title?}
H -->|Yes| I[test-kubernetes job triggers\nbut Run Kubernetes tests step skipped]
H -->|No| J[test-kubernetes job skipped at job level]
F --> K[test-thorough: skipped\njob-level repo+push guard]
C --> L[test: full pytest + coverage]
C --> M[test-kubernetes: full k8s tests with AWS creds]
C --> N[test-thorough: E2E matrix\nchecks AWS creds present before running]
Reviews (1): Last reviewed commit: "ci: enhance Kubernetes tests and add saf..." | Re-trigger Greptile |
| if: >- | ||
| github.event_name == 'push' || | ||
| (github.repository == 'Tracer-Cloud/opensre' && github.event_name == 'push') || | ||
| contains(github.event.pull_request.title, 'k8s') || | ||
| contains(github.event.pull_request.title, 'kubernetes') |
There was a problem hiding this comment.
Fork PRs with "k8s"/"kubernetes" in title still trigger the job
The job-level if condition gates the push leg on github.repository, but the two contains(…title…) legs have no repo guard. A fork PR whose title includes "k8s" or "kubernetes" will pass this filter, spin up the runner, check out, and install all dependencies — only to be stopped at the step level. All that setup work is wasted CI time without benefit.
| if: >- | |
| github.event_name == 'push' || | |
| (github.repository == 'Tracer-Cloud/opensre' && github.event_name == 'push') || | |
| contains(github.event.pull_request.title, 'k8s') || | |
| contains(github.event.pull_request.title, 'kubernetes') | |
| if: >- | |
| (github.repository == 'Tracer-Cloud/opensre' && github.event_name == 'push') || | |
| (github.repository == 'Tracer-Cloud/opensre' && contains(github.event.pull_request.title, 'k8s')) || | |
| (github.repository == 'Tracer-Cloud/opensre' && contains(github.event.pull_request.title, 'kubernetes')) |
| @@ -0,0 +1 @@ | |||
| * text=auto eol=lf | |||
There was a problem hiding this comment.
.gitattributes scope limited to app/ only
Placing this file under app/ means the eol=lf normalisation applies only to files in that subdirectory. The CI lint/format steps also check tests/, which is a sibling directory and is not covered. If CRLF line-ending issues exist in tests/, this file will not fix them. The standard practice is to place .gitattributes at the repository root so it applies everywhere.
Fixes #926
Describe the changes you have made in this PR -
Fixed CI formatting issues by aligning code with ruff format expectations
Ensured all lint and format checks pass successfully in CI
Stabilized CI pipeline by introducing safe vs full execution logic
Skipped Kubernetes and AWS-dependent tests for forked PRs (no secrets environment)
Prevented CI failures caused by missing external credentials
Preserved full test execution for trusted environments (main branch / non-fork PRs)
Improved overall CI reliability without altering core application behavior
Demo/Screenshot for feature changes and bug fixes -
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.