fix(web): Fix dependent pipelines listing API
Issue Summary
This fixes the bug regarding /v2/pipelineTemplates/<pipeline-template-id>/dependentPipelines API.
Original Issue: https://github.com/spinnaker/spinnaker/issues/6472
Environment
Spinnaker: 1.33.0+
Front50: us-docker.pkg.dev/spinnaker-community/docker/front50:2.31.0
Description
Given a templateId, the getDependentConfigs method called by listDependentPipelines method, was returning null for pipeline configuration, causing the entire API to return [] even if a specific pipeline template had dependent pipelines.. This seems to be because of 👇 change.
import com.netflix.spinnaker.front50.model.pipeline.TemplateConfiguration;
TemplateConfiguration v1Config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class);
// `templatedPipeline.getConfig()` above was returning `null`
This 👆 I believe is meant for v1 templates. But for v2 templates I believe it has to be 👇 :
import com.netflix.spinnaker.front50.model.pipeline.V2TemplateConfiguration;
V2TemplateConfiguration config = objectMapper.convertValue(templatedPipeline, V2TemplateConfiguration.class);
Here are the swagger-ui screenshots showing before and after the fix 👇
| Before | After |
|---|---|
Here are the cURL responses showing before and after the fix 👇
Before
curl -X GET "http://localhost:30084/v2/pipelineTemplates/9d92ff72-2bbf-43a3-bd57-23c221387051/dependents" -H "accept: */*"
[]
After
curl -X GET "http://localhost:30084/v2/pipelineTemplates/9d92ff72-2bbf-43a3-bd57-23c221387051/dependents" -H "accept: */*"
[{"application":"products","pipelineConfigId":"9aef1986-48cf-44ce-859c-97b3042388db","pipelineName":"[Mother Pipeline] Global Deployment Express"}]
The following commits need their title changed:
- ac0776a414f9fe625153df7982141b10ab281b28: Fix dependent pipelines API
Please format your commit title into the form:
<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check
This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.
Can you add some automated tests that demonstrate the bug? I'd also like to see a more specific commit message that mentions what was broken. Thanks.
@dbyron-sf I have added the tests. And reworded the commit message. Please take a look.
Can you add some automated tests that demonstrate the bug?
Here it is: @dbyron-sf : https://github.com/spinnaker/front50/pull/1459/commits/1402d7b651ba94cc2fe80bb533f861ab9a8629b8#diff-f2c1cc675d8e520ff0541b397bd0d390483bcf197b0576fe2b5976a8db2de02a