Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group membership fails to apply when using keep_bots attribute #553

Closed
SachinKSingh28 opened this issue Jun 14, 2023 · 5 comments · Fixed by #554
Closed

Group membership fails to apply when using keep_bots attribute #553

SachinKSingh28 opened this issue Jun 14, 2023 · 5 comments · Fixed by #554

Comments

@SachinKSingh28
Copy link
Contributor

SachinKSingh28 commented Jun 14, 2023

Description

Following fails to apply group membership -

config_version: 3
gitlab:
  ssl_verify: true
  timeout: 2
projects_and_groups:
  "GroupA/GroupB/*":
    group_members:
      keep_bots: true
      enforce: true
      groups:
        xx/users-reporter:
          group_access: reporter
        yy/users-guest:
          group_access: guest

Use following command to replicate this issue -

gitlabform -c above-config.yaml GroupA/GroupB/GroupC -os group_settings,group_members

I'm getting below error message -

🏗 GitLabForm version: 3.6.0 = the latest stable 😊
Warning: Connected as non-admin. You may encounter permission issues.
>>> Getting requested groups or projects...
:: # of groups to process: 1
:: # of projects to process: 0
@ (1/1) Processing group: GroupA/GroupB/GroupC 
Warning: Error occurred while processing group GroupA/GroupB/GroupC, exception:

'bool' object is not subscriptable
:: # of groups processed successfully: 0
:: # of projects processed successfully: 0
:: # of groups failed: 1 
:: Failed group 1: GroupA/GroupB/GroupC

On debugging it seems the user list for group membership had following item -

keep_bots: true

Gitlabform version

% gitlabform --version                                                                                  
🏗 GitLabForm version: 3.6.0 = the latest stable 😊

Gitlab version

GitLab Enterprise Edition 16.1.0-pre c5ac07d12dc

@amimas
Copy link
Collaborator

amimas commented Jun 15, 2023

Use following command to replicate this issue -

gitlabform -c above-config.yaml GroupA/GroupB/GroupC -os group_settings,group_members

What does the -os parameter do? I'm not familiar with it. Not sure if I'm forgetting something or missed a new feature release recently.

@SachinKSingh28
Copy link
Contributor Author

Use following command to replicate this issue -

gitlabform -c above-config.yaml GroupA/GroupB/GroupC -os group_settings,group_members

What does the -os parameter do? I'm not familiar with it. Not sure if I'm forgetting something or missed a new feature release recently.

@amimas -os is only-sections allowing one to just apply specific configuration blocks. We use this to fill the gap in recursive group settings apply. Ref - #509 (comment)

@amimas
Copy link
Collaborator

amimas commented Jun 23, 2023

Thanks for clarifying. Not sure if I missed it or not, but couldn't find that option in the docs. But, I found the option in the code:

parser.add_argument(
"-os",
"--only-sections",
dest="only_sections",
default="all",
type=str,
help="process only section with these names (comma-delimited)",
)

Can you try it without that argument? Use ALL_DEFINED instead:

gitlabform -c above-config.yaml ALL_DEFINED

I know there were issues reported previously where things are processed properly with the above command but doesn't work if ran it differently. Not sure if that's been fixed. Curious if it's a similar bug like that.

@long-wan-ep
Copy link
Contributor

long-wan-ep commented Jul 5, 2023

We are also seeing this error after upgrading to 3.6.0 and adding keep_bots: true to our group_members/members blocks. It only seems to happen to nested groups(ie. GroupA/GroupB/*) and works fine for top level groups(ie. GroupA/*).

Also, when we ran gitlabform with --noop, everything was working and the generated yaml output looked correct. When we ran without --noop we got the error and the group_member blocks were missing in the generated output.

Edit: nvm, looks like the problem has already been identified and there's a MR open.

@gdubicki
Copy link
Member

Released in v3.7.0 a moment ago. Thank you again for your contribution, @SachinKSingh28! 🤝

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 a pull request may close this issue.

4 participants