Skip to content

Commit 6d0fd3c

Browse files
committed
keep pathset related vars on job rerun
1 parent 05a816e commit 6d0fd3c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

core/src/main/java/com/flowci/core/common/domain/Variables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public abstract static class Git {
192192
public static final String PATCHSET_INSERT_SIZE = "FLOWCI_GIT_PATCHSET_INSERT_SIZE";
193193
public static final String PATCHSET_DELETE_SIZE = "FLOWCI_GIT_PATCHSET_DELETE_SIZE";
194194
public static final String PATCHSET_AUTHOR = "FLOWCI_GIT_PATCHSET_AUTHOR";
195-
public static final Collection<String> PATCH_VARS = ImmutableList.<String>builder()
195+
public static final Collection<String> PATCHSET_VARS = ImmutableList.<String>builder()
196196
.add(PATCHSET_SUBJECT)
197197
.add(PATCHSET_MESSAGE)
198198
.add(PATCHSET_PROJECT)

core/src/main/java/com/flowci/core/job/service/JobServiceImpl.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ public Job rerun(Flow flow, Job job) {
265265
job.setStartAt(null);
266266
job.setSnapshots(Maps.newHashMap());
267267
job.setStatus(Job.Status.PENDING);
268-
job.setTrigger(Trigger.MANUAL);
269268
job.resetCurrentPath();
270269
job.setPriority(Job.MaxPriority);
271270
job.setCreatedBy(sessionManager.getUserEmail());
@@ -276,9 +275,23 @@ public Job rerun(Flow flow, Job job) {
276275

277276
while (iterator.hasNext()) {
278277
var key = iterator.next().getKey();
279-
if (PUSH_TAG_VARS.contains(key) || PR_VARS.contains(key) || Objects.equals(key, COMMIT_ID)) {
278+
279+
if (PUSH_TAG_VARS.contains(key)) {
280+
continue;
281+
}
282+
283+
if (PR_VARS.contains(key)) {
284+
continue;
285+
}
286+
287+
if (PATCHSET_VARS.contains(key)) {
288+
continue;
289+
}
290+
291+
if (Objects.equals(key, COMMIT_ID)) {
280292
continue;
281293
}
294+
282295
iterator.remove();
283296
}
284297

0 commit comments

Comments
 (0)