[concourse] Add support for old_name Job attribute

See: https://github.com/spring-projects/sts4/issues/388
This commit is contained in:
Kris De Volder
2019-11-01 11:52:17 -07:00
parent 10d1e620ad
commit 180b48c73b
3 changed files with 21 additions and 0 deletions

View File

@@ -407,6 +407,7 @@ public class PipelineYmlSchema implements YamlSchema {
AbstractType job = f.ybean("Job");
addProp(job, "name", jobNameDef).isPrimary(true);
addProp(job, "old_name", t_ne_string);
addProp(job, "plan", f.yseq(step)).isRequired(true);
addProp(job, "serial", t_boolean);
addProp(job, "build_logs_to_retain", t_pos_integer);

View File

@@ -0,0 +1,16 @@
*Optional*. The old name of the job. If configured, the history of old job will be inherited to the new one. Once the
pipeline is set, this field can be removed as the builds have been transfered.
This can be used to rename a job without losing its history, like so:
jobs:
- name: new-name
old_name: current-name
plan: [get: 10m]
After the pipeline is set, because the builds have been inherited, the job can have the field removed:
jobs:
- name: new-name
plan: [get: 10m]

View File

@@ -3985,6 +3985,7 @@ public class ConcourseEditorTest {
Editor editor = harness.newEditor(
"jobs:\n" +
" - name: job\n" +
" old_name: formerly-known-as\n" +
" serial: true\n" +
" build_logs_to_retain: 10\n" +
" serial_groups: []\n" +
@@ -4013,6 +4014,7 @@ public class ConcourseEditorTest {
);
editor.assertProblems(/*NONE*/);
editor.assertHoverContains("name", "The name of the job");
editor.assertHoverContains("old_name", "history of old job will be inherited to the new one");
editor.assertHoverContains("serial", "execute one-by-one");
editor.assertHoverContains("build_logs_to_retain", "only the last specified number of builds");
editor.assertHoverContains("serial_groups", "referencing the same tags will be serialized");
@@ -4031,6 +4033,7 @@ public class ConcourseEditorTest {
Editor editor = harness.newEditor(
"jobs:\n" +
" - name: job\n" +
" old_name: formerly-known-as\n" +
" serial: isSerial\n" +
" build_logs_to_retain: retainers\n" +
" serial_groups: no-list\n" +
@@ -4094,6 +4097,7 @@ public class ConcourseEditorTest {
"ensure",
"interruptible",
"max_in_flight",
"old_name",
"on_abort",
"on_error",
"on_failure",