mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 04:34:24 -07:00
* add module gitlab_branch
* Update plugins/modules/source_control/gitlab/gitlab_branch.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/source_control/gitlab/gitlab_branch.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/source_control/gitlab/gitlab_branch.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update gitlab_branch.py
* Update gitlab_branch.py
* Update gitlab_branch.py
* add integration tests
* Update BOTMETA.yml
* Update gitlab_branch.py
* Update tests/integration/targets/gitlab_branch/aliases
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update main.yml
Co-authored-by: paitrault <aymeric.paitrault@inetum.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c69e4f4ac9
)
Co-authored-by: paytroff <paytroff@gmail.com>
This commit is contained in:
parent
d9e2d6682b
commit
c495d136fa
6 changed files with 256 additions and 0 deletions
64
tests/integration/targets/gitlab_branch/tasks/main.yml
Normal file
64
tests/integration/targets/gitlab_branch/tasks/main.yml
Normal file
|
@ -0,0 +1,64 @@
|
|||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: Install required libs
|
||||
pip:
|
||||
name: python-gitlab
|
||||
state: present
|
||||
|
||||
- name: Create {{ gitlab_project_name }}
|
||||
gitlab_project:
|
||||
server_url: "{{ gitlab_host }}"
|
||||
validate_certs: False
|
||||
login_token: "{{ gitlab_login_token }}"
|
||||
name: "{{ gitlab_project_name }}"
|
||||
initialize_with_readme: True
|
||||
state: present
|
||||
|
||||
- name: Create branch {{ gitlab_branch }}
|
||||
community.general.gitlab_branch:
|
||||
api_url: https://gitlab.com
|
||||
api_token: secret_access_token
|
||||
project: "{{ gitlab_project_name }}"
|
||||
branch: "{{ gitlab_branch }}"
|
||||
ref_branch: main
|
||||
state: present
|
||||
|
||||
- name: Create branch {{ gitlab_branch }} ( Idempotency test )
|
||||
community.general.gitlab_branch:
|
||||
api_url: https://gitlab.com
|
||||
api_token: secret_access_token
|
||||
project: "{{ gitlab_project_name }}"
|
||||
branch: "{{ gitlab_branch }}"
|
||||
ref_branch: main
|
||||
state: present
|
||||
register: create_branch
|
||||
|
||||
- name: Test module is idempotent
|
||||
assert:
|
||||
that:
|
||||
- create_branch is not changed
|
||||
|
||||
- name: Cleanup branch {{ gitlab_branch }}
|
||||
community.general.gitlab_branch:
|
||||
api_url: https://gitlab.com
|
||||
api_token: secret_access_token
|
||||
project: "{{ gitlab_project_name }}"
|
||||
branch: "{{ gitlab_branch }}"
|
||||
state: absent
|
||||
register: delete_branch
|
||||
|
||||
- name: Test module is idempotent
|
||||
assert:
|
||||
that:
|
||||
- delete_branch is changed
|
||||
|
||||
- name: Clean up {{ gitlab_project_name }}
|
||||
gitlab_project:
|
||||
server_url: "{{ gitlab_host }}"
|
||||
validate_certs: False
|
||||
login_token: "{{ gitlab_login_token }}"
|
||||
name: "{{ gitlab_project_name }}"
|
||||
state: absent
|
Loading…
Add table
Add a link
Reference in a new issue