Add old_name property to Resource schema

See: https://github.com/spring-projects/sts4/issues/633
This commit is contained in:
Kris De Volder
2021-05-05 10:46:10 -07:00
parent 0b840cd8ea
commit f825c2e797
3 changed files with 25 additions and 0 deletions

View File

@@ -238,6 +238,7 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(t_resource, "tags", t_strings);
addProp(t_resource, "webhook_token", t_ne_string);
addProp(t_resource, "icon", t_ne_string);
addProp(t_resource, "old_name", t_ne_string);
AbstractType t_image_resource = f.ybean("ImageResource");
{

View File

@@ -0,0 +1,20 @@
*Optional* The old name of the resource. If configured, the history of the old resource will be inherited to the new one. Once the pipeline is set, this field can be removed as the history has been transferred.
This can be used to rename a resource without losing its history, like so:
```
resources:
- name: new-name
old_name: current-name
type: git
source: uri: "https://github.com/vito/booklit"
```
After the pipeline is set, the resource was successfully renamed, so the `old_name` field can be removed from the resource:
```
resources:
- name: new-name
type: git
source: uri: "https://github.com/vito/booklit"
```

View File

@@ -1906,6 +1906,7 @@ public class ConcourseEditorTest {
"- name: s3-multi\n" +
" type: docker-image\n" +
" check_every: bad-duration\n" +
" old_name: was-renamed\n" +
" privileged: is-priviliged\n" +
" tags: tags-list\n" +
" unique_version_history: is-unique-hist\n" +
@@ -1928,6 +1929,7 @@ public class ConcourseEditorTest {
"resources:\n" +
"- name: sts4\n" +
" type: git\n" +
" old_name: was-renamed\n" +
" icon: foo\n" +
" check_every: 5m\n" +
" webhook_token: bladayadayaaa\n" +
@@ -1937,6 +1939,7 @@ public class ConcourseEditorTest {
editor.assertHoverContains("name", "The name of the resource");
editor.assertHoverContains("type", "The type of the resource. Each worker advertises");
editor.assertHoverContains("old_name", "history of the old resource will be inherited");
editor.assertHoverContains("icon", "name of a [Material Design Icon]");
editor.assertHoverContains("source", 2, "The location of the resource");
editor.assertHoverContains("webhook_token", "web hooks can be sent to trigger an immediate *check* of the resource");
@@ -4024,6 +4027,7 @@ public class ConcourseEditorTest {
//For the 'exact' context:
"check_every",
"icon",
"old_name",
"tags",
"webhook_token",
//"name", exists