-
Notifications
You must be signed in to change notification settings - Fork 90
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
Resource Groups - don't fail if key not exist #649
Comments
Yes that can be useful. Do you have any suggestion for the config syntax? Will you be able to help contribute this feature? |
@amimas Something like an optional attribute projects_and_groups:
group_1/project_1:
resource_groups:
staging:
process_mode: oldest_first
production:
process_mode: newest_first
resource_group_that_dont_exist:
process_mode: newest_first
fail_if_not_exist: false |
Hi @philippe-granet - thanks for the suggestion. Does the optional attribute need to be for each resource group? What if it's a direct child key of One of the design patterns gitlabform follows is raw parameter passing. So if gitlab adds/updates any attributes to the api for managing individual resource group, you can simply add that in the config without waiting for gitlabform to add support for it. See this doc: https://github.com/gitlabform/gitlabform/blob/main/docs/reference/index.md#raw-parameters-passing That's why I think it's best to not add the optional attribute under specific resource group and I don't see any significant benefit that way either. What do you think? If you agree, the revised config proposal could be like this: projects_and_groups:
group_1/project_1:
resource_groups:
fail_if_not_exist: false
staging:
process_mode: oldest_first
production:
process_mode: newest_first
resource_group_that_dont_exist:
process_mode: newest_first
Also, a minor feedback: I wonder if the optional attribute can have a different name. It feels too verbose or unclear why it's needed unless the author is famiar with Gitlab's behaviour. I can't think of a suggestion either. |
@amimas ok for direct child key of
Our case is similar, we want to fail (or not) when trying to process a non-existent resource group. For the name, yes I think we could find a better name. Some propositions:
|
Good call about the I think I like it as a config key instead of CLI parameter. That way source of truth is in the config file as opposed to how it was executed. But that may not help everyone. I like how renovate manages all their options. Every configuration is available as CLI parameter, or config key, or environment variable. Also I think it can be expected that you may want one config to be strict while other one is not. So, CLI probably isn't the best. What do you think? Gitlabform doesn't do this yet, but maybe here If we don't go with It'd be goood to get some feedback from @gdubicki as he created the tool and may have more insights. |
@philippe-granet - thoughts on the above ☝️ ? @jimisola - what do you think? |
I ended up in the deep end directly here. FYI, I'm not really familiar with the code base of gitlabform. @gdubicki was "kind" and trusted me after I spent quite some time on the structure of our next version on the yaml configuration. I think the solution that you two have come up with is good enough (direct child key of resource_groups). That said, I never used resource groups and I'm trying to understand the actual problem. Why is an 404 error returned by GitLab API when the resource group does not exist? I thought that the resource groups are created for project_1 using:
But, as I understand it - if resource_group_that_dont_exist does not exist for project_1 then an 404 error is returned. So, my question is then: where are the resource groups defined? Does the resource group have to match the environment in jobs for project_1? |
@jimisola - The resource group is only created when it's used in a project's Right now processing mode can only be set via API. That's why when trying to configure/set a resource group's "processing mode" it has to first exist; otherwise you get 404 not found error. |
@philippe-granet - are you able to continue with this based on above discussion? |
feat: fix acceptance test feat: black format feat: delete test file feat: delete test file fix: add config and modify docker shellscript fix: add saml config chore: remove mypy pre-commit - in pre-commit it is run in isolated environment - often has issues with python-gitlab types - wants to scan everything not just changed files - quickly becoming a hinderance not a help Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk> feat: add option to not fail if configured resource group does not exist (gitlabform#650) Fix gitlabform#649 Co-authored-by: amimas <aver.mimas@gmail.com> fix: review comments
I have hundred of Gitab projects, some of them have a ressource group name 'bot-pipeline', but lots of them don't.
And declare in config.yml all projects that have this group name is cumbersome.
Is it possible to add an option on Resource groups to skip Gitlab projects for which a ressource group key defined in config.yml doesn't exist (ignore 404 error returned by Gitlab API)?
The text was updated successfully, but these errors were encountered: