From 21762def7247f48c9af99ae0c1a189ae2d77b04c Mon Sep 17 00:00:00 2001 From: TeoV Date: Tue, 7 Apr 2020 10:51:00 +0300 Subject: [PATCH] Clean the cache and modcache for ansible before building CGRateS --- data/ansible/deb_packages/main.yaml | 20 ++++++++++++++++++++ data/ansible/docker/main.yaml | 20 ++++++++++++++++++++ data/ansible/rpm_packages/main.yaml | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/data/ansible/deb_packages/main.yaml b/data/ansible/deb_packages/main.yaml index 243cd8394..a3124df94 100644 --- a/data/ansible/deb_packages/main.yaml +++ b/data/ansible/deb_packages/main.yaml @@ -138,6 +138,26 @@ become: yes become_user: "{{ gouser }}" + - name: clean go cache + become: yes + shell: "go clean --cache" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + + - name: clean go modcache + become: yes + shell: "go clean --modcache" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + + - name: sync the go mod with vendor + become: yes + shell: "go mod vendor" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + args: + chdir: '{{ cgrates_dir }}' + - name: build cgrates shell: "sh {{ cgrates_dir }}/build.sh" environment: diff --git a/data/ansible/docker/main.yaml b/data/ansible/docker/main.yaml index b5ccb7025..b1ba30023 100644 --- a/data/ansible/docker/main.yaml +++ b/data/ansible/docker/main.yaml @@ -118,6 +118,26 @@ become: yes become_user: "{{ gouser }}" + - name: clean go cache + become: yes + shell: "go clean --cache" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + + - name: clean go modcache + become: yes + shell: "go clean --modcache" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + + - name: sync the go mod with vendor + become: yes + shell: "go mod vendor" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + args: + chdir: '{{ cgrates_dir }}' + - name: build cgrates for docker shell: "sh {{ cgrates_dir }}/data/docker/scratch/build.sh" environment: diff --git a/data/ansible/rpm_packages/main.yaml b/data/ansible/rpm_packages/main.yaml index cba254b01..201266bc4 100644 --- a/data/ansible/rpm_packages/main.yaml +++ b/data/ansible/rpm_packages/main.yaml @@ -171,6 +171,26 @@ become: yes become_user: "{{ gouser }}" + - name: clean go cache + become: yes + shell: "go clean --cache" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + + - name: clean go modcache + become: yes + shell: "go clean --modcache" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + + - name: sync the go mod with vendor + become: yes + shell: "go mod vendor" + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" + args: + chdir: '{{ cgrates_dir }}' + - name: build cgrates shell: "sh {{ cgrates_dir }}/build.sh" environment: