Skip to content

Commit 3689e4a

Browse files
authored
✨ Support identity roles. (#22)
* ✨ support identity roles. Signed-off-by: Jeff Ortel <[email protected]> * fix comment. Signed-off-by: Jeff Ortel <[email protected]> * checkpoint Signed-off-by: Jeff Ortel <[email protected]> * checkpoint Signed-off-by: Jeff Ortel <[email protected]> * identity search. Signed-off-by: Jeff Ortel <[email protected]> * checkpoint Signed-off-by: Jeff Ortel <[email protected]> * go.mod updated. Signed-off-by: Jeff Ortel <[email protected]> * checkpoint Signed-off-by: Jeff Ortel <[email protected]> --------- Signed-off-by: Jeff Ortel <[email protected]>
1 parent c05ccaa commit 3689e4a

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

cmd/action.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,6 @@ func (r *BaseAction) setPlatform() (err error) {
7777
return
7878
}
7979

80-
// selectIdentity selects an identity based on kind.
81-
func (r *BaseAction) selectIdentity(kind string) (ref *api.Ref, err error) {
82-
idapi := addon.Application.Identity(r.application.ID)
83-
id, found, err := idapi.Find(kind)
84-
if err != nil {
85-
return
86-
}
87-
if found {
88-
ref = &api.Ref{
89-
ID: id.ID,
90-
Name: id.Name,
91-
}
92-
}
93-
return
94-
}
95-
9680
// selectProvider returns a platform provider based on kind.
9781
func (r *BaseAction) selectProvider(kind string) (p Provider, err error) {
9882
switch strings.ToLower(kind) {

cmd/generate.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,23 @@ func (a *Generate) Run(d *Data) (err error) {
5151
})
5252
return
5353
}
54-
identity, err := a.selectIdentity("asset")
54+
var options []any
55+
identity, found, err :=
56+
addon.Application.Identity(a.application.ID).Search().
57+
Direct("asset").
58+
Direct("source").
59+
Indirect("source").
60+
Find()
5561
if err != nil {
5662
return
5763
}
64+
if found {
65+
options = append(options, identity)
66+
}
5867
assetRepo, err := repository.New(
5968
AssetDir,
6069
a.application.Assets,
61-
identity)
70+
options...)
6271
if err != nil {
6372
return
6473
}
@@ -411,8 +420,11 @@ func (a *Generate) cloneCode() (sourceDir string, err error) {
411420
return
412421
}
413422
var options []any
414-
idapi := addon.Application.Identity(a.application.ID)
415-
identity, found, err := idapi.Find("source")
423+
identity, found, err :=
424+
addon.Application.Identity(a.application.ID).Search().
425+
Direct("source").
426+
Indirect("source").
427+
Find()
416428
if err != nil {
417429
return
418430
}
@@ -454,10 +466,14 @@ func (a *Generate) cloneTemplates(gen *api.Generator) (templateDir string, err e
454466
err = wrap(err)
455467
return
456468
}
469+
var options []any
470+
if gen.Identity != nil {
471+
options = append(options, gen.Identity)
472+
}
457473
template, err := repository.New(
458474
templateDir,
459475
gen.Repository,
460-
gen.Identity)
476+
options...)
461477
if err != nil {
462478
return
463479
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/jortel/go-utils v0.1.4
1111
github.com/konveyor/asset-generation v0.1.12
1212
github.com/konveyor/tackle2-addon v0.8.0-alpha.1
13-
github.com/konveyor/tackle2-hub v0.8.0-alpha.1.0.20250806105606-ac22f2e6ebba
13+
github.com/konveyor/tackle2-hub v0.8.0-beta.4.0.20250915141536-ccf24542dd57
1414
github.com/onsi/gomega v1.38.2
1515
sigs.k8s.io/yaml v1.4.0
1616
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ github.com/konveyor/asset-generation v0.1.12 h1:G3ZUzCzC+Shl0WqhZ8s/1rt26z2jEbZM
162162
github.com/konveyor/asset-generation v0.1.12/go.mod h1:DYew3e2TaiI0OB05HThjlD/YcO8rZTa+o8JmNPY4uQI=
163163
github.com/konveyor/tackle2-addon v0.8.0-alpha.1 h1:KpeGiJC/YQOUkvp6tOahwz8P/B98nt7oqz/YCnbHK10=
164164
github.com/konveyor/tackle2-addon v0.8.0-alpha.1/go.mod h1:mITXAU1o/8ZdBoGacaTZxXORfFe1q2S74W9RfTHHm7A=
165-
github.com/konveyor/tackle2-hub v0.8.0-alpha.1.0.20250806105606-ac22f2e6ebba h1:oFfga3vokkT2MzBdTyLimJbsPbZ+UtRRxHUTIROVpYo=
166-
github.com/konveyor/tackle2-hub v0.8.0-alpha.1.0.20250806105606-ac22f2e6ebba/go.mod h1:GRxhOKLZVtgT87F9DImg2DZVbvmiF+rnZpAE8yHNDPg=
165+
github.com/konveyor/tackle2-hub v0.8.0-beta.4.0.20250915141536-ccf24542dd57 h1:M+V7tWyMoX1Ewty3W0A4P0jBjx+NAWyA9Oi0qclSnSk=
166+
github.com/konveyor/tackle2-hub v0.8.0-beta.4.0.20250915141536-ccf24542dd57/go.mod h1:H51NdPwgKzuYgxkHUWPXQNVkWPI7gn5iKQgtQhrFrYE=
167167
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
168168
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
169169
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=

0 commit comments

Comments
 (0)