See if travis install script can run without sudo

RESOLVED FIXED

Status

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: zcampbell, Assigned: zcampbell)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
The travis install script has a sudo command in it.

Thus when it is run locally the install pollutes the global scope and virtual environment cannot be used.

See if Travis works without this sudo. 

If need be, a local user can run the script with sudo.
(Assignee)

Comment 1

5 years ago
Ah well that was a no-no
https://travis-ci.org/mozilla-b2g/gaia/jobs/14985675

James, is there any way to achieve this, by some other means?

As sudo-ing Python packages into the global scope is not so much a good practice. Harmless on a throwaway VM.

We often need to use these install scripts to replicate running the way Travis does when debugging.
Flags: needinfo?(jlal)
You should just set up a virtual environment and install inside that. We do this for a few of the automation projects, here's an example: https://github.com/mozilla/mozmill-ci/blob/master/run_tests.sh#L33
Flags: needinfo?(jlal)
(Assignee)

Comment 3

5 years ago
I tried that too but virtualenv is not installed on Travis.
https://travis-ci.org/mozilla-b2g/gaia/jobs/14986173

We'd have to install it to use it.
Travis does have virtualenv installed for Python jobs [1], but this is not a Python job (because the .travis.yml is shared). You will need to install it, as show in the example I provided in comment 2.

[1] http://about.travis-ci.org/docs/user/languages/python/#Travis-CI-Uses-Isolated-virtualenvs
(Assignee)

Comment 5

5 years ago
OK that makes sense.
I have to defer back to James on whether we can do this.
(Assignee)

Comment 6

5 years ago
(In reply to Dave Hunt (:davehunt) from comment #4)
> Travis does have virtualenv installed for Python jobs [1], but this is not a
> Python job (because the .travis.yml is shared). You will need to install it,
> as show in the example I provided in comment 2.
> 

I've tried this and about a dozen other options but you can't activate the virtualenv, something to do with the script not being a bash script I think:
https://travis-ci.org/mozilla-b2g/gaia/builds/15538836
(In reply to Zac C (:zac) from comment #6)
> (In reply to Dave Hunt (:davehunt) from comment #4)
> > Travis does have virtualenv installed for Python jobs [1], but this is not a
> > Python job (because the .travis.yml is shared). You will need to install it,
> > as show in the example I provided in comment 2.
> > 
> 
> I've tried this and about a dozen other options but you can't activate the
> virtualenv, something to do with the script not being a bash script I think:
> https://travis-ci.org/mozilla-b2g/gaia/builds/15538836

Hmm.. it is a bash script. Have you tried |source .env/bin/activate|? Also, you may have to reactivate the virtual environment in the script that you created during install.
(Assignee)

Comment 8

5 years ago
I tried source too but it's the same thing really.

After comment #5 I changed the bash script bit at the top and it changed the behaviour.

trying your idea here:
https://travis-ci.org/mozilla-b2g/gaia/builds/15540176
(Assignee)

Comment 9

5 years ago
Created attachment 8348193 [details] [review]
github pr
Attachment #8348193 - Flags: review?(jlal)
Attachment #8348193 - Flags: review?(dave.hunt)
Comment on attachment 8348193 [details] [review]
github pr

Comments added to pull request.
Attachment #8348193 - Flags: review?(dave.hunt) → review-
(Assignee)

Updated

5 years ago
Attachment #8348193 - Flags: review?(jlal)
(Assignee)

Comment 11

5 years ago
Dave, I've had another go at this today but still not getting anywhere.

I get the feeling the mozmill example you gave is not valid because Gaia Travis isn't set up as a Python env so there are loads of packages missing.

If you get some spare time can you have another look, or take this task entirely?

I may not get to it again this week so not a very high priority but any more feedback I'll try out in time.
(Assignee)

Updated

5 years ago
Attachment #8348193 - Flags: feedback?(dave.hunt)
Created attachment 8357702 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/15153
Attachment #8348193 - Attachment is obsolete: true
Attachment #8348193 - Flags: feedback?(dave.hunt)
Attachment #8357702 - Flags: review?(zcampbell)
(Assignee)

Comment 13

5 years ago
Comment on attachment 8357702 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/15153

r+ , excellent!
Attachment #8357702 - Flags: review?(zcampbell) → review+
(Assignee)

Comment 14

5 years ago
Was merged:
https://github.com/mozilla-b2g/gaia/commit/fdfad4fea7ca99e81805df0a8d687236fef36575
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.