2 Commits

Author SHA1 Message Date
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
4 changed files with 22 additions and 11 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
+11 -4
View File
@@ -190,12 +190,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,
+2 -2
View File
@@ -1,6 +1,6 @@
#include <iostream>
std::string get_greeting() {
const std::string& get_greeting() {
return "Hello, world!";
}
@@ -10,6 +10,6 @@ int add_6(int cx) {
}
int main() {
std::cout << "Hello, world!" << add_6(5) << get_greeting() << "/n";
std::cout << "Hello, world!" << add_6(5) << std::endl;
return 0;
}