Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the warning when using python version 3.5 #15609

Merged
merged 4 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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