Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): Retrieve dependent pipelines correctly #1459

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

nandak522
Copy link
Contributor

@nandak522 nandak522 commented Apr 23, 2024

Issue Summary

This fixes the bug regarding /v2/pipelineTemplates/<pipeline-template-id>/dependentPipelines API.
Original Issue: spinnaker/spinnaker#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
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"}]

@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • ac0776a: 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.

@nandak522 nandak522 force-pushed the fix-dependent-pipelines-api branch from ac0776a to 2187037 Compare April 23, 2024 10:21
@dbyron-sf
Copy link
Contributor

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.

@nandak522 nandak522 force-pushed the fix-dependent-pipelines-api branch from 4a7e924 to 9c9630b Compare June 3, 2024 10:03
@nandak522
Copy link
Contributor Author

@dbyron-sf I have added the tests. And reworded the commit message. Please take a look.

@nandak522 nandak522 changed the title fix(web): Fix dependent pipelines listing API fix(web): Retrieve dependent pipelines correctly Jun 3, 2024
@nandak522
Copy link
Contributor Author

nandak522 commented Jun 3, 2024

Can you add some automated tests that demonstrate the bug?

Here it is: @dbyron-sf : 1402d7b#diff-f2c1cc675d8e520ff0541b397bd0d390483bcf197b0576fe2b5976a8db2de02a

@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Jun 3, 2024
@mergify mergify bot added the auto merged label Jun 3, 2024
@mergify mergify bot merged commit 4ea6179 into spinnaker:master Jun 3, 2024
4 checks passed
@nandak522 nandak522 deleted the fix-dependent-pipelines-api branch August 7, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants