Skip to content

fix(jenkins): commit agent config that only existed on one machine - #12

Merged
Cervator merged 1 commit into
MovingBlocks:mainfrom
SiliconSaga:fix/jenkins-agent-config-drift
Aug 12, 2026
Merged

fix(jenkins): commit agent config that only existed on one machine#12
Cervator merged 1 commit into
MovingBlocks:mainfrom
SiliconSaga:fix/jenkins-agent-config-drift

Conversation

@agent-refr

Copy link
Copy Markdown

AI-assisted change proposal. Filed by agent driven by @Cervator via GDD.

Summary

  • Commits the python-agent-ai pod template (Vertex AI, um-vertex-ai-sa) and the JDK 17 label additions that until now only existed on one workstation.
  • Lowers the controller resource requests to match what is actually being run.
  • Records two operational facts found nowhere else: the GitHub App now needs Checks: Read and write for build status to post, and a typo fix in the secrets filename.

Why this is worth doing now

values-agents.yaml has not been committed since 2025-01-16, and the terajenkins Argo Application has no automated: block — so it has never self-synced. The live JCasC ConfigMap therefore reflects the last manual sync, and every controller restart reloads that, discarding anything added through the UI since. That is the mechanism behind agent config being repeatedly lost and re-applied by hand; landing this and syncing is what stops it.

Hand-created jobs are unaffected either way — they live in JENKINS_HOME, not in JCasC.

Notes for the reviewer

  • The light and light-java labels now appear on both pre-cached-jdk11 and pre-cached-jdk17. That overlap is deliberate: jobs are expected to ask compositely (java11 && light), and bare light requests are rare enough that either JDK is acceptable. The comment above the JDK 11 template said the opposite, so it has been rewritten to describe the current intent rather than the old one.
  • The controller resource change is the only edit that alters the StatefulSet pod spec, so syncing will restart the controller. That is expected and acceptable here — nodes recycle regularly anyway.
  • Argo syncs the whole release rather than this diff, so anything else changed live and never committed reverts on the same sync. Worth a glance at the app diff before syncing, given how long it has been.

Test plan

  • helm template terajenkins jenkins/jenkins -f values.yaml -f values-agents.yaml -f values-jcasc-general.yaml -f values-plugins.yaml renders without error.
  • After merge and sync, confirm the python-ai label resolves and a python-ai job schedules a pod using um-vertex-ai-sa.
  • Confirm the agent config survives the next controller restart — the actual regression being fixed.

Related

The `python-agent-ai` template was added live and never committed, so every controller restart reloaded the last-synced JCasC and dropped it — the config had to be re-applied by hand each time. That is the actual failure mode behind "we lose the agent config on restart", and committing is what ends it.

The `light` / `light-java` labels on `pre-cached-jdk17` overlap with `pre-cached-jdk11` on purpose: jobs are expected to ask compositely (`java11 && light`), and anything requesting bare `light` is rare enough that either JDK is acceptable. Recorded because the comment above the jdk11 template reads as the opposite intent.

Controller resources drop to 100m/2.5Gi requests. Restart on sync is expected and fine — nodes recycle regularly anyway.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a dedicated Python AI build agent with a pre-cached Vertex AI environment.
    • Expanded JDK 17 agent labeling for light workloads.
  • Bug Fixes

    • Corrected the GitHub OAuth secret filename in local Kubernetes setup instructions.
    • Clarified required GitHub App access to repository checks.
  • Performance

    • Reduced Jenkins controller CPU and memory resource requests and CPU limits.

Walkthrough

Jenkins now has a dedicated Vertex AI agent, expanded JDK 17 labels, lower controller resource settings, and corrected local setup instructions.

Changes

Jenkins configuration updates

Layer / File(s) Summary
Agent provisioning and labels
jenkins/values-agents.yaml
Adds the exclusive python-agent-ai agent with a pre-cached Vertex AI image and um-vertex-ai-sa. Documents overlapping JDK labels and adds light and light-java to pre-cached-jdk17.
Controller resource settings
jenkins/values.yaml
Reduces Jenkins controller CPU and memory requests and the CPU limit.
Local setup documentation
jenkins/README.md
Corrects the local secret manifest filename and documents the required GitHub Checks permission.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit in the Jenkins yard,
Hopping through labels, light and hard.
Vertex AI joins the queue,
Smaller resources help it too.
Checks permissions now shine bright,
And secret names are spelled right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: committing Jenkins agent configuration that was previously present only on one machine.
Description check ✅ Passed The description accurately covers the Jenkins agent, label, resource, documentation, and restart-persistence changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
jenkins/values-agents.yaml (1)

54-54: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the Vertex AI agent image to an immutable reference.

The latest tag can change the build environment without a JCasC change or review. Use an image digest or an immutable release tag for this identity-bearing Jenkins agent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@jenkins/values-agents.yaml` at line 54, Update the Jenkins agent image
reference in the values configuration to replace the mutable latest tag with an
immutable image digest or versioned release tag, preserving the existing
repository and agent configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@jenkins/values-agents.yaml`:
- Around line 153-154: Correct the shared-label comment near the JDK templates
to state that only light and light-java overlap with JDK 17, while lib remains
JDK 11-only. Update the JOML.groovy label expression to include java11 if JOML
must run on JDK 11; otherwise preserve its ability to run on either JDK.

---

Nitpick comments:
In `@jenkins/values-agents.yaml`:
- Line 54: Update the Jenkins agent image reference in the values configuration
to replace the mutable latest tag with an immutable image digest or versioned
release tag, preserving the existing repository and agent configuration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a0842c6-b67f-49a7-ad69-65cd65366ebb

📥 Commits

Reviewing files that changed from the base of the PR and between 6916e81 and df195b2.

📒 Files selected for processing (3)
  • jenkins/README.md
  • jenkins/values-agents.yaml
  • jenkins/values.yaml

Comment on lines +153 to +154
# "lib", "light" and "light-java" are an old generation of labels from before the JDK was called out explicitly, so they deliberately overlap with the JDK 17 template below.
# Jobs are expected to ask compositely ("java11 && light"); a job requesting bare "light" may land on either JDK, which is acceptable for how rare those are.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- jenkins/values-agents.yaml: relevant ranges ---'
sed -n '45,85p;135,210p' jenkins/values-agents.yaml

printf '%s\n' '--- JOML.groovy ---'
sed -n '1,80p' jenkins/jobDSL/Libraries/JOML.groovy

printf '%s\n' '--- label references ---'
rg -n --glob '!node_modules' --glob '!dist' \
  'pre-cached-jdk17|light-java|java11|label|lib' \
  jenkins/jobDSL jenkins/values-agents.yaml

Repository: MovingBlocks/Logistics

Length of output: 18210


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path
import re

path = Path("jenkins/values-agents.yaml")
lines = path.read_text().splitlines()

# Print each agent block's labels and service-account-related fields without
# interpreting or executing the repository configuration.
current = None
for i, line in enumerate(lines, 1):
    m = re.match(r"\s*-\s*name:\s*(\S+)", line)
    if m:
        current = m.group(1)
    if current and any(key in line for key in ("name:", "label:", "yaml:", "serviceAccount", "automountServiceAccountToken")):
        if i <= 220:
            print(f"{i}: [{current}] {line}")
PY

Repository: MovingBlocks/Logistics

Length of output: 2909


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path
import re

text = Path("jenkins/values-agents.yaml").read_text()
agents = {}
current = None

for line in text.splitlines():
    m = re.match(r'\s*-\s*name:\s*"([^"]+)"\s*$', line)
    if m:
        current = m.group(1)
        agents[current] = []
        continue
    m = re.match(r'\s*label:\s*"([^"]+)"\s*$', line)
    if current and m:
        agents[current] = m.group(1).split()

for selector in ("lib", "light", "light-java", "java11", "java17"):
    matches = [name for name, labels in agents.items() if selector in labels]
    print(f"{selector}: {matches}")

job = Path("jenkins/jobDSL/Libraries/JOML.groovy").read_text()
labels = re.findall(r'\blabel\s+"([^"]+)"', job)
print(f"JOML labels: {labels}")
print("JOML has explicit java11 constraint:",
      any("java11" in label.split() for label in labels))
PY

Repository: MovingBlocks/Logistics

Length of output: 442


Correct the shared-label documentation.

pre-cached-jdk17 has light and light-java, but not lib. lib remains JDK 11-only. JOML.groovy requests bare light-java, so it can run on either JDK. If JOML requires JDK 11, add java11 to its label expression.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@jenkins/values-agents.yaml` around lines 153 - 154, Correct the shared-label
comment near the JDK templates to state that only light and light-java overlap
with JDK 17, while lib remains JDK 11-only. Update the JOML.groovy label
expression to include java11 if JOML must run on JDK 11; otherwise preserve its
ability to run on either JDK.

@Cervator
Cervator merged commit bcf3d5f into MovingBlocks:main Aug 12, 2026
1 check passed
@Cervator
Cervator deleted the fix/jenkins-agent-config-drift branch August 12, 2026 03:07
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.

2 participants