Closed Bug 946711 Opened 11 years ago Closed 10 years ago

See if travis install script can run without sudo

Categories

(Firefox OS Graveyard :: Gaia::UI Tests, defect)

Other
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zcampbell, Assigned: zcampbell)

Details

Attachments

(1 file, 1 obsolete file)

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.
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)
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
OK that makes sense.
I have to defer back to James on whether we can do this.
(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.
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
Attached file github pr (obsolete) —
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-
Attachment #8348193 - Flags: review?(jlal)
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.
Attachment #8348193 - Flags: feedback?(dave.hunt)
Attachment #8348193 - Attachment is obsolete: true
Attachment #8348193 - Flags: feedback?(dave.hunt)
Attachment #8357702 - Flags: review?(zcampbell)
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+
Was merged:
https://github.com/mozilla-b2g/gaia/commit/fdfad4fea7ca99e81805df0a8d687236fef36575
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: