diff --git a/src/Agent.Worker/TaskManager.cs b/src/Agent.Worker/TaskManager.cs index 8c4c370d01..3d944f1f3a 100644 --- a/src/Agent.Worker/TaskManager.cs +++ b/src/Agent.Worker/TaskManager.cs @@ -326,13 +326,14 @@ private void CheckForTaskDeprecation(IExecutionContext executionContext, Pipelin { string friendlyName = taskJson["friendlyName"].Value(); int majorVersion = new Version(task.Version).Major; - string deprecationMessage = $"Task '{friendlyName}' version {majorVersion} ({task.Name}@{majorVersion}) is deprecated"; + string deprecationMessage = StringUtil.Loc("DeprecationMessage", friendlyName, majorVersion, task.Name); var removalDate = taskJson["removalDate"]; if (removalDate != null) { + string whitespace = " "; string removalDateString = removalDate.Value().ToString("MMMM d, yyyy"); - deprecationMessage += $" and will be removed. From {removalDateString} onwards it may no longer be available"; + deprecationMessage += whitespace + StringUtil.Loc("DeprecationMessageRemovalDate", removalDateString); var helpUrl = taskJson["helpUrl"]; if (helpUrl != null) @@ -344,12 +345,12 @@ private void CheckForTaskDeprecation(IExecutionContext executionContext, Pipelin if (helpUrlString.StartsWith(urlPrefix)) { string versionHelpUrl = $"{helpUrlString}-v{majorVersion}".Replace(urlPrefix, $"https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/"); - deprecationMessage += $". Please see {versionHelpUrl} for more information about this task"; + deprecationMessage += whitespace + StringUtil.Loc("DeprecationMessageHelpUrl", versionHelpUrl); } } } - executionContext.Warning($"{deprecationMessage}."); + executionContext.Warning(deprecationMessage); } } diff --git a/src/Misc/layoutbin/en-US/strings.json b/src/Misc/layoutbin/en-US/strings.json index 2250c75638..7f755a6a94 100644 --- a/src/Misc/layoutbin/en-US/strings.json +++ b/src/Misc/layoutbin/en-US/strings.json @@ -262,6 +262,9 @@ "DeploymentPoolNotFound": "Deployment pool not found: '{0}'", "DeprecatedNode6": "This task uses Node 6 execution handler, which will be removed March 31st 2022. If you are the developer of the task - please consider the migration guideline to Node 10 handler - https://aka.ms/migrateTaskNode10 (check this page also if you would like to disable Node 6 deprecation warnings). If you are the user - feel free to reach out to the owners of this task to proceed on migration.", "DeprecatedRunner": "Task '{0}' is dependent on a task runner that is end-of-life and will be removed in the future. Authors should review Node upgrade guidance: https://aka.ms/node-runner-guidance.", + "DeprecationMessage": "Task '{0}' version {1} ({2}@{1}) is deprecated.", + "DeprecationMessageHelpUrl": "Please see {0} for more information about this task.", + "DeprecationMessageRemovalDate": "This task will be removed. From {0}, onwards it may no longer be available.", "DirectoryHierarchyUnauthorized": "Permission to read the directory contents is required for '{0}' and each directory up the hierarchy. {1}", "DirectoryIsEmptyForArtifact": "Directory '{0}' is empty. Nothing will be added to build artifact '{1}'.", "DirectoryNotFound": "Directory not found: '{0}'",