From 8695de165ac822c6fb77549546116c890b76a399 Mon Sep 17 00:00:00 2001
From: MerlynOMsft <44985659+merlynomsft@users.noreply.github.com>
Date: Fri, 25 Oct 2024 17:25:26 -0700
Subject: [PATCH] formatfix for build all tasks when forceCourtesyPush == true

---
 azure-pipelines.yml | 5 +++++
 ci/filter-tasks.js  | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index db653efe355e..16285b1edf08 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -64,6 +64,11 @@ variables:
     value: 'true'
   ${{ else }}:
     value: 'false'
+- name: DEPLOY_ALL_TASKSVAR
+  ${{ if eq(parameters.deploy_all_tasks, true) }}:
+    value: 'true'
+  ${{ else }}:
+    value: 'false'
 
 extends:
   template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
diff --git a/ci/filter-tasks.js b/ci/filter-tasks.js
index 9f94547b4de0..a5e3d487a5b2 100644
--- a/ci/filter-tasks.js
+++ b/ci/filter-tasks.js
@@ -222,6 +222,7 @@ var setTaskVariables = function(tasks, tasksForDowngradingCheck) {
 var buildReason = process.env['BUILD_REASON'].toLowerCase();
 var forceCourtesyPush = process.env['FORCE_COURTESY_PUSH'] && process.env['FORCE_COURTESY_PUSH'].toLowerCase() === 'true';
 var taskNameIsSet = process.env['TASKNAMEISSET'] && process.env['TASKNAMEISSET'].toLowerCase() === 'true';
+var deployAllTasks = process.env['DEPLOY_ALL_TASKSVAR'] && process.env['DEPLOY_ALL_TASKSVAR'].toLowerCase() === 'true';
 
 if (taskNameIsSet) {
     var taskName = process.env['TASKNAME'];
@@ -240,7 +241,9 @@ const ciBuildReasonList = [AzpBuildReason.Individualci, AzpBuildReason.Batchedci
 
 async function filterTasks () {
     try {
-        if (ciBuildReasonList.includes(buildReason) || (forceCourtesyPush && !taskNameIsSet)) {
+        if (deployAllTasks) {
+            setTaskVariables(makeOptions.tasks, makeOptions.tasks);
+        } else if (ciBuildReasonList.includes(buildReason) || (forceCourtesyPush && !taskNameIsSet)) {
             // If CI, we will compare any tasks that have updated versions.
             const tasks = await getTasksToBuildForCI();
             setTaskVariables(tasks, tasks);