Merge pull request #9219 from mazhead/devel

Adding the scm_track_submodules option for project

SUMMARY
Adding the scm_track_submodules option which should fix the related #7846
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

API
UI

AWX VERSION
awx: 17.0.1

ADDITIONAL INFORMATION
This option will add the track_submodules option which is described in the ansible git module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html

if yes, submodules will track the latest commit on their master branch (or other branch specified in .gitmodules). If no, submodules will be kept at the revision specified by the main project. This is equivalent to specifying the --remote flag to git submodule update.

Reviewed-by: Shane McDonald <me@shanemcd.com>
Reviewed-by: Alan Rominger <arominge@redhat.com>
Reviewed-by: None <None>
Reviewed-by: Alex Corey <Alex.swansboro@gmail.com>
This commit is contained in:
softwarefactory-project-zuul[bot]
2021-04-15 17:28:41 +00:00
committed by GitHub
18 changed files with 82 additions and 3 deletions

View File

@@ -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 && (
<ListItem>{i18n._(t`Delete on Update`)}</ListItem>
)}
{scm_track_submodules && (
<ListItem>
{i18n._(t`Track submodules latest commit on branch`)}
</ListItem>
)}
{scm_update_on_launch && (
<ListItem>{i18n._(t`Update Revision on Launch`)}</ListItem>
)}

View File

@@ -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
}
}

View File

@@ -18,6 +18,7 @@ describe('<ProjectAdd />', () => {
scm_type: 'git',
scm_url: 'https://foo.bar',
scm_clean: true,
scm_track_submodules: false,
credential: 100,
local_path: '',
organization: { id: 2, name: 'Bar' },

View File

@@ -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,
@@ -58,6 +59,7 @@ function ProjectDetail({ project, i18n }) {
if (
scm_clean ||
scm_delete_on_update ||
scm_track_submodules ||
scm_update_on_launch ||
allow_override
) {
@@ -67,6 +69,11 @@ function ProjectDetail({ project, i18n }) {
{scm_delete_on_update && (
<ListItem>{i18n._(t`Delete on Update`)}</ListItem>
)}
{scm_track_submodules && (
<ListItem>
{i18n._(t`Track submodules latest commit on branch`)}
</ListItem>
)}
{scm_update_on_launch && (
<ListItem>{i18n._(t`Update Revision on Launch`)}</ListItem>
)}

View File

@@ -70,6 +70,7 @@ describe('<ProjectDetail />', () => {
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('<ProjectDetail />', () => {
scm_type: '',
scm_clean: false,
scm_delete_on_update: false,
scm_track_submodules: false,
scm_update_on_launch: false,
allow_override: false,
created: '',

View File

@@ -19,6 +19,7 @@ describe('<ProjectEdit />', () => {
scm_type: 'git',
scm_url: 'https://foo.bar',
scm_clean: true,
scm_track_submodules: false,
credential: 100,
local_path: 'bar',
organization: 2,

View File

@@ -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
}
}

View File

@@ -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 === ''

View File

@@ -17,6 +17,7 @@ describe('<ProjectForm />', () => {
scm_type: 'git',
scm_url: 'https://foo.bar',
scm_clean: true,
scm_track_submodules: false,
credential: 100,
organization: 2,
scm_update_on_launch: true,

View File

@@ -84,6 +84,19 @@ export const ScmTypeOptions = withI18n()(
of time required to complete an update.`
)}
/>
<CheckboxField
id="option-scm-track-submodules"
name="scm_track_submodules"
label={i18n._(t`Track submodules`)}
tooltip={i18n._(
t`Submodules will track the latest commit on
their master branch (or other branch specified in
.gitmodules). If no, submodules will be kept at
the revision specified by the main project.
This is equivalent to specifying the --remote
flag to git submodule update.`
)}
/>
<CheckboxField
id="option-scm-update-on-launch"
name="scm_update_on_launch"

View File

@@ -159,6 +159,7 @@ export const Project = shape({
scm_refspec: string,
scm_clean: bool,
scm_delete_on_update: bool,
scm_track_submodules: bool,
credential: number,
status: oneOf([
'new',