-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone_repo.yml
36 lines (36 loc) · 1.57 KB
/
clone_repo.yml
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
- hosts: all
tasks:
- name: show parameters coming from github
debug:
msg: "Request coming from github: |
actor: {{ github_actor | default('undefined') }}
repo: {{ github_repository | default('undefined') }}
workflow: {{ github_workflow | default('undefined') }} workspace: {{ github_workspace | default('undefined') }} event_name: {{ github_event_name | default('undefined') }} event_path: {{ github_event_path | default('undefined') }}
sha: {{ github_sha | default('undefined') }}
ref: {{ github_ref | default('undefined') }}
head_ref: {{ github_head_ref | default('undefined') }}
base_ref: {{ github_base_ref | default('undefined')}}
server_url: {{ github_server_url | default('undefined')}}
"
- fail:
msg: Server URL is not authorized to run this job.
when: github_server_url != "https://github.com"
- fail:
msg: Repository is not authorized to run this job.
when: not "scaphandre" in github_repository
#- name: clean old scaphandre local clone
# file:
# path: "{{ SCAPHANDRE_PATH }}"
# state: absent
# recurse: yes
- name: clean old scaphandre local clone
shell: rm -Rf /root/scaphandre-dev
- name: scaphandre repository cloned
git:
clone: yes
update: yes
force: yes
repo: "https://github.com/{{ github_repository | default('hubblo-org/scaphandre') }}.git"
version: "{{ github_sha }}"
refspec: "{{ github_ref }}"
dest: "{{ SCAPHANDRE_PATH }}"