Skip to content

fix(credentials): Persist credential selection#119

Merged
nfebe merged 1 commit intomainfrom
fix/persist-credential-id-without-metadata
Apr 17, 2026
Merged

fix(credentials): Persist credential selection#119
nfebe merged 1 commit intomainfrom
fix/persist-credential-id-without-metadata

Conversation

@nfebe
Copy link
Copy Markdown
Contributor

@nfebe nfebe commented Apr 17, 2026

Deployments created with a registry credential but no networking or SSL metadata (for example, internal services without an exposed domain) were silently dropped by the agent, so the detail view later showed them as "Public" and subsequent pulls reverted to Docker Hub.

The agent now persists registry credential selections unconditionally when one is present, ensuring the association survives across restarts and rebuilds regardless of whether other metadata fields were provided.

@sourceant
Copy link
Copy Markdown

sourceant Bot commented Apr 17, 2026

Code Review Summary

The PR addresses a bug where registry credentials were not persisted if the service lacked other metadata (like SSL or networking configs).

🚀 Key Improvements

  • Ensures req.Metadata is initialized if credentials are present, preventing data loss during service updates.

Copy link
Copy Markdown

@sourceant sourceant Bot left a comment

Choose a reason for hiding this comment

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

Review complete. See the overview comment for a summary.

Comment thread internal/api/server.go

}

if req.Metadata != nil && (credentialID != "" || len(req.ServiceCredentials) > 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

By initializing req.Metadata when it's nil but credentials exist, we ensure that registry associations are persisted. This fixes the bug where deployments without networking metadata would lose their credential links. Ensure models.ServiceMetadata does not require additional mandatory fields other than Name.

Suggested change
if req.Metadata != nil && (credentialID != "" || len(req.ServiceCredentials) > 0) {
+ if credentialID != "" || len(req.ServiceCredentials) > 0 {
+ if req.Metadata == nil {
+ req.Metadata = &models.ServiceMetadata{Name: req.Name}
+ }

Deployments created with a registry credential but no networking or SSL
metadata (for example, internal services without an exposed domain) were
silently dropped by the agent, so the detail view later showed them as
"Public" and subsequent pulls reverted to Docker Hub.

The agent now persists registry credential selections unconditionally
when one is present, ensuring the association survives across restarts
and rebuilds regardless of whether other metadata fields were provided.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
@nfebe nfebe force-pushed the fix/persist-credential-id-without-metadata branch from c78e52c to 277b8f3 Compare April 17, 2026 23:43
Copy link
Copy Markdown

@sourceant sourceant Bot left a comment

Choose a reason for hiding this comment

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

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

@nfebe nfebe changed the title fix(credentials): Persist credential selection even without other met… fix(credentials): Persist credential selection Apr 17, 2026
@nfebe nfebe merged commit 0577298 into main Apr 17, 2026
5 checks passed
@nfebe nfebe deleted the fix/persist-credential-id-without-metadata branch April 17, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant