summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/git/tasks/forcefully-fetch-tag.yml
blob: 47c37478b09cb557367031763b7c095cda0a05e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Tests against https://github.com/ansible/ansible/issues/67972

# Do our first clone manually; there are no commits yet and Ansible doesn't like
# that.
- name: FORCEFULLY-FETCH-TAG | Clone the bare repo in a non-bare clone
  shell: git clone {{ repo_dir }}/tag_force_push {{ repo_dir }}/tag_force_push_clone1

- name: FORCEFULLY-FETCH-TAG | Prepare repo with a tag
  shell: |
    echo 1337 > leet;
    git add leet;
    git commit -m uh-oh;
    git tag -f herewego;
    git push --tags origin master
  args:
    chdir: "{{ repo_dir }}/tag_force_push_clone1"

- name: FORCEFULLY-FETCH-TAG | clone the repo for the second time
  git:
    repo: "{{ repo_dir }}/tag_force_push"
    dest: "{{ repo_dir }}/tag_force_push_clone2"

- name: FORCEFULLY-FETCH-TAG | Forcefully overwrite the tag in clone1
  shell: |
    echo 1338 > leet;
    git add leet;
    git commit -m uh-oh;
    git tag -f herewego;
    git push -f --tags origin master
  args:
    chdir: "{{ repo_dir }}/tag_force_push_clone1"

- name: FORCEFULLY-FETCH-TAG | Try to update the second clone
  git:
    repo: "{{ repo_dir }}/tag_force_push"
    dest: "{{ repo_dir }}/tag_force_push_clone2"
    force: yes
  register: git_res