From 46560bdb09e5a602f09940b4294f0838d3b776f1 Mon Sep 17 00:00:00 2001 From: surajitshil Date: Mon, 11 Aug 2025 14:51:34 +0530 Subject: [PATCH 1/3] Updating the version of MavenV2 task from 2.249.1 to 2.263.3 for testing --- Tasks/MavenV2/task.json | 4 ++-- Tasks/MavenV2/task.loc.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tasks/MavenV2/task.json b/Tasks/MavenV2/task.json index cf7d97437edf..835ceceb6cce 100644 --- a/Tasks/MavenV2/task.json +++ b/Tasks/MavenV2/task.json @@ -17,8 +17,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 249, - "Patch": 1 + "Minor": 263, + "Patch": 3 }, "releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`", "demands": [ diff --git a/Tasks/MavenV2/task.loc.json b/Tasks/MavenV2/task.loc.json index 7b3959e083b6..2e05567f0fd3 100644 --- a/Tasks/MavenV2/task.loc.json +++ b/Tasks/MavenV2/task.loc.json @@ -17,8 +17,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 249, - "Patch": 1 + "Minor": 263, + "Patch": 3 }, "releaseNotes": "ms-resource:loc.releaseNotes", "demands": [ From cdad6af5fb7123dec3b3f2e5fb10829b6b400b85 Mon Sep 17 00:00:00 2001 From: surajitshil Date: Mon, 11 Aug 2025 15:08:42 +0530 Subject: [PATCH 2/3] Updating the condition to send MS Teams notification during manual run --- ci/courtesy-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/courtesy-push.yml b/ci/courtesy-push.yml index 5c5ee1df90e9..b62d748a6d7f 100644 --- a/ci/courtesy-push.yml +++ b/ci/courtesy-push.yml @@ -36,6 +36,6 @@ steps: - powershell: $(Build.SourcesDirectory)/ci/courtesy-push/send-notification.ps1 displayName: Send MS Teams notification - condition: eq(variables['build.reason'], 'Schedule') + condition: or(eq(variables['build.reason'], 'Schedule'), eq(variables['build.reason'], 'Manual')) env: TEAMS_WEBHOOK: $(MSTeamsUri) From a54f05821801ab8ed872acc42183fc7a219f3b93 Mon Sep 17 00:00:00 2001 From: surajitshil Date: Mon, 11 Aug 2025 17:13:01 +0530 Subject: [PATCH 3/3] Adding more logs for better debugging --- Tasks/MavenV2/task.json | 4 +- Tasks/MavenV2/task.loc.json | 4 +- ci/courtesy-push/courtesy-push.js | 67 ++++++++++++++++++++++++++++--- 3 files changed, 65 insertions(+), 10 deletions(-) diff --git a/Tasks/MavenV2/task.json b/Tasks/MavenV2/task.json index 835ceceb6cce..cf7d97437edf 100644 --- a/Tasks/MavenV2/task.json +++ b/Tasks/MavenV2/task.json @@ -17,8 +17,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 263, - "Patch": 3 + "Minor": 249, + "Patch": 1 }, "releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`", "demands": [ diff --git a/Tasks/MavenV2/task.loc.json b/Tasks/MavenV2/task.loc.json index 2e05567f0fd3..7b3959e083b6 100644 --- a/Tasks/MavenV2/task.loc.json +++ b/Tasks/MavenV2/task.loc.json @@ -17,8 +17,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 263, - "Patch": 3 + "Minor": 249, + "Patch": 1 }, "releaseNotes": "ms-resource:loc.releaseNotes", "demands": [ diff --git a/ci/courtesy-push/courtesy-push.js b/ci/courtesy-push/courtesy-push.js index de71741930c3..2ff60c55e341 100644 --- a/ci/courtesy-push/courtesy-push.js +++ b/ci/courtesy-push/courtesy-push.js @@ -190,6 +190,20 @@ Generated: ${new Date().toISOString()}` console.log(` Repository: ${repo}`); console.log(` Pull-Request description:${JSON.stringify(pullRequestToCreate,null,2)}`) console.log('DRYRUN set to true-skipping actual PR creation...') + const timestamp = Date.now(); + const dummyPrId = `DRYRUN-${timestamp}`; + const dummyPrLink = `https://${orgUrl}/${project}/_git/${repo}/pullrequest/DRYRUN-${timestamp}`; + + console.log(`##vso[task.setvariable variable=PR_ID]${dummyPrId}`); + console.log(`##vso[task.setvariable variable=PR_LINK]${dummyPrLink}`); + + console.log(`DRYRUN: Generated dummy PR_ID = ${dummyPrId}`); + console.log(`DRYRUN: Generated dummy PR_LINK = ${dummyPrLink}`); + + return { + prId: dummyPrId, + prLink: dummyPrLink + }; } @@ -340,16 +354,13 @@ async function updateConfigsForTasks(depsArray, depsForUpdate, updatedDeps) { while (index < newDepsArr.length) { const currentDep = newDepsArr[index]; const [ name ] = await extractDependency(currentDep); - const lowerName = name && name.toLowerCase(); if (!name || !basicDepsForUpdate.has(lowerName)) { index++; continue; } - newDepsArr.splice(index, 1, depsForUpdate[lowerName].depStr); index++; - if (depsForUpdate[lowerName].configs) { depsForUpdate[lowerName].configs .sort((a, b) => a.name > b.name) @@ -387,15 +398,28 @@ async function updateUnifiedDeps(unifiedDepsPath, newUnifiedDepsPath) { let currentDependencies = parseUnifiedDependencies(unifiedDepsPath); let updatedDependencies = parseUnifiedDependencies(newUnifiedDepsPath); + console.log('=== DETAILED Directory.Packages.props COMPARISON DEBUGGING ==='); + console.log(`Reading current dependencies from: ${unifiedDepsPath}`); + console.log(`Reading new dependencies from: ${newUnifiedDepsPath}`); + console.log(`Current dependencies count: ${currentDependencies.length}`); + console.log(`Updated dependencies count: ${updatedDependencies.length}`); + console.log('Updated Dependencies:', updatedDependencies); const updatedDependenciesStructure = await getDeps(updatedDependencies); + console.log('Updated Dependencies Structure:', updatedDependenciesStructure); + // Initialize the updatedDeps object to track added and removed configs for the updated Tasks let updatedDeps = { added: [], removed: [] }; [ currentDependencies, updatedDeps ] = await removeConfigsForTasks(currentDependencies, updatedDependenciesStructure, updatedDeps); + console.log('=== BEFORE updateConfigsForTasks ==='); + console.log('Dependencies for update keys:', Object.keys(updatedDependenciesStructure)); + console.log('Current dependencies array length:', currentDependencies.length); [ currentDependencies, updatedDeps ] = await updateConfigsForTasks(currentDependencies, updatedDependenciesStructure, updatedDeps); - fs.writeFileSync(unifiedDepsPath, currentDependencies.join('\n')); console.log('Updating Unified Dependencies file done.'); + console.log('Updated Dependencies:', updatedDependencies); + console.log('Added Config Dependencies:', updatedDeps.added); + console.log('Removed Config Dependencies:', updatedDeps.removed); return updatedDeps; } @@ -416,6 +440,12 @@ async function updateTfsServerDeps() { const unifiedDepsPath = path.join(repoPath, 'Directory.Packages.props'); const tfsServerPath = path.join(repoPath, 'Tfs', 'Service', 'Deploy', 'components', 'TfsServer.hosted.xml'); const pathToTfsCore=tfsServerPath + + // Capture content BEFORE any changes + const beforeUnifiedContent = fs.readFileSync(unifiedDepsPath, 'utf8'); + const beforeTfsContent = fs.readFileSync(pathToTfsCore, 'utf8'); + + // Update the unified dependencies const depsToUpdate = await updateUnifiedDeps(unifiedDepsPath, newDeps); @@ -424,6 +454,11 @@ async function updateTfsServerDeps() { const depsToAdd = depsToUpdate.added.filter(dep => depsToUpdate.removed.indexOf(dep) === -1); const depsToRemove = depsToUpdate.removed.filter(dep => depsToUpdate.added.indexOf(dep) === -1); + console.log('=== TfsServer.hosted.xml MODIFICATION DEBUGGING ==='); + console.log(`Dependencies to add: ${JSON.stringify(depsToAdd, null, 2)}`); + console.log(`Dependencies to remove: ${JSON.stringify(depsToRemove, null, 2)}`); + console.log(`Total directories in TFS XML before modification: ${tfxCoreJson.Component.Directory.length}`); + // removing dependencies for (let idx = 0; idx < tfxCoreJson.Component.Directory.length; idx++) { const directory = tfxCoreJson.Component.Directory[idx]; @@ -440,6 +475,8 @@ async function updateTfsServerDeps() { tfxCoreJson.Component.Directory.unshift(directory); }); + console.log(`Total directories in TFS XML after addition: ${tfxCoreJson.Component.Directory.length}`); + const builder = new xml2js.Builder({ xmldec: { version: '1.0', encoding: 'utf-8' }, renderOpts: { pretty: true, indent: ' ', newline: '\n', allowEmpty: false, spacebeforeslash: ' ' } @@ -448,10 +485,28 @@ async function updateTfsServerDeps() { fs.writeFileSync(pathToTfsCore, xml); console.log('Inserting into Tfs Servicing Core file done.'); + + // Capture content AFTER all changes + const afterUnifiedContent = fs.readFileSync(unifiedDepsPath, 'utf8'); + const afterTfsContent = fs.readFileSync(pathToTfsCore, 'utf8'); + + // Check if ANY files changed + const unifiedChanged = beforeUnifiedContent !== afterUnifiedContent; + const tfsChanged = beforeTfsContent !== afterTfsContent; + const anyFilesChanged = unifiedChanged || tfsChanged; + + + + console.log('=== FILE CHANGE DETECTION ==='); + console.log(`Directory.Packages.props changed: ${unifiedChanged}`); + console.log(`TfsServer.hosted.xml changed: ${tfsChanged}`); + console.log(`Any files changed: ${anyFilesChanged}`); + console.log(`Config additions: ${depsToUpdate.added.length}`); + console.log(`Config removals: ${depsToUpdate.removed.length}`); // Commit and push changes if there are any updates - if (depsToUpdate.added.length > 0 || depsToUpdate.removed.length > 0) { - console.log(`Dependencies updated: ${depsToUpdate.added.length} added, ${depsToUpdate.removed.length} removed`); + if (depsToUpdate.added.length > 0 || depsToUpdate.removed.length > 0 || anyFilesChanged) { + console.log(`Config Dependencies added: ${depsToUpdate.added.length}, Config Dependencies removed: ${depsToUpdate.removed.length}, Changes in the base task version: ${anyFilesChanged}`); // Commit both the unified dependencies file and the TFS server file const filesToCommit = [