Files
ansible/test/integration/targets/git/tasks/submodules.yml
Matt Davis 7fed9b06e0 [stable-2.18] forward ports of unsafe persistence fixes (#83922)
* [stable-2.17] Unsafe persistence (#82779)

* Ensure that unsafe is more difficult to lose [stable-2.16] (#82293)

* Ensure that unsafe is more difficult to lose

* Add Task.untemplated_args, and switch assert over to use it
* Don't use re in first_found, switch to using native string methods
* If nested templating results in unsafe, just error, don't continue

* ci_complete

(cherry picked from commit 270b39f6ff)

* Fix various issues in unsafe_proxy (#82326)

- Use str/bytes directly instead of text_type/binary_type
- Fix AnsibleUnsafeBytes.__str__ implementation
- Fix AnsibleUnsafeBytes.__format__ return type
- Remove invalid methods from AnsibleUnsafeBytes (casefold, format, format_map)
- Use `chars` instead of `bytes` to match stdlib naming
- Remove commented out code

(cherry picked from commit 59aa0145d2)

* Additional Unsafe fixes (#82376)

* Allow older pickle protocols to pickle unsafe classes. Fixes #82356

* Address issues when iterating or getting single index from AnsibleUnsafeBytes. Fixes #82375

* clog frag

(cherry picked from commit afe3fc184f)

* [stable-2.16] Enable directly using `AnsibleUnsafeText` with Python `pathlib` (#82510)

* Enable directly using `AnsibleUnsafeText` with Python `pathlib`. Fixes #82414

(cherry picked from commit c6a652c081)

* Prevent failures due to unsafe plugin name (#82759)

(cherry picked from commit 56f31126ad)

* Address issues from merge conflicts

---------

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
(cherry picked from commit 9e622ddb67)

* rewrite illegal templated conditional in find test

---------

Co-authored-by: Matt Martz <matt@sivel.net>
2024-09-23 15:20:59 -07:00

151 lines
4.3 KiB
YAML

#
# Submodule tests
#
# Repository A with submodules defined (repo_submodules)
# .gitmodules file points to Repository I
# Repository B forked from A that has newer commits (repo_submodules_newer)
# .gitmodules file points to Repository II instead of I
# .gitmodules file also points to Repository III
# Repository I for submodule1 (repo_submodule1)
# Has 1 file checked in
# Repository II forked from I that has newer commits (repo_submodule1_newer)
# Has 2 files checked in
# Repository III for a second submodule (repo_submodule2)
# Has 1 file checked in
- name: SUBMODULES | clear checkout_dir
file:
state: absent
path: "{{ checkout_dir }}"
- name: SUBMODULES | Test that clone without recursive does not retrieve submodules
git:
repo: "{{ repo_submodules }}"
version: 45c6c07ef10fd9e453d90207e63da1ce5bd3ae1e
dest: "{{ checkout_dir }}"
recursive: no
- name: SUBMODULES | List submodule1
command: 'ls -1a {{ checkout_dir }}/submodule1'
register: submodule1
- name: SUBMODULES | Ensure submodule1 is at the appropriate commit
assert:
that: 'submodule1.stdout_lines | length == 2'
- name: SUBMODULES | clear checkout_dir
file:
state: absent
path: "{{ checkout_dir }}"
- name: SUBMODULES | Test that clone with recursive retrieves submodules
git:
repo: "{{ repo_submodules }}"
dest: "{{ checkout_dir }}"
version: 45c6c07ef10fd9e453d90207e63da1ce5bd3ae1e
recursive: yes
- name: SUBMODULES | List submodule1
command: 'ls -1a {{ checkout_dir }}/submodule1'
register: submodule1
- name: SUBMODULES | Ensure submodule1 is at the appropriate commit
assert:
that: 'submodule1.stdout_lines | length == 4'
- name: SUBMODULES | Copy the checkout so we can run several different tests on it
command: 'cp -pr {{ checkout_dir }} {{ checkout_dir }}.bak'
- name: SUBMODULES | Test that update without recursive does not change submodules
git:
repo: "{{ repo_submodules }}"
version: d2974e4bbccdb59368f1d5eff2205f0fa863297e
dest: "{{ checkout_dir }}"
recursive: no
update: yes
track_submodules: yes
- name: SUBMODULES | List submodule1
command: 'ls -1a {{ checkout_dir }}/submodule1'
register: submodule1
- name: SUBMODULES | Stat submodule2
stat:
path: "{{ checkout_dir }}/submodule2"
register: submodule2
- name: SUBMODULES | List submodule2
command: ls -1a {{ checkout_dir }}/submodule2
register: submodule2
- name: SUBMODULES | Ensure both submodules are at the appropriate commit
assert:
that:
- 'submodule1.stdout_lines|length == 4'
- 'submodule2.stdout_lines|length == 2'
- name: SUBMODULES | Remove checkout dir
file:
state: absent
path: "{{ checkout_dir }}"
- name: SUBMODULES | Restore checkout to prior state
command: 'cp -pr {{ checkout_dir }}.bak {{ checkout_dir }}'
- name: SUBMODULES | Test that update with recursive updated existing submodules
git:
repo: "{{ repo_submodules }}"
version: d2974e4bbccdb59368f1d5eff2205f0fa863297e
dest: "{{ checkout_dir }}"
update: yes
recursive: yes
track_submodules: yes
- name: SUBMODULES | List submodule 1
command: 'ls -1a {{ checkout_dir }}/submodule1'
register: submodule1
- name: SUBMODULES | Ensure submodule1 is at the appropriate commit
assert:
that: 'submodule1.stdout_lines | length == 5'
- name: SUBMODULES | Test that update with recursive found new submodules
command: 'ls -1a {{ checkout_dir }}/submodule2'
register: submodule2
- name: SUBMODULES | Enusre submodule2 is at the appropriate commit
assert:
that: 'submodule2.stdout_lines | length == 4'
- name: SUBMODULES | clear checkout_dir
file:
state: absent
path: "{{ checkout_dir }}"
- name: SUBMODULES | Clone main submodule repository
git:
repo: "{{ repo_submodules }}"
dest: "{{ checkout_dir }}/test.gitdir"
version: 45c6c07ef10fd9e453d90207e63da1ce5bd3ae1e
recursive: yes
- name: SUBMODULES | Test that cloning submodule with .git in directory name works
git:
repo: "{{ repo_submodule1 }}"
dest: "{{ checkout_dir }}/test.gitdir/submodule1"
- name: SUBMODULES | List submodule1
command: 'ls -1a {{ checkout_dir }}/test.gitdir/submodule1'
register: submodule1
- name: SUBMODULES | Ensure submodule1 is at the appropriate commit
assert:
that: 'submodule1.stdout_lines | length == 4'