From 95e69124af848a4dd253ccb47f40821c23666b79 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 2 Jun 2020 11:39:35 -0400 Subject: [PATCH] Also download roles/collections during the sync job Since we're writing into a per-revision cache, we can do this easily now. --- awx/main/models/projects.py | 5 ++--- awx/playbooks/project_update.yml | 21 ++++++++------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/awx/main/models/projects.py b/awx/main/models/projects.py index 83154700c9..fbfea3b61b 100644 --- a/awx/main/models/projects.py +++ b/awx/main/models/projects.py @@ -604,9 +604,8 @@ class ProjectUpdate(UnifiedJob, ProjectOptions, JobNotificationMixin, TaskManage added_update_fields = [] if not self.job_tags: job_tags = ['update_{}'.format(self.scm_type)] - if self.job_type == 'run': - job_tags.append('install_roles') - job_tags.append('install_collections') + job_tags.append('install_roles') + job_tags.append('install_collections') self.job_tags = ','.join(job_tags) added_update_fields.append('job_tags') if self.scm_delete_on_update and 'delete' not in self.job_tags and self.job_type == 'check': diff --git a/awx/playbooks/project_update.yml b/awx/playbooks/project_update.yml index d1c96d1f0a..84b03fa109 100644 --- a/awx/playbooks/project_update.yml +++ b/awx/playbooks/project_update.yml @@ -110,17 +110,14 @@ - update_svn - update_insights -- hosts: localhost - gather_facts: false - connection: local - name: Install content with ansible-galaxy command if necessary - tasks: + - name: Set content cache location + set_fact: + cache_dir: "{{ project_cache }}/{{ scm_version|default(scm_branch) }}" + tags: + - install_collections + - install_roles - block: - - name: set content cache location - set_fact: - cache_dir: "{{ project_cache }}/{{ scm_branch }}" - - name: detect requirements.yml stat: path: '{{project_path|quote}}/roles/requirements.yml' @@ -141,16 +138,13 @@ synchronize: src: "{{ cache_dir }}/requirements_roles" dest: "{{ roles_destination }}" + when: roles_destination is defined when: roles_enabled|bool tags: - install_roles - block: - - name: set content cache location - set_fact: - cache_dir: "{{ project_cache }}/{{ scm_branch }}" - - name: detect collections/requirements.yml stat: path: '{{project_path|quote}}/collections/requirements.yml' @@ -172,6 +166,7 @@ synchronize: src: "{{ cache_dir }}/requirements_collections" dest: "{{ collections_destination }}" + when: collections_destination is defined when: - "ansible_version.full is version_compare('2.8', '>=')"