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

Problem: UsePythonVersion on self-hosted agents is open to side effects from previous builds #15417

Closed
FrancescElies opened this issue Oct 20, 2021 · 11 comments
Assignees
Labels
Area: ABTT Akvelon Build Tasks Team area of work question stale

Comments

@FrancescElies
Copy link
Contributor

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Question

Enter Task Name: UsePythonVersion

Issue Description

When using UsePythonVersion with ms-hosted agents everything works
nicely, you get a clean environment on every build (you get a clean machine) 👌.

When using the same task in self-hosted agents you get the selected
python environent under AGENT_TOOLSDIRECTORY leaving the door open to
side effects due to inplace modifications of that virtual environment in
that self-hosted machine.

Shouldn't UsePythonVersion provide a clean virtual environent in
self-hosted machines to avoid side effects?

@max-zaytsev max-zaytsev added Area: ABTT Akvelon Build Tasks Team area of work question labels Oct 20, 2021
@FrancescElies
Copy link
Contributor Author

@max-zaytsev ping 🙂any chances of getting this clarified?

@FrancescElies
Copy link
Contributor Author

I am starting to think this should have been marked as a bug 🐛.

UsePythonVersion having different behavior in self-hosted or microsoft-hosted agents does not feel right.

@FrancescElies
Copy link
Contributor Author

@max-zaytsev will I get an answer?

@max-zaytsev
Copy link
Contributor

Hi @FrancescElies,
Could you please clarify what do you mean by different behavior?
There should be no side effects if you set the addToPath parameter to false.
The difference you described is the difference between ms-hosted and self-hosted agents, which is expected. In general, if you are using self-hosted agents, you are responsible for cleaning up the environment.

@max-zaytsev max-zaytsev self-assigned this Jan 11, 2022
@FrancescElies
Copy link
Contributor Author

FrancescElies commented Jan 13, 2022

@max-zaytsev Maybe I am having the wrong expectations.

On ms-hosted you can do:

    steps:
      - task: UsePythonVersion@0
        inputs:
          versionSpec: '3.9'
      
      -run: pip install -r my-pinned-packages.txt
      
      # this is just fine, packages are installed
      # and on the next run I get a new VM and a 
      # clean python venv

On self-hosted the same pattern is broken:

    steps:
      # this now installs things in Agent.ToolsDirectory
      # which is shared between builds. One ends up installing 
      # python packages on the same installation across builds.
      - task: UsePythonVersion@0
        inputs:
          versionSpec: '3.9'
      
      -run: pip install -r my-pinned-packages.txt
      
      # this is normally fine, unless something strange happens
      # and the python environment gets broken.

I would expect getting a clean python environment when I call UsePythonVersion@0 but in self hosted we don't.

As mentioned above this is normally not a problem, but sometimes strange things happen.

In self hosted we need to create a new venv to make sure we don't pollute Agent.ToolsDirectory and eventually breaking many different builds that depend on the python version installed there.

Making us having to distinguish between self-hosted or ms-hosted agents when we write yaml ci code is not optimal.

Are my expectations wrong?

@anatolybolshakov
Copy link
Contributor

Hi @FrancescElies we are currently working on more prioritized issues, but will get back to this one be able to.

@FrancescElies
Copy link
Contributor Author

Thanks for the update

@github-actions
Copy link

github-actions bot commented Aug 6, 2022

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions
Copy link

github-actions bot commented Feb 8, 2023

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Feb 8, 2023
@FrancescElies
Copy link
Contributor Author

Don’t close please. We have a workaround but the behavior is in my opinion not consistent

@github-actions github-actions bot removed the stale label Feb 8, 2023
@github-actions
Copy link

github-actions bot commented Aug 7, 2023

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ABTT Akvelon Build Tasks Team area of work question stale
Projects
None yet
Development

No branches or pull requests

4 participants