From cb2720708894d81a3ab42b8af9b3e31cb6768b4f Mon Sep 17 00:00:00 2001 From: Ivan Golubev Date: Wed, 15 Dec 2021 16:56:25 +0300 Subject: [PATCH 1/3] Add warning when use python version is 3.5 --- .../Strings/resources.resjson/en-US/resources.resjson | 3 ++- Tasks/UsePythonVersionV0/task.json | 5 +++-- Tasks/UsePythonVersionV0/task.loc.json | 5 +++-- Tasks/UsePythonVersionV0/usepythonversion.ts | 5 +++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson b/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson index f972609d5840..1927f0038e4c 100644 --- a/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson @@ -17,5 +17,6 @@ "loc.messages.ToolNotFoundMicrosoftHosted": "If this is a Microsoft-hosted agent, check that this image supports side-by-side versions of %s at %s.", "loc.messages.ToolNotFoundSelfHosted": "If this is a self-hosted agent, see how to configure side-by-side %s versions at %s.", "loc.messages.VersionNotFound": "Version spec %s for architecture %s did not match any version in Agent.ToolsDirectory.", - "loc.messages.ExactVersionNotRecommended": "Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.6`)" + "loc.messages.ExactVersionNotRecommended": "Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.6`)", + "loc.messages.PythonVersionRetirement": "Python 3.5 has reached its end of life and will be removed from the ms-hosted images on January, 24. We highly recommend updating your Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments" } \ No newline at end of file diff --git a/Tasks/UsePythonVersionV0/task.json b/Tasks/UsePythonVersionV0/task.json index 9a424b8e5026..3542da2035b6 100644 --- a/Tasks/UsePythonVersionV0/task.json +++ b/Tasks/UsePythonVersionV0/task.json @@ -14,7 +14,7 @@ "minimumAgentVersion": "2.182.1", "version": { "Major": 0, - "Minor": 193, + "Minor": 199, "Patch": 0 }, "demands": [], @@ -77,7 +77,8 @@ "ToolNotFoundMicrosoftHosted": "If this is a Microsoft-hosted agent, check that this image supports side-by-side versions of %s at %s.", "ToolNotFoundSelfHosted": "If this is a self-hosted agent, see how to configure side-by-side %s versions at %s.", "VersionNotFound": "Version spec %s for architecture %s did not match any version in Agent.ToolsDirectory.", - "ExactVersionNotRecommended": "Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.6`)" + "ExactVersionNotRecommended": "Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.6`)", + "PythonVersionRetirement": "Python 3.5 has reached its end of life and will be removed from the ms-hosted images on January, 24. We highly recommend updating your Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments" }, "restrictions": { "commands": { diff --git a/Tasks/UsePythonVersionV0/task.loc.json b/Tasks/UsePythonVersionV0/task.loc.json index b3552ff288ff..3299fc6ebca2 100644 --- a/Tasks/UsePythonVersionV0/task.loc.json +++ b/Tasks/UsePythonVersionV0/task.loc.json @@ -14,7 +14,7 @@ "minimumAgentVersion": "2.182.1", "version": { "Major": 0, - "Minor": 193, + "Minor": 199, "Patch": 0 }, "demands": [], @@ -77,7 +77,8 @@ "ToolNotFoundMicrosoftHosted": "ms-resource:loc.messages.ToolNotFoundMicrosoftHosted", "ToolNotFoundSelfHosted": "ms-resource:loc.messages.ToolNotFoundSelfHosted", "VersionNotFound": "ms-resource:loc.messages.VersionNotFound", - "ExactVersionNotRecommended": "ms-resource:loc.messages.ExactVersionNotRecommended" + "ExactVersionNotRecommended": "ms-resource:loc.messages.ExactVersionNotRecommended", + "PythonVersionRetirement": "ms-resource:loc.messages.PythonVersionRetirement" }, "restrictions": { "commands": { diff --git a/Tasks/UsePythonVersionV0/usepythonversion.ts b/Tasks/UsePythonVersionV0/usepythonversion.ts index 2380cea158cf..50839305e297 100644 --- a/Tasks/UsePythonVersionV0/usepythonversion.ts +++ b/Tasks/UsePythonVersionV0/usepythonversion.ts @@ -90,6 +90,11 @@ async function useCpythonVersion(parameters: Readonly, platform: const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec); task.debug(`Semantic version spec of ${parameters.versionSpec} is ${semanticVersionSpec}`); + // Throw warning if Python version is 3.5 + if (semver.satisfies(semver.coerce(parameters.versionSpec), "3.5.*")) { + task.warning(task.loc('PythonVersionRetirement')); + } + if (isExactVersion(semanticVersionSpec)) { task.warning(task.loc('ExactVersionNotRecommended')); } From fea7a2e8738ef12ec18fda0a15b7e8a96d2a2323 Mon Sep 17 00:00:00 2001 From: Ivan Golubev Date: Wed, 15 Dec 2021 17:08:30 +0300 Subject: [PATCH 2/3] Bump version --- Tasks/UsePythonVersionV0/task.json | 2 +- Tasks/UsePythonVersionV0/task.loc.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/UsePythonVersionV0/task.json b/Tasks/UsePythonVersionV0/task.json index 3542da2035b6..c13fdc5b6a63 100644 --- a/Tasks/UsePythonVersionV0/task.json +++ b/Tasks/UsePythonVersionV0/task.json @@ -14,7 +14,7 @@ "minimumAgentVersion": "2.182.1", "version": { "Major": 0, - "Minor": 199, + "Minor": 198, "Patch": 0 }, "demands": [], diff --git a/Tasks/UsePythonVersionV0/task.loc.json b/Tasks/UsePythonVersionV0/task.loc.json index 3299fc6ebca2..46a9976c848e 100644 --- a/Tasks/UsePythonVersionV0/task.loc.json +++ b/Tasks/UsePythonVersionV0/task.loc.json @@ -14,7 +14,7 @@ "minimumAgentVersion": "2.182.1", "version": { "Major": 0, - "Minor": 199, + "Minor": 198, "Patch": 0 }, "demands": [], From 2500d0aafbc860780e95dbacfd062f93adaab3f0 Mon Sep 17 00:00:00 2001 From: Ivan Golubev Date: Wed, 15 Dec 2021 17:29:23 +0300 Subject: [PATCH 3/3] Change warning message --- .../Strings/resources.resjson/en-US/resources.resjson | 2 +- Tasks/UsePythonVersionV0/task.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson b/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson index 1927f0038e4c..79d3a0e1b2de 100644 --- a/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/UsePythonVersionV0/Strings/resources.resjson/en-US/resources.resjson @@ -18,5 +18,5 @@ "loc.messages.ToolNotFoundSelfHosted": "If this is a self-hosted agent, see how to configure side-by-side %s versions at %s.", "loc.messages.VersionNotFound": "Version spec %s for architecture %s did not match any version in Agent.ToolsDirectory.", "loc.messages.ExactVersionNotRecommended": "Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.6`)", - "loc.messages.PythonVersionRetirement": "Python 3.5 has reached its end of life and will be removed from the ms-hosted images on January, 24. We highly recommend updating your Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments" + "loc.messages.PythonVersionRetirement": "Python 3.5 has reached its end of life and will be removed from the ms-hosted images on January, 24. Please update Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments" } \ No newline at end of file diff --git a/Tasks/UsePythonVersionV0/task.json b/Tasks/UsePythonVersionV0/task.json index c13fdc5b6a63..4f3f9fab4b3b 100644 --- a/Tasks/UsePythonVersionV0/task.json +++ b/Tasks/UsePythonVersionV0/task.json @@ -78,7 +78,7 @@ "ToolNotFoundSelfHosted": "If this is a self-hosted agent, see how to configure side-by-side %s versions at %s.", "VersionNotFound": "Version spec %s for architecture %s did not match any version in Agent.ToolsDirectory.", "ExactVersionNotRecommended": "Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.6`)", - "PythonVersionRetirement": "Python 3.5 has reached its end of life and will be removed from the ms-hosted images on January, 24. We highly recommend updating your Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments" + "PythonVersionRetirement": "Python 3.5 has reached its end of life and will be removed from the ms-hosted images on January, 24. Please update Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments" }, "restrictions": { "commands": {