mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
c69e4f4ac9
* 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>
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
####################################################################
|
|
# 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
|