Skip to content

Commit

Permalink
Add the warning when using python version 3.5 (#15609)
Browse files Browse the repository at this point in the history
* Add warning when use python version is 3.5

* Bump version

* Change warning message
  • Loading branch information
Ivan Golubev authored Dec 16, 2021
1 parent 30803ec commit 97fd368
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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. Please update Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments"
}
5 changes: 3 additions & 2 deletions Tasks/UsePythonVersionV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"minimumAgentVersion": "2.182.1",
"version": {
"Major": 0,
"Minor": 193,
"Minor": 198,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -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. Please update Python version if you use ms-hosted agents. For more information about this - https://github.com/actions/virtual-environments"
},
"restrictions": {
"commands": {
Expand Down
5 changes: 3 additions & 2 deletions Tasks/UsePythonVersionV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"minimumAgentVersion": "2.182.1",
"version": {
"Major": 0,
"Minor": 193,
"Minor": 198,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -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": {
Expand Down
5 changes: 5 additions & 0 deletions Tasks/UsePythonVersionV0/usepythonversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ async function useCpythonVersion(parameters: Readonly<TaskParameters>, 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'));
}
Expand Down

0 comments on commit 97fd368

Please sign in to comment.