1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #5706/58eb4957 backport][stable-6] Fixes #5691. Support gitlab forking_access_level, builds_access_level and container_registry_access_level fields (#5828)

Fixes #5691. Support gitlab forking_access_level, builds_access_level and container_registry_access_level fields (#5706)

* Fixes #5691. Support gitlab forking_access_level, builds_access_level and container_registry_access_level fields

* Add changelog fragment

* Fix revision issues

(cherry picked from commit 58eb495797)

Co-authored-by: Juan Antonio Valiño García <juanval@edu.xunta.es>
This commit is contained in:
patchback[bot] 2023-01-12 21:56:18 +01:00 committed by GitHub
parent 91cca4ae49
commit 559c914e36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- gitlab_project - add ``builds_access_level``, ``container_registry_access_level`` and ``forking_access_level`` options (https://github.com/ansible-collections/community.general/pull/5706).

View file

@ -172,6 +172,30 @@ options:
- This option is only used on creation, not for updates. This is also only used if I(initialize_with_readme=true).
type: str
version_added: "4.2.0"
builds_access_level:
description:
- C(private) means that repository CI/CD is allowed only to project members.
- C(disabled) means that repository CI/CD is disabled.
- C(enabled) means that repository CI/CD is enabled.
type: str
choices: ["private", "disabled", "enabled"]
version_added: "6.2.0"
forking_access_level:
description:
- C(private) means that repository forks is allowed only to project members.
- C(disabled) means that repository forks are disabled.
- C(enabled) means that repository forks are enabled.
type: str
choices: ["private", "disabled", "enabled"]
version_added: "6.2.0"
container_registry_access_level:
description:
- C(private) means that container registry is allowed only to project members.
- C(disabled) means that container registry is disabled.
- C(enabled) means that container registry is enabled.
type: str
choices: ["private", "disabled", "enabled"]
version_added: "6.2.0"
'''
EXAMPLES = r'''
@ -287,6 +311,9 @@ class GitLabProject(object):
'squash_option': options['squash_option'],
'ci_config_path': options['ci_config_path'],
'shared_runners_enabled': options['shared_runners_enabled'],
'builds_access_level': options['builds_access_level'],
'forking_access_level': options['forking_access_level'],
'container_registry_access_level': options['container_registry_access_level'],
}
# Because we have already call userExists in main()
if self.project_object is None:
@ -417,6 +444,9 @@ def main():
ci_config_path=dict(type='str'),
shared_runners_enabled=dict(type='bool'),
avatar_path=dict(type='path'),
builds_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
forking_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
container_registry_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
))
module = AnsibleModule(
@ -464,6 +494,9 @@ def main():
shared_runners_enabled = module.params['shared_runners_enabled']
avatar_path = module.params['avatar_path']
default_branch = module.params['default_branch']
builds_access_level = module.params['builds_access_level']
forking_access_level = module.params['forking_access_level']
container_registry_access_level = module.params['container_registry_access_level']
if default_branch and not initialize_with_readme:
module.fail_json(msg="Param default_branch need param initialize_with_readme set to true")
@ -533,6 +566,9 @@ def main():
"ci_config_path": ci_config_path,
"shared_runners_enabled": shared_runners_enabled,
"avatar_path": avatar_path,
"builds_access_level": builds_access_level,
"forking_access_level": forking_access_level,
"container_registry_access_level": container_registry_access_level,
}):
module.exit_json(changed=True, msg="Successfully created or updated the project %s" % project_name, project=gitlab_project.project_object._attrs)