Add environment scope on gitlab project variables (#1197)

* add environment scope on gitlab project variables

* fix sanity code

* apply again test

* environment_scope not defined by default. compatible with old versions of lib.

* environment_scope must be optional

* add changelog

* Update changelogs/fragments/1197_gitlab_project_variable.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Pablo Castorino 2021-01-18 03:54:43 -03:00 committed by GitHub
commit 52bb601f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 10 deletions

View file

@ -218,6 +218,36 @@
that:
- gitlab_project_variable_state is not changed
- name: change environment scope
gitlab_project_variable:
api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_login_token }}"
project: "{{ gitlab_project_name }}"
vars:
ACCESS_KEY_ID:
environment_scope: testing
register: gitlab_project_variable_state
- name: state must be changed
assert:
that:
- gitlab_project_variable_state is changed
- name: apply again the environment scope change
gitlab_project_variable:
api_url: "{{ gitlab_host }}"
api_token: "{{ gitlab_login_token }}"
project: "{{ gitlab_project_name }}"
vars:
ACCESS_KEY_ID:
environment_scope: testing
register: gitlab_project_variable_state
- name: state must not be changed
assert:
that:
- gitlab_project_variable_state is not changed
- name: purge all variables at the beginning
gitlab_project_variable:
api_url: "{{ gitlab_host }}"