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

Use Salt for mach bootstrap #14974

Merged
merged 5 commits into from Jan 20, 2017
Merged

Use Salt for mach bootstrap #14974

merged 5 commits into from Jan 20, 2017

Conversation

@aneeshusa
Copy link
Member

aneeshusa commented Jan 12, 2017

This is currently WIP, but allows Salt for mach bootstrap. Not looking for review yet, just posting for visibility. You can run ./mach bootstrap and Salt will run, letting you know what changes it would make for bootstrapping (doesn't actually run yet though).

Currently, this reads from saltfs using gitfs, meaning it always tracks the master branch. (Note that this is blocked on servo/saltfs#577 landing; in the meantime, I've included a small workaround in this PR to pull from my updated saltfs branch, which will need to be removed.) In the future, the relevant Salt code may be merged in tree as part of Docker support for TC, and the bootstrapper should be updated to read from in tree.

Also, our Windows machines have not been Salted, so the existing Windows bootstrappers are retained.

TODO:

  • Hook into existing bootstrapping code less hackily
  • Actually bootstrap instead of always using test=True mode (includes sudo)
  • Default to interactive mode (test first, then ask), with a force flag
  • Don't require running from the repository root directory
  • Make it easy to add support for other distros

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because they should be verified manually

This change is Reviewable

@highfive
Copy link

highfive commented Jan 12, 2017

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/requirements.txt, python/servo/bootstrapper/bootstrap.py, python/servo/bootstrapper/salt_config/minion, python/servo/bootstrapper/salt.py
@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch 5 times, most recently from 1626266 to 0e0f9d7 Jan 12, 2017
@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 12, 2017

This should work on Ubuntu Trusty now.

@wafflespeanut @frewsxcv Python question: So far it seems necessary to use --system-site-packages when creating the virtualenv to allow Salt to work properly (see the commit message for details). Does this seem OK to you or should I make a separate virtualenv for Salt?

@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch from 0e0f9d7 to f48f8e6 Jan 14, 2017
`mach` can't do any bootstrapping for Android, so the flag is useless.
@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch 2 times, most recently from 84429a2 to 6b00847 Jan 14, 2017
@aneeshusa aneeshusa changed the title WIP: Use Salt for mach bootstrap Use Salt for mach bootstrap Jan 14, 2017
@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 14, 2017

I've finished the remaining items on this, including a cleanup/overhaul of the existing bootstrapping. This is ready for review.

cc @UK992 since you wrote the original Windows bootstrapping, can you check that mach bootstrap still works on Windows?

@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 14, 2017

Note this is still blocked on servo/saltfs#577 landing, however.

proceed = raw_input(
'Proposed changes are above, proceed with bootstrap? [y/N]: '
)
if proceed not in ['y', 'yes', 'Y', 'Yes', 'YES']:

This comment has been minimized.

@wafflespeanut

wafflespeanut Jan 14, 2017

Member

if proceed.lower() not in ['y', 'yes']? 😄

@wafflespeanut
Copy link
Member

wafflespeanut commented Jan 14, 2017

This is great! 😄

Does this seem OK to you or should I make a separate virtualenv for Salt?

This should be fine, since pip install -I is going to reinstall our local requirements which will shadow the globally available libraries anyway.

@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch from 6b00847 to 9b6e5e4 Jan 14, 2017
@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 14, 2017

Also, I think this should work on macOS (using Homebrew) - if someone could check that I'll enable the Salt bootstrapper for macOS as well (instead of just Ubuntu 14.04).

@UK992
Copy link
Contributor

UK992 commented Jan 15, 2017

Since both gnu and msvc use same python, detection should be relied on host_triple.
For msvc, maybe could --force flag delete msvc-dependencies folder and reinstall all packages?
Also salt should be excluded in requirements.txt for Windows, because it's failed to create virtualenv.

@UK992
Copy link
Contributor

UK992 commented Jan 15, 2017

Also set() on WINDOWS_GNU packages list should be removed, because it fails to execute command.

@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch 3 times, most recently from 0263adf to 966a2c4 Jan 15, 2017
@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 15, 2017

@UK992

  • I haven't changed the GNU/MSVC detection from the original. I'm not sure exactly how to use host_triple, can you show me how I should use it here?
  • We shouldn't never need to delete the msvc-dependencies folder, since each package version is installed in its folder and never changed, so IMO a --force flag is unnecessary. If we do want that behavior it's different from what --force does for the other two, so I think we would need two flags at that point.
  • Addressed your other two comments.
@UK992
Copy link
Contributor

UK992 commented Jan 15, 2017

GNU/MSVC detection was broken for some time. Using host_triple:

if "windows-gnu" in host_triple():
    bootstrapper = windows_gnu
elif "windows-msvc" in host_triple():
    bootstrapper = windows_msvc
aneeshusa added 3 commits Jan 14, 2017
Extracting these functions helps avoid circular dependencies,
and make them easier to find/reuse.
Use the `desc` parameter instead to make the error messages
customized for the actual download.

Also use new-style format strings.
- Default to interactive mode and remove the `--interactive` flag
- Use `--force` to skip interactivity
- Change MSVC dependency storage organization on disk: put each version
  into its own folder and directly refer to the versioned folders,
  providing immutability and making the installation list redundant
- Reuse `host_triple()` function to fix broken bootstrapper dispatching
- Simplify code:
  - Remove or inline many unused and redudant functions and variables
  - Prefer plain functions to classes
  - Consolidate into fewer files, remove unnecessary bootstrapper/ dir
- Improve Python style
- Sort dependency list
@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch from 966a2c4 to 94dc386 Jan 15, 2017
@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 15, 2017

@UK992 OK thanks, I updated that. Can you give it a try and also run ./mach build on MSVC after bootstrapping? I want to ensure the reorganizing of msvc-dependencies didn't break the build_env function.

@UK992
Copy link
Contributor

UK992 commented Jan 15, 2017

@aneeshusa building works perfectly on MSVC.

The Salt bootstrapper invokes Salt during `./mach bootstrap`
to install Servo's build dependencies.
It uses salt-call pinned to the same version of Salt as used in saltfs.

Currently, the implementation uses gitfs and reads directly from
the master branch of the saltfs repo;
in the future this should be changed when the relevant Salt states
are moved in-tree as part of Dockerization for TaskCluster.

We have not Salted our Windows machines, so the existing Windows
bootstrappers are retained. Currently this is only tested on
Ubuntu Trusty.

Salt uses various system python libraries,
including `python-apt` on Debian-based OSes to interact with apt.
`python-apt` does not seem to be installable via a requirements.txt
file, and the versions available on PyPI are far behind the versions
installed on actual Ubuntu machines.
Additionally, adding `python-apt` as an unconditional python dependency
would add bloat for users of other OSes, and lead to more churn
as additional OSes are supported.
However, as `python-apt` is already installed via apt on these machines,
we can allow Salt to instead use the module by using
`--system-site-packages` for the python virtualenv.
We also add the `-I` flag to `pip install` to ensure we have a local,
untouched copy of any other python packages used.
However, because this prints system-level Python packages in scope,
it slightly breaks isolation, so it is important to always pin
all dependencies in the requirements files.
@aneeshusa aneeshusa force-pushed the aneeshusa:add-mach-bootstrap branch from 94dc386 to b4f5086 Jan 17, 2017
@aneeshusa
Copy link
Member Author

aneeshusa commented Jan 17, 2017

servo/saltfs#577 merged and I've updated this, so this is no longer blocked.

@jdm
Copy link
Member

jdm commented Jan 19, 2017

@metajack Review ping!

@metajack
Copy link
Contributor

metajack commented Jan 20, 2017

@bors-servo r+

Looks good to me.

@bors-servo
Copy link
Contributor

bors-servo commented Jan 20, 2017

📌 Commit b4f5086 has been approved by metajack

@bors-servo
Copy link
Contributor

bors-servo commented Jan 20, 2017

Testing commit b4f5086 with merge 1f76aa6...

bors-servo added a commit that referenced this pull request Jan 20, 2017
Use Salt for mach bootstrap

<!-- Please describe your changes on the following line: -->

This is currently WIP, but allows Salt for `mach bootstrap`. Not looking for review yet, just posting for visibility. You can run `./mach bootstrap` and Salt will run, letting you know what changes it would make for bootstrapping (doesn't actually run yet though).

Currently, this reads from saltfs using gitfs, meaning it always tracks the master branch. (Note that this is blocked on servo/saltfs#577 landing; in the meantime, I've included a small workaround in this PR to pull from my updated saltfs branch, which will need to be removed.) In the future, the relevant Salt code may be merged in tree as part of Docker support for TC, and the bootstrapper should be updated to read from in tree.

Also, our Windows machines have not been Salted, so the existing Windows bootstrappers are retained.

TODO:
- [x] Hook into existing bootstrapping code less hackily
- [x] Actually bootstrap instead of always using `test=True` mode (includes sudo)
- [x] Default to interactive mode (test first, then ask), with a force flag
- [x] Don't require running from the repository root directory
- [x] Make it easy to add support for other distros

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should be verified manually

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14974)
<!-- Reviewable:end -->
@bors-servo bors-servo merged commit b4f5086 into servo:master Jan 20, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Jan 20, 2017
3 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.