Skip to content

Conversation

khanhtc1202
Copy link
Member

@khanhtc1202 khanhtc1202 commented Aug 9, 2022

What this PR does / why we need it:

The root cause of this issue is that when the currently running piped reports its metadata to the controlplane, only piped's platformProviders values in controlplane database are updated, but we forget to remove the old cloudProviders value, such that it exists and will be returned later in the web console application adding form.

Screen Shot 2022-08-09 at 11 20 09

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Fix platform providers shows duplicated values in application form

@khanhtc1202 khanhtc1202 enabled auto-merge (squash) August 9, 2022 02:26

func (s *pipedStore) UpdateMetadata(ctx context.Context, id, version, config string, pps []*model.Piped_PlatformProvider, repos []*model.ApplicationGitRepository, se *model.Piped_SecretEncryption, startedAt int64) error {
return s.update(ctx, id, func(piped *model.Piped) error {
piped.CloudProviders = nil
Copy link
Member

@knanao knanao Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I have one point I would like to confirm.
Is this safe for the user using only cloudProviders settings in piped?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The piped execution only refers to its local configuration and itself knows about the CloudProvider (suppose it has only CloudProviders and the piped runs the old version since the new one will merge all CloudProviders -> PlatformProviders), so I think it's okay since they know which "cloudProvider" to use on its side.

Otherwise, though we remove CloudProviders information from the piped model here, it only be used to show on the application adding form selection, so I think it's okay 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got your point! Thanks.

Copy link
Member

@nghialv nghialv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@khanhtc1202 khanhtc1202 merged commit c2a9c78 into master Aug 9, 2022
@khanhtc1202 khanhtc1202 deleted the fix-duplicate branch August 9, 2022 02:54
@knanao knanao mentioned this pull request Aug 9, 2022
knanao added a commit that referenced this pull request Aug 9, 2022
@github-actions github-actions bot mentioned this pull request Aug 9, 2022
@github-actions github-actions bot mentioned this pull request Aug 18, 2022
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