mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 05:51:43 -07:00
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* Add yamllint to CI. * Fix more YAML booleans.
79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
- name: Prepare the test environment
|
|
include_tasks: pre.yml
|
|
vars:
|
|
output_dir: "{{ playbook_dir }}/generated"
|
|
|
|
- name: Generate token
|
|
community.general.jenkins_credential:
|
|
name: "test-token"
|
|
jenkins_user: "{{ jenkins_username }}"
|
|
jenkins_password: "{{ jenkins_password }}"
|
|
type: "token"
|
|
no_log: true
|
|
register: token_result
|
|
|
|
- name: Assert token and tokenUuid are returned
|
|
assert:
|
|
that:
|
|
- token_result.token is defined
|
|
- token_result.token_uuid is defined
|
|
fail_msg: "Token generation failed"
|
|
success_msg: "Token and tokenUuid successfully returned"
|
|
|
|
- name: Set token facts
|
|
set_fact:
|
|
token: "{{ token_result.token }}"
|
|
tokenUuid: "{{ token_result.token_uuid }}"
|
|
|
|
- name: Test adding new credentials and scopes
|
|
include_tasks: add.yml
|
|
vars:
|
|
run_number: 1
|
|
output_dir: "{{ playbook_dir }}/generated"
|
|
|
|
- name: Test adding credentials and scopes when they already exist
|
|
include_tasks: add.yml
|
|
vars:
|
|
run_number: 2
|
|
output_dir: "{{ playbook_dir }}/generated"
|
|
|
|
- name: Test editing credentials
|
|
include_tasks: edit.yml
|
|
vars:
|
|
output_dir: "{{ playbook_dir }}/generated"
|
|
|
|
- name: Test deleting credentials and scopes
|
|
include_tasks: del.yml
|
|
vars:
|
|
run_number: 1
|
|
|
|
- name: Test deleting credentials and scopes when they don't exist
|
|
include_tasks: del.yml
|
|
vars:
|
|
run_number: 2
|
|
|
|
- name: Delete token
|
|
community.general.jenkins_credential:
|
|
id: "{{ tokenUuid }}"
|
|
name: "test-token-2"
|
|
jenkins_user: "{{ jenkins_username }}"
|
|
jenkins_password: "{{ jenkins_password }}"
|
|
state: "absent"
|
|
type: "token"
|
|
register: delete_token_result
|
|
|
|
- name: Assert token deletion
|
|
assert:
|
|
that:
|
|
- delete_token_result.changed is true
|
|
fail_msg: "Token deletion failed"
|
|
success_msg: "Token successfully deleted"
|
|
|
|
- name: Remove generated test files
|
|
ansible.builtin.file:
|
|
path: "{{ playbook_dir }}/generated"
|
|
state: absent
|