diff --git a/awx/api/serializers.py b/awx/api/serializers.py
index 93793a90f233..57090f7c7e39 100644
--- a/awx/api/serializers.py
+++ b/awx/api/serializers.py
@@ -1350,6 +1350,7 @@ class Meta:
'scm_branch',
'scm_refspec',
'scm_clean',
+ 'scm_track_submodules',
'scm_delete_on_update',
'credential',
'timeout',
@@ -1497,7 +1498,7 @@ def get_field_from_model_or_attrs(fd):
)
if get_field_from_model_or_attrs('scm_type') == '':
- for fd in ('scm_update_on_launch', 'scm_delete_on_update', 'scm_clean'):
+ for fd in ('scm_update_on_launch', 'scm_delete_on_update', 'scm_track_submodules', 'scm_clean'):
if get_field_from_model_or_attrs(fd):
raise serializers.ValidationError({fd: _('Update options must be set to false for manual projects.')})
return super(ProjectSerializer, self).validate(attrs)
diff --git a/awx/main/migrations/0136_scm_track_submodules.py b/awx/main/migrations/0136_scm_track_submodules.py
new file mode 100644
index 000000000000..132dc63636f0
--- /dev/null
+++ b/awx/main/migrations/0136_scm_track_submodules.py
@@ -0,0 +1,37 @@
+# Generated by Django 2.2.16 on 2021-02-02 14:41
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+<<<<<<< HEAD:awx/main/migrations/0136_scm_track_submodules.py
+ ('main', '0135_schedule_sort_fallback_to_id'),
+=======
+ ('main', '0131_undo_org_polymorphic_ee'),
+>>>>>>> Update and rename 0124_scm_track_submodules.py to 0132_scm_track_submodules.py:awx/main/migrations/0132_scm_track_submodules.py
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='Project',
+ name='scm_track_submodules',
+ field=models.BooleanField(help_text='Track submodule latest commit on specified branch.'),
+ ),
+ migrations.AddField(
+ model_name='ProjectUpdate',
+ name='scm_track_submodules',
+ field=models.BooleanField(help_text='Track submodule latest commit on specified branch.'),
+ ),
+ migrations.AlterField(
+ model_name='project',
+ name='scm_track_submodules',
+ field=models.BooleanField(default=False, help_text='Track submodules latest commits on defined branch.'),
+ ),
+ migrations.AlterField(
+ model_name='projectupdate',
+ name='scm_track_submodules',
+ field=models.BooleanField(default=False, help_text='Track submodules latest commits on defined branch.'),
+ ),
+ ]
diff --git a/awx/main/models/projects.py b/awx/main/models/projects.py
index b510a1b0205f..2125080bfb19 100644
--- a/awx/main/models/projects.py
+++ b/awx/main/models/projects.py
@@ -115,6 +115,10 @@ def get_local_path_choices(cls):
default=False,
help_text=_('Delete the project before syncing.'),
)
+ scm_track_submodules = models.BooleanField(
+ default=False,
+ help_text=_('Track submodules latest commits on defined branch.'),
+ )
credential = models.ForeignKey(
'Credential',
related_name='%(class)ss',
diff --git a/awx/main/tasks.py b/awx/main/tasks.py
index a154f222dad0..d23499abab11 100644
--- a/awx/main/tasks.py
+++ b/awx/main/tasks.py
@@ -2026,6 +2026,7 @@ def build_extra_vars_file(self, project_update, private_data_dir):
'scm_url': scm_url,
'scm_branch': scm_branch,
'scm_clean': project_update.scm_clean,
+ 'scm_track_submodules': project_update.scm_track_submodules,
'roles_enabled': galaxy_creds_are_defined and settings.AWX_ROLES_ENABLED,
'collections_enabled': galaxy_creds_are_defined and settings.AWX_COLLECTIONS_ENABLED,
}
diff --git a/awx/playbooks/project_update.yml b/awx/playbooks/project_update.yml
index e00bed4249b6..092cfd0467d8 100644
--- a/awx/playbooks/project_update.yml
+++ b/awx/playbooks/project_update.yml
@@ -12,6 +12,7 @@
# scm_password: password (only for svn/insights)
# scm_accept_hostkey: true/false (only for git, set automatically)
# scm_refspec: a refspec to fetch in addition to obtaining version
+# scm_track_submodules: true/false
# roles_enabled: Value of the global setting to enable roles downloading
# collections_enabled: Value of the global setting to enable collections downloading
# awx_version: Current running version of the awx or tower as a string
@@ -36,6 +37,7 @@
version: "{{scm_branch|quote}}"
refspec: "{{scm_refspec|default(omit)}}"
force: "{{scm_clean}}"
+ track_submodules: "{{scm_track_submodules|default(omit)}}"
accept_hostkey: "{{scm_accept_hostkey|default(omit)}}"
register: git_result
diff --git a/awx/ui_next/src/components/PromptDetail/PromptProjectDetail.jsx b/awx/ui_next/src/components/PromptDetail/PromptProjectDetail.jsx
index 0ab2d6d31f66..f47045aee34c 100644
--- a/awx/ui_next/src/components/PromptDetail/PromptProjectDetail.jsx
+++ b/awx/ui_next/src/components/PromptDetail/PromptProjectDetail.jsx
@@ -18,6 +18,7 @@ function PromptProjectDetail({ i18n, resource }) {
scm_branch,
scm_clean,
scm_delete_on_update,
+ scm_track_submodules,
scm_refspec,
scm_type,
scm_update_on_launch,
@@ -30,6 +31,7 @@ function PromptProjectDetail({ i18n, resource }) {
if (
scm_clean ||
scm_delete_on_update ||
+ scm_track_submodules ||
scm_update_on_launch ||
allow_override
) {
@@ -39,6 +41,11 @@ function PromptProjectDetail({ i18n, resource }) {
{scm_delete_on_update && (
{i18n._(t`Delete on Update`)}
)}
+ {scm_track_submodules && (
+
+ {i18n._(t`Track submodules latest commit on branch`)}
+
+ )}
{scm_update_on_launch && (
{i18n._(t`Update Revision on Launch`)}
)}
diff --git a/awx/ui_next/src/components/PromptDetail/data.project.json b/awx/ui_next/src/components/PromptDetail/data.project.json
index 24ed7ff1a62d..371cc1d088d2 100644
--- a/awx/ui_next/src/components/PromptDetail/data.project.json
+++ b/awx/ui_next/src/components/PromptDetail/data.project.json
@@ -96,6 +96,7 @@
"scm_refspec":"refs/",
"scm_clean":true,
"scm_delete_on_update":true,
+ "scm_track_submodules":false,
"credential":9,
"timeout":0,
"scm_revision":"",
@@ -111,4 +112,4 @@
"last_update_failed":false,
"last_updated":"2020-03-11T20:18:14Z",
"default_environment": 1
-}
\ No newline at end of file
+}
diff --git a/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx b/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx
index 76bfd492567e..2d7975e1490a 100644
--- a/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx
+++ b/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx
@@ -18,6 +18,7 @@ describe('', () => {
scm_type: 'git',
scm_url: 'https://foo.bar',
scm_clean: true,
+ scm_track_submodules: false,
credential: 100,
local_path: '',
organization: { id: 2, name: 'Bar' },
diff --git a/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx b/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx
index f8bcd351b79b..f6b1f8d3ad06 100644
--- a/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx
+++ b/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx
@@ -36,6 +36,7 @@ function ProjectDetail({ project, i18n }) {
scm_branch,
scm_clean,
scm_delete_on_update,
+ scm_track_submodules,
scm_refspec,
scm_type,
scm_update_on_launch,
@@ -61,6 +62,7 @@ function ProjectDetail({ project, i18n }) {
if (
scm_clean ||
scm_delete_on_update ||
+ scm_track_submodules ||
scm_update_on_launch ||
allow_override
) {
@@ -70,6 +72,11 @@ function ProjectDetail({ project, i18n }) {
{scm_delete_on_update && (
{i18n._(t`Delete on Update`)}
)}
+ {scm_track_submodules && (
+
+ {i18n._(t`Track submodules latest commit on branch`)}
+
+ )}
{scm_update_on_launch && (
{i18n._(t`Update Revision on Launch`)}
)}
diff --git a/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.test.jsx b/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.test.jsx
index 6f65e6b7f73e..34ef0d6beb95 100644
--- a/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.test.jsx
+++ b/awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.test.jsx
@@ -70,6 +70,7 @@ describe('', () => {
scm_refspec: 'refs/remotes/*',
scm_clean: true,
scm_delete_on_update: true,
+ scm_track_submodules: false,
credential: 100,
status: 'successful',
organization: 10,
@@ -141,6 +142,7 @@ describe('', () => {
scm_type: '',
scm_clean: false,
scm_delete_on_update: false,
+ scm_track_submodules: false,
scm_update_on_launch: false,
allow_override: false,
created: '',
diff --git a/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx b/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx
index 1a62a3f2f014..6e7b4b22f161 100644
--- a/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx
+++ b/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx
@@ -19,6 +19,7 @@ describe('', () => {
scm_type: 'git',
scm_url: 'https://foo.bar',
scm_clean: true,
+ scm_track_submodules: false,
credential: 100,
local_path: 'bar',
organization: 2,
diff --git a/awx/ui_next/src/screens/Project/data.project.json b/awx/ui_next/src/screens/Project/data.project.json
index 69ee22a34e09..9f58e5243b39 100644
--- a/awx/ui_next/src/screens/Project/data.project.json
+++ b/awx/ui_next/src/screens/Project/data.project.json
@@ -104,6 +104,7 @@
"scm_refspec": "",
"scm_clean": false,
"scm_delete_on_update": false,
+ "scm_track_submodules": false,
"credential": null,
"timeout": 0,
"scm_revision": "f5de82382e756b87143f3511c7c6c006d941830d",
@@ -119,4 +120,4 @@
"last_update_failed": false,
"last_updated": "2019-09-30T18:06:34.713654Z",
"execution_environment": 1
-}
\ No newline at end of file
+}
diff --git a/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx b/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
index 9ce8aa555ba1..f88072446915 100644
--- a/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
+++ b/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
@@ -84,6 +84,7 @@ function ProjectFormFields({
credential: '',
scm_clean: false,
scm_delete_on_update: false,
+ scm_track_submodules: false,
scm_update_on_launch: false,
allow_override: false,
scm_update_cache_timeout: 0,
@@ -308,6 +309,7 @@ function ProjectForm({ i18n, project, submitError, ...props }) {
credential: '',
scm_clean: false,
scm_delete_on_update: false,
+ scm_track_submodules: false,
scm_update_on_launch: false,
allow_override: false,
scm_update_cache_timeout: 0,
@@ -365,6 +367,7 @@ function ProjectForm({ i18n, project, submitError, ...props }) {
scm_branch: project.scm_branch || '',
scm_clean: project.scm_clean || false,
scm_delete_on_update: project.scm_delete_on_update || false,
+ scm_track_submodules: project.scm_track_submodules || false,
scm_refspec: project.scm_refspec || '',
scm_type:
project.scm_type === ''
diff --git a/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx b/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx
index 33c528c45c15..0a34bde6eacf 100644
--- a/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx
+++ b/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx
@@ -17,6 +17,7 @@ describe('', () => {
scm_type: 'git',
scm_url: 'https://foo.bar',
scm_clean: true,
+ scm_track_submodules: false,
credential: 100,
organization: 2,
scm_update_on_launch: true,
diff --git a/awx/ui_next/src/screens/Project/shared/ProjectSubForms/SharedFields.jsx b/awx/ui_next/src/screens/Project/shared/ProjectSubForms/SharedFields.jsx
index 6fc0fb1c0e01..784bed00d4a0 100644
--- a/awx/ui_next/src/screens/Project/shared/ProjectSubForms/SharedFields.jsx
+++ b/awx/ui_next/src/screens/Project/shared/ProjectSubForms/SharedFields.jsx
@@ -84,6 +84,19 @@ export const ScmTypeOptions = withI18n()(
of time required to complete an update.`
)}
/>
+