@@ -86,16 +86,7 @@ func (d *Connector) Metadata(ctx context.Context) (*v2.ConnectorMetadata, error)
8686// Validate is called to ensure that the connector is properly configured. It should exercise any API credentials
8787// to be sure that they are valid.
8888func (d * Connector ) Validate (ctx context.Context ) (annotations.Annotations , error ) {
89- if ! d .Client .IsOnPremise && d .Client .AccountCreationGroup == "" {
90- return nil , fmt .Errorf ("a group is required when using GitLab Cloud Version" )
91- }
92-
93- _ , _ , err := d .Client .ListGroups (ctx , "" )
94- if err != nil {
95- return nil , fmt .Errorf ("error listing groups: %w" , err )
96- }
97-
98- if d .Client .AccountCreationGroup != "" {
89+ if ! d .Client .IsOnPremise && d .Client .AccountCreationGroup != "" {
9990 groupName := d .Client .AccountCreationGroup
10091 groups , _ , err := d .Client .Groups .ListGroups (& gitlabSDK.ListGroupsOptions {
10192 Search : & groupName ,
@@ -109,6 +100,11 @@ func (d *Connector) Validate(ctx context.Context) (annotations.Annotations, erro
109100 if len (groups ) == 0 {
110101 return nil , fmt .Errorf ("account creation group not found" )
111102 }
103+ } else {
104+ _ , _ , err := d .Client .ListGroups (ctx , "" )
105+ if err != nil {
106+ return nil , fmt .Errorf ("error listing groups: %w" , err )
107+ }
112108 }
113109
114110 return nil , nil
0 commit comments