Add retry metadata to replacement agent pods - #2841
Open
wuhuizuo wants to merge 3 commits into
Open
Conversation
ti-chi-bot Bot
pushed a commit
to PingCAP-QE/ee-ops
that referenced
this pull request
Jun 5, 2026
…d8f in gcp staging (#2014) ## Summary - add a staging-only Jenkins plugin override for kubernetes - pin the plugin version to 4437.vd64141124d8f - fetch the HPI from the GitHub release asset built from the upstream change ## Release - https://github.com/wuhuizuo/jenkins-kubernetes-plugin/releases/tag/4437.vd64141124d8f - https://github.com/wuhuizuo/jenkins-kubernetes-plugin/releases/download/4437.vd64141124d8f/kubernetes-4437.vd64141124d8f.hpi ## Upstream PR - jenkinsci/kubernetes-plugin#2841
wuhuizuo
commented
Jul 6, 2026
jglick
requested changes
Jul 9, 2026
jglick
left a comment
Member
There was a problem hiding this comment.
Implementation is probably wrong, and tests are unconvincing.
| * (i.e., when the {@code podTemplate} step block exits). See | ||
| * {@link KubernetesCloud#removeDynamicTemplate(PodTemplate)}. | ||
| */ | ||
| static final ConcurrentHashMap<String, AtomicInteger> TEMPLATE_PROVISION_COUNTS = new ConcurrentHashMap<>(); |
Member
There was a problem hiding this comment.
static field ⇒ will not survive Jenkins restart
| * {@code 2} means two prior attempts failed, etc. | ||
| * This is a transient field set at construction time and never persisted. | ||
| */ | ||
| private transient int retryAttempt; |
Member
There was a problem hiding this comment.
Ditto. Maybe you meant to have something in PodTemplateStepExecution?
|
|
||
| @Test | ||
| public void testNoRetryLabelOnFirstAttempt() throws Exception { | ||
| when(slave.getRetryAttempt()).thenReturn(0); |
| KubernetesSlave first = new KubernetesSlave.Builder() | ||
| .podTemplate(podTemplate) | ||
| .cloud(cloud) | ||
| .build(); |
Member
There was a problem hiding this comment.
Unit tests do not necessarily reflect real behavior. A convincing test would be in a AbstractKubernetesPipelineTest subclass and actually run a pipeline with a retry step and actually run two node blocks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testing done
KubernetesSlaveTest#testRetryAttemptTrackingfor retry-attempt tracking and counter cleanup.PodTemplateBuilderTest#testNoRetryLabelOnFirstAttemptandPodTemplateBuilderTest#testRetryLabelAndAnnotationOnRetryAttemptfor retry pod metadata.docker run --rm -v /Users/zuowuhui/apps/github.com/wuhuizuo/jenkins-kubernetes-plugin:/workspace -w /workspace maven:3.9.9-eclipse-temurin-17 mvn -Dmaven.repo.local=/workspace/.codex-m2-repo -Dtest=KubernetesSlaveTest,PodTemplateBuilderTest test.Tests run: 41, Failures: 0, Errors: 0, Skipped: 0,BUILD SUCCESS.Submitter checklist
kubernetes.jenkins.io/retry=trueto retry pods.kubernetes.jenkins.io/retry-attemptwith the retry index.