community / community.general / 8.5.0 / module / gitlab_merge_request Create, update, or delete GitLab merge requests | "added in version" 7.1.0 of community.general" Authors: zvaraondrej (@zvaraondrej)community.general.gitlab_merge_request (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Creates a merge request if it does not exist.
When a single merge request does exist, it will be updated if the provided parameters are different.
When a single merge request does exist and O(state=absent), the merge request will be deleted.
When multiple merge requests are detected, the task fails.
Existing merge requests are matched based on O(title), O(source_branch), O(target_branch), and O(state_filter) filters.
- name: Create Merge Request from branch1 to branch2 community.general.gitlab_merge_request: api_url: https://gitlab.com api_token: secret_access_token project: "group1/project1" source_branch: branch1 target_branch: branch2 title: "Ansible demo MR" description: "Demo MR description" labels: "Ansible,Demo" state_filter: "opened" remove_source_branch: True state: present
- name: Delete Merge Request from branch1 to branch2 community.general.gitlab_merge_request: api_url: https://gitlab.com api_token: secret_access_token project: "group1/project1" source_branch: branch1 target_branch: branch2 title: "Ansible demo MR" state_filter: "opened" state: absent
state: choices: - present - absent default: present description: - Create or delete merge request. type: str title: description: - A title for the merge request. required: true type: str labels: default: '' description: - Comma separated list of label names. type: str api_url: description: - The resolvable endpoint for the API. type: str ca_path: description: - The CA certificates bundle to use to verify GitLab server certificate. type: str version_added: 8.1.0 version_added_collection: community.general project: description: - The path or name of the project. required: true type: str api_token: description: - GitLab access token with API permissions. type: str description: description: - A description for the merge request. - Gets overridden by a content of file specified at O(description_path), if found. type: str api_password: description: - The password to use for authentication against the API. type: str api_username: description: - The username to use for authentication against the API. type: str assignee_ids: description: - Comma separated list of assignees usernames omitting V(@) character. - Set to empty string to unassign all assignees. type: str reviewer_ids: description: - Comma separated list of reviewers usernames omitting V(@) character. - Set to empty string to unassign all reviewers. type: str state_filter: choices: - opened - closed - locked - merged default: opened description: - Filter specifying state of merge requests while searching. type: str api_job_token: description: - GitLab CI job token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general source_branch: description: - Merge request's source branch. - Ignored while updating existing merge request. required: true type: str target_branch: description: - Merge request's target branch. required: true type: str validate_certs: default: true description: - Whether or not to validate SSL certs when supplying a HTTPS endpoint. type: bool api_oauth_token: description: - GitLab OAuth token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general description_path: description: - A path of file containing merge request's description. - Accepts MarkDown formatted files. type: path remove_source_branch: default: false description: - Flag indicating if a merge request should remove the source branch when merging. type: bool
mr: description: API object. returned: success type: dict msg: description: Success or failure message. returned: always sample: Success type: str