detached c69eeb8

fix: apply CodeRabbit auto-fixes

Fixed 2 file(s) based on 2 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
commit
c69eeb8fc7d3fdcc4d68b85f5cf9d8b7611a96f7
author
coderabbitai[bot] · · 2026-04-26 07:04 UTC
committer
GitHub · · 2026-04-26 07:04 UTC
parent
a40ece3
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
2 files · +24 -11
M internal/app/migrate_env.go +23 -11
@@ -94,7 +94,7 @@ func migrateEnvFile(envDir, name string, passStore *domainsecrets.PassStore, log
9494
9595 if err := os.Remove(filePath); err != nil {
9696 // Check if the stored secrets match what we just wrote
97- storedSecrets, getErr := passStore.Get(domainName)
97+ storedSecrets, getErr := passStore.GetAll(domainName)
9898 if getErr == nil && secretsMatch(storedSecrets, secrets) {
9999 // Migration was successful, removal failed but secrets are stored
100100 log.Warn().
@@ -104,11 +104,17 @@ func migrateEnvFile(envDir, name string, passStore *domainsecrets.PassStore, log
104104 return nil
105105 }
106106 // Attempt rollback: remove the pass entry we just wrote
107- if delErr := passStore.Delete(domainName); delErr != nil {
108- log.Error().
109- Err(delErr).
110- Str("domain", domainName).
111- Msg("failed to rollback pass entry after file removal failure")
107+ rollbackKeys, listErr := passStore.ListKeys(domainName)
108+ if listErr == nil {
109+ for _, key := range rollbackKeys {
110+ if delErr := passStore.Delete(domainName, key); delErr != nil {
111+ log.Error().
112+ Err(delErr).
113+ Str("domain", domainName).
114+ Str("key", key).
115+ Msg("failed to rollback pass entry after file removal failure")
116+ }
117+ }
112118 }
113119 return fmt.Errorf("failed to remove migrated env file %s: %w", filePath, err)
114120 }
@@ -198,11 +204,17 @@ func migrateAttachmentEnvFile(envDir, name string, passStore *domainsecrets.Pass
198204 return nil
199205 }
200206 // Attempt rollback: remove the pass entry we just wrote
201- if delErr := passStore.DeleteAttachment(containerName); delErr != nil {
202- log.Error().
203- Err(delErr).
204- Str("container", containerName).
205- Msg("failed to rollback pass entry after file removal failure")
207+ rollbackSecrets, listErr := passStore.GetAllAttachment(containerName)
208+ if listErr == nil {
209+ for key := range rollbackSecrets {
210+ if delErr := passStore.DeleteAttachment(containerName, key); delErr != nil {
211+ log.Error().
212+ Err(delErr).
213+ Str("container", containerName).
214+ Str("key", key).
215+ Msg("failed to rollback pass entry after file removal failure")
216+ }
217+ }
206218 }
207219 return fmt.Errorf("failed to remove migrated attachment env file %s: %w", filePath, err)
208220 }
@@ -94,7 +94,7 @@ func migrateEnvFile(envDir, name string, passStore *domainsecrets.PassStore, log
94 94
95 if err := os.Remove(filePath); err != nil {95 if err := os.Remove(filePath); err != nil {
96 // Check if the stored secrets match what we just wrote96 // Check if the stored secrets match what we just wrote
97- storedSecrets, getErr := passStore.Get(domainName)97+ storedSecrets, getErr := passStore.GetAll(domainName)
98 if getErr == nil && secretsMatch(storedSecrets, secrets) {98 if getErr == nil && secretsMatch(storedSecrets, secrets) {
99 // Migration was successful, removal failed but secrets are stored99 // Migration was successful, removal failed but secrets are stored
100 log.Warn().100 log.Warn().
@@ -104,11 +104,17 @@ func migrateEnvFile(envDir, name string, passStore *domainsecrets.PassStore, log
104 return nil104 return nil
105 }105 }
106 // Attempt rollback: remove the pass entry we just wrote106 // Attempt rollback: remove the pass entry we just wrote
107- if delErr := passStore.Delete(domainName); delErr != nil {107+ rollbackKeys, listErr := passStore.ListKeys(domainName)
108- log.Error().108+ if listErr == nil {
109- Err(delErr).109+ for _, key := range rollbackKeys {
110- Str("domain", domainName).110+ if delErr := passStore.Delete(domainName, key); delErr != nil {
111- Msg("failed to rollback pass entry after file removal failure")111+ log.Error().
112+ Err(delErr).
113+ Str("domain", domainName).
114+ Str("key", key).
115+ Msg("failed to rollback pass entry after file removal failure")
116+ }
117+ }
112 }118 }
113 return fmt.Errorf("failed to remove migrated env file %s: %w", filePath, err)119 return fmt.Errorf("failed to remove migrated env file %s: %w", filePath, err)
114 }120 }
@@ -198,11 +204,17 @@ func migrateAttachmentEnvFile(envDir, name string, passStore *domainsecrets.Pass
198 return nil204 return nil
199 }205 }
200 // Attempt rollback: remove the pass entry we just wrote206 // Attempt rollback: remove the pass entry we just wrote
201- if delErr := passStore.DeleteAttachment(containerName); delErr != nil {207+ rollbackSecrets, listErr := passStore.GetAllAttachment(containerName)
202- log.Error().208+ if listErr == nil {
203- Err(delErr).209+ for key := range rollbackSecrets {
204- Str("container", containerName).210+ if delErr := passStore.DeleteAttachment(containerName, key); delErr != nil {
205- Msg("failed to rollback pass entry after file removal failure")211+ log.Error().
212+ Err(delErr).
213+ Str("container", containerName).
214+ Str("key", key).
215+ Msg("failed to rollback pass entry after file removal failure")
216+ }
217+ }
206 }218 }
207 return fmt.Errorf("failed to remove migrated attachment env file %s: %w", filePath, err)219 return fmt.Errorf("failed to remove migrated attachment env file %s: %w", filePath, err)
208 }220 }
M internal/usecase/container/service.go +1 -0
@@ -1823,6 +1823,7 @@ func imageRegistryForPolicy(imageRef string) string {
18231823
18241824 func normalizeRegistry(registry string) string {
18251825 registry = strings.ToLower(strings.TrimSuffix(strings.TrimSpace(registry), "."))
1826+ registry = strings.TrimSuffix(registry, "/")
18261827 if strings.HasPrefix(registry, "[") {
18271828 if end := strings.Index(registry, "]"); end != -1 {
18281829 host := strings.Trim(registry[:end+1], "[]")
@@ -1823,6 +1823,7 @@ func imageRegistryForPolicy(imageRef string) string {
1823 1823
1824 func normalizeRegistry(registry string) string {1824 func normalizeRegistry(registry string) string {
1825 registry = strings.ToLower(strings.TrimSuffix(strings.TrimSpace(registry), "."))1825 registry = strings.ToLower(strings.TrimSuffix(strings.TrimSpace(registry), "."))
1826+ registry = strings.TrimSuffix(registry, "/")
1826 if strings.HasPrefix(registry, "[") {1827 if strings.HasPrefix(registry, "[") {
1827 if end := strings.Index(registry, "]"); end != -1 {1828 if end := strings.Index(registry, "]"); end != -1 {
1828 host := strings.Trim(registry[:end+1], "[]")1829 host := strings.Trim(registry[:end+1], "[]")

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close