9 Commits

Author SHA1 Message Date
john 62ba8e0ff0 Bug fixing
ai/code-review No issues found
hello-world/pipeline/head This commit looks good
2026-05-03 21:39:24 +01:00
john 57e44e5bc9 Bug fixing
ai/code-review No issues found
hello-world/pipeline/head This commit looks good
2026-05-03 21:38:45 +01:00
john f39884310d Bug fixing
ai/code-review No issues found
hello-world/pipeline/head This commit looks good
2026-05-03 21:37:02 +01:00
john 4f05b6f6c0 Bug fixing
ai/code-review AI review reported findings
hello-world/pipeline/head This commit looks good
2026-05-03 21:35:53 +01:00
john d53655f4f4 New source
ai/code-review AI review reported findings
hello-world/pipeline/head There was a failure building this commit
2026-05-03 21:27:57 +01:00
john 959c4304b3 Update prompt
ai/code-review AI review reported findings
hello-world/pipeline/head This commit looks good
2026-05-03 21:27:03 +01:00
john 76292c8393 Make more efficient
ai/code-review AI review reported findings
hello-world/pipeline/head This commit looks good
2026-05-03 21:25:21 +01:00
john b504842293 Switching to x.ai for reviews
ai/code-review No issues found
hello-world/pipeline/head This commit looks good
2026-05-03 21:22:07 +01:00
john 4973316155 Update (#2)
ai/code-review AI review reported findings
hello-world/pipeline/head This commit looks good
Reviewed-on: #2
Co-authored-by: John Burton <john.burton@jbmail.com>
Co-committed-by: John Burton <john.burton@jbmail.com>
2026-05-03 09:15:56 +00:00
4 changed files with 33 additions and 17 deletions
Vendored
+2 -2
View File
@@ -1,10 +1,10 @@
pipeline {
agent any
environment {
OPENAI_API_KEY = credentials('OPENAI_API_KEY')
XAI_API_KEY = credentials('XAI_API_KEY')
GITEA_TOKEN = credentials('GITEA_TOKEN')
GITEA_URL = 'https://git.jb9.uk'
CODEX_MODEL = 'gpt-4'
XAI_MODEL = 'grok-4.3'
AI_REVIEW_FAIL_ON_FINDINGS = 'false'
}
+7 -3
View File
@@ -2,22 +2,26 @@
## Jenkins AI Review
The Jenkins pipeline can run an OpenAI-powered review and report back to Gitea.
The Jenkins pipeline can run an x.ai-powered review and report back to Gitea.
Required Jenkins secrets and variables:
- `OPENAI_API_KEY`
- `XAI_API_KEY`
- `GITEA_TOKEN`
- `GITEA_URL`
Optional variables:
- `CODEX_MODEL`
- `AI_REVIEW_MODEL`
- `XAI_MODEL`
- `XAI_BASE_URL`
- `AI_REVIEW_FAIL_ON_FINDINGS`
- `GITEA_REPO_OWNER`
- `GITEA_REPO_NAME`
- `GITEA_PR_NUMBER`
The default review model is `grok-4.3`, using the OpenAI Python SDK against `https://api.x.ai/v1`.
## Build
```bash
+15 -5
View File
@@ -174,7 +174,10 @@ def build_prompt(diff_text: str) -> str:
return (
"Review the following git diff. Focus on correctness, regressions, missing validation, "
"build/test issues, and security concerns. "
"build/test issues, and security concerns as well as style and usage of c++23. "
"Bring to attention any patterns that are generally considered error-prone or hard to maintain. "
"Highlight any places where the code could be simplified or made more efficient. "
"Provide suggestions for improving readability and maintainability. "
"No need to comment on removed code unless it seems like it would cause a problem. "
"Do not review the scripts in the scripts directory, as they are not part of the main codebase. "
"Return either 'No issues found.' or a short flat list where each item includes severity, file, and issue.\n\n"
@@ -190,12 +193,19 @@ def request_review(diff_text: str) -> str:
"The 'openai' package is not installed. Install it with 'pip install openai'."
) from exc
api_key = os.getenv("OPENAI_API_KEY")
api_key = os.getenv("XAI_API_KEY") or os.getenv("OPENAI_API_KEY")
if not api_key:
raise RuntimeError("OPENAI_API_KEY is not set.")
raise RuntimeError("XAI_API_KEY is not set.")
model = os.getenv("CODEX_MODEL") or os.getenv("OPENAI_MODEL") or "gpt-4.1"
client = OpenAI(api_key=api_key)
model = (
os.getenv("AI_REVIEW_MODEL")
or os.getenv("XAI_MODEL")
or os.getenv("CODEX_MODEL")
or os.getenv("OPENAI_MODEL")
or "grok-4.3"
)
base_url = os.getenv("XAI_BASE_URL") or "https://api.x.ai/v1"
client = OpenAI(api_key=api_key, base_url=base_url)
response = client.responses.create(
model=model,
+9 -7
View File
@@ -1,11 +1,13 @@
#include <iostream>
// Add six
int add_6(int cx) {
return 3 + cx;
}
int main() {
std::cout << "Hello, world!" << add_6(5) << std::endl;
return 0;
int main()
{
auto the_max_value = 100;
int total = 0;
for (int v = 0; v < the_max_value; ++v) {
total += v;
}
std::cout << "Total: " << total << std::endl;
}