mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
skip reprepro when commit already registered
This commit is contained in:
committed by
Dan Christian Bogos
parent
a394c728c0
commit
0fbbc83e97
@@ -187,19 +187,26 @@
|
||||
file_type: file
|
||||
register: package_files
|
||||
|
||||
- name: Copy package files to incoming directory
|
||||
- name: Move package files to incoming directory
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.path }}"
|
||||
dest: "{{ reprepro_basedir }}/incoming/"
|
||||
remote_src: true
|
||||
ansible.builtin.command: mv {{ item.path }} {{ reprepro_basedir }}/incoming/
|
||||
args:
|
||||
creates: "{{ reprepro_basedir }}/incoming/{{ item.path | basename }}"
|
||||
removes: "{{ item.path }}"
|
||||
with_items: "{{ package_files.files }}"
|
||||
when: package_files.matched > 0
|
||||
|
||||
- name: Get current git commit hash
|
||||
ansible.builtin.command: git log -n1 --format=format:%h HEAD
|
||||
args:
|
||||
chdir: "{{ cgrates_dir }}"
|
||||
register: git_commit_hash
|
||||
changed_when: false
|
||||
|
||||
- name: Check if packages already in reprepro
|
||||
become: true
|
||||
ansible.builtin.shell: |
|
||||
reprepro -b {{ reprepro_basedir }} list {{ cgrates_branch }}-{{ item.codename }} 2>/dev/null | grep -q cgrates
|
||||
reprepro -b {{ reprepro_basedir }} list {{ cgrates_branch }}-{{ item.codename }} 2>/dev/null | grep -q "{{ git_commit_hash.stdout }}"
|
||||
register: reprepro_check
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
@@ -237,13 +244,7 @@
|
||||
- cgrates_branch == 'master' or git_tag_result.stdout_lines | length > 0
|
||||
|
||||
- name: Copy the file to PKG server
|
||||
ansible.builtin.command: "scp {{ item.path }} {{ pkgAddr }}:/tmp/"
|
||||
with_items: "{{ package_files.files }}"
|
||||
|
||||
- name: Remove package files after successful sync
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
ansible.builtin.command: "scp {{ reprepro_basedir }}/incoming/{{ item.path | basename }} {{ pkgAddr }}:/tmp/"
|
||||
with_items: "{{ package_files.files }}"
|
||||
|
||||
rescue:
|
||||
@@ -307,6 +308,14 @@
|
||||
path: "{{ reprepro_basedir }}/incoming"
|
||||
state: absent
|
||||
|
||||
- name: Remove leftover package files
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_fileglob:
|
||||
- "/home/{{ user }}/go/src/github.com/cgrates/cgrates_*"
|
||||
- "/home/{{ user }}/go/src/github.com/cgrates/cgrates-dbgsym_*"
|
||||
|
||||
- hosts: pkg
|
||||
vars:
|
||||
nginx_user: "www-data"
|
||||
|
||||
Reference in New Issue
Block a user