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

Fix permissions issues with Conda Environment on macOS and Linux #8402

Merged
merged 19 commits into from
Sep 25, 2018

Conversation

brcrista
Copy link
Contributor

Hosted Ubuntu 16.04 does not run as root like the Docker container did.

Testing:

  • L0
  • Canary builds on all 3 OSes

} else {
return task.tool('sudo').line('conda');
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For cases where sudo is not installed, like for container image ubuntu:latest, can we run 'which sudo' to look for it, and if found use it, otherwise don't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. I would say a few things:

  1. Why doesn't ubuntu:latest have sudo installed?
  2. I had originally hoped, instead of sudo, to create envs in a directory that the non-root user has permissions for. Unfortunately, there's still some business with a temp file getting written to the /usr directory. (Whenever I've installed Miniconda it's ended up in ~/miniconda, so maybe we should install it that way on the agent.)
  3. Other tasks have already taken this approach, (Use Ruby Version comes to mind) and we have a general issue with needing to run tasks as root on Linux and macOS hosted agents now. I'd like to think through an approach that will work everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrt #1, I found this: tianon/docker-brew-ubuntu-core#48
I agree this could be smarter but sounds like there is an easy workaround: apt-get install sudo --yes. So I'd say it depends on how common we think this scenario will be.

try {
await uut.condaEnvironment(parameters, Platform.Windows);
done(new Error('should not have succeeded'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using both patterns before. I believe this way is better: failing tests in the old pattern (using done) would simply give the "timeout of 2000 ms has been reached, make sure you are calling done()" message.

@@ -124,7 +124,7 @@ it('updates Conda if the user requests it', async function () {
assert(updateConda.calledOnceWithExactly('path-to-conda', Platform.Linux));
});

it('fails if `conda` is not found', async function (done: MochaDone) {
it('fails if `conda` is not found', async function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async isn't needed here. I'm going to make a later change to clean up some stuff like this.

* TODO move this to vsts-task-tool-lib
*/
export function prependPathSafe(toolPath: string) {
// TODO task-lib 2.4.0: `assertAgent` is not in mock-task
Copy link
Contributor Author

@brcrista brcrista Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've worked with @bryanmacfarlane's team on a plan for task-lib that will fix stuff like this. (Right now you can't mix custom mocks with setAnswers on mock-task.) I hope to get to that later this sprint.

@@ -13,7 +13,7 @@
"version": {
"Major": 1,
"Minor": 140,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to change the Minor version to the current sprint number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpricketMSFT I'm going to hotfix this to 140 and 141. We've decided in those cases to set the version according to the earliest sprint it will be backported to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@jpricket jpricket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than minor version.

@@ -13,7 +13,7 @@
"version": {
"Major": 1,
"Minor": 140,
"Patch": 0
"Patch": 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to bump the minor to 142 now?

@brcrista brcrista deleted the users/brcrista/conda-env-path branch November 6, 2018 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants