The current behavior of workflow job templates is to pass in an empty string as scm_branch on allsaves and edits. This becomes problematic when using job templates/workflows which allow prompt on launch for scm_branch as it may override the scm_branch set for the individual workflow nodes to an empty string. That behavior limits the usefulness of prompting scm branch as it can no longer by selected while creating workflows as they'll be overwritten.

This commit is contained in:
Gabe Muniz 2022-12-15 09:41:55 -05:00
parent 7b8dcc98e7
commit c2a3c3b285
2 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ function WorkflowJobTemplateAdd() {
limit,
job_tags,
skip_tags,
scm_branch,
...templatePayload
} = values;
templatePayload.inventory = inventory?.id;
@ -32,6 +33,7 @@ function WorkflowJobTemplateAdd() {
templatePayload.limit = limit === '' ? null : limit;
templatePayload.job_tags = job_tags === '' ? null : job_tags;
templatePayload.skip_tags = skip_tags === '' ? null : skip_tags;
templatePayload.scm_branch = scm_branch === '' ? null : scm_branch;
const organizationId =
organization?.id || inventory?.summary_fields?.organization.id;
try {

View File

@ -30,6 +30,7 @@ function WorkflowJobTemplateEdit({ template }) {
limit,
job_tags,
skip_tags,
scm_branch,
...templatePayload
} = values;
templatePayload.inventory = inventory?.id || null;
@ -38,6 +39,7 @@ function WorkflowJobTemplateEdit({ template }) {
templatePayload.limit = limit === '' ? null : limit;
templatePayload.job_tags = job_tags === '' ? null : job_tags;
templatePayload.skip_tags = skip_tags === '' ? null : skip_tags;
templatePayload.scm_branch = scm_branch === '' ? null : scm_branch;
const formOrgId =
organization?.id || inventory?.summary_fields?.organization.id || null;