-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pipelineTemplateSave): Take tags from template files (#355)
* fix(pipelineTemplateSave): Take tags from template files Spin ignores tags from pipeline template files, and it causes errors during saving. Example of the problem: 1. Create a template with a tag "stable" inside 2. Save it via `spin pt save`. Don't pass the tag to the command, because it already exists in the code 3. Front50 parses the template and finds the tag inside: https://github.com/spinnaker/front50/blob/master/front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/V2PipelineTemplateController.java#L94 4. Front50 saves the template with the tag 5. Edit the code of the template and save it again 6. Spin tries to find a template in Front50 without tags (because we don't pass the tag via arguments) 7. Spin can't find the template and invokes "create" method instead of "update" 8. Front50 throws an DuplicateEntityException because a template with the id already exists. Validation code: https://github.com/spinnaker/front50/blob/master/front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/V2PipelineTemplateController.java#L115 Front50 takes a tag from query parameters as a priority. And only if the tag is not in the query parameters, it tries to take it from the template source code. https://github.com/spinnaker/front50/blob/master/front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/V2PipelineTemplateController.java#L93 I reproduced a similar logic in Spin * fix comment in tests
- Loading branch information
Showing
2 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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