Skip to content

Commit c481991

Browse files
authored
🐛 Fix target repository creds. (#173)
This spot missed. Related to: konveyor/tackle2-addon#75 - handle working with multiple repositories concurrently in 0.8. ``` - '[RULESET] fetching: id=30 (__Target(Test)-ac32d015-93df-11f0-8d81-4661cd220ef3)' - '[GIT] Home (directory): /addon/.git/8c35e7c2' - '[GIT] Cloning: https://github.com/abrugaro/book-server' - '[CMD] /usr/bin/git succeeded.' ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved error handling when associating identities with ruleset repositories so identity lookup failures are reported early and prevent partial repository setup. * **Refactor** * Repository initialization updated to a more flexible options-based pattern, improving extensibility while preserving existing behavior for users. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jeff Ortel <[email protected]>
1 parent 3031920 commit c481991

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cmd/rules.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,20 @@ func (r *Rules) addRuleSetRepository(ruleset *api.RuleSet) (err error) {
220220
if err != nil {
221221
return
222222
}
223-
var ids []api.Ref
223+
var options []any
224224
if ruleset.Identity != nil {
225-
ids = []api.Ref{*ruleset.Identity}
225+
var identity *api.Identity
226+
identity, err = addon.Identity.Get(ruleset.Identity.ID)
227+
if err == nil {
228+
options = append(options, identity)
229+
} else {
230+
return
231+
}
226232
}
227233
rp, err := repository.New(
228234
rootDir,
229235
ruleset.Repository,
230-
ids)
236+
options...)
231237
if err != nil {
232238
return
233239
}

0 commit comments

Comments
 (0)