Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Trust that LXC setup has done the right thing w.r.t sources.list.
Browse files Browse the repository at this point in the history
Summary: This also makes it easier to work with different distributions.

Test Plan: See what fails on Changes first

Reviewers: kylec, naphat

Reviewed By: naphat

Subscribers: changesbot, wwu

Differential Revision: https://tails.corp.dropbox.com/D233146
  • Loading branch information
Anup Chenthamarakshan committed Sep 29, 2016
1 parent 687a987 commit 96dda8f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 50 deletions.
5 changes: 0 additions & 5 deletions changes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,6 @@ def create_app(_read_config=True, **config):
# be truncated.
app.config['TEST_MESSAGE_MAX_LEN'] = 64 * 1024

# sources.list entry, format is:
# deb uri distribution [component1] [component2] [...]
# Used for bazel setup, so source should have bazel package.
app.config['APT_SPEC'] = None

# List of packages needed to install bazel and any environment.
app.config['BAZEL_APT_PKGS'] = ['bazel']

Expand Down
18 changes: 1 addition & 17 deletions changes/utils/bazel_setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
from flask import current_app


# Assume that apt sources have been set up correctly up front, and `apt-get update` run already.
BASH_BAZEL_SETUP = """#!/bin/bash -eux
# Clean up any existing apt sources
sudo rm -rf /etc/apt/sources.list.d
# Overwrite apt sources
echo "{apt_spec}" | sudo tee /etc/apt/sources.list
# apt-get update, and try again if it fails first time
sudo apt-get -y update || sudo apt-get -y update
sudo apt-get install -y --force-yes {bazel_apt_pkgs}
/usr/bin/bazel --nomaster_blazerc --blazerc=/dev/null --output_user_root={bazel_root} --batch version
Expand All @@ -19,13 +12,6 @@
# We also redirect stdout and stderr to /dev/null because changes uses the output of this
# script to collect tests, and so we don't want extraneous output.
COLLECT_BAZEL_TARGETS = """#!/bin/bash -eu
# Clean up any existing apt sources
sudo rm -rf /etc/apt/sources.list.d >/dev/null 2>&1
# Overwrite apt sources
(echo "{apt_spec}" | sudo tee /etc/apt/sources.list) >/dev/null 2>&1
# apt-get update, and try again if it fails first time
(sudo apt-get -y update || sudo apt-get -y update) >/dev/null 2>&1
sudo apt-get install -y --force-yes {bazel_apt_pkgs} python >/dev/null 2>&1
"{collect_targets_executable}" --output-user-root="{bazel_root}" {bazel_targets} {bazel_exclude_tags} {bazel_test_flags} --jobs="{max_jobs}" 2> /dev/null
Expand All @@ -39,7 +25,6 @@

def get_bazel_setup():
return BASH_BAZEL_SETUP.format(
apt_spec=current_app.config['APT_SPEC'],
bazel_apt_pkgs=' '.join(current_app.config['BAZEL_APT_PKGS']),
bazel_root=current_app.config['BAZEL_ROOT_PATH'],
)
Expand All @@ -59,7 +44,6 @@ def collect_bazel_targets(collect_targets_executable, bazel_targets, bazel_exclu
"""
# type: (str, List[str], List[str], int, changes.vcs.base.Vcs) -> str
return COLLECT_BAZEL_TARGETS.format(
apt_spec=current_app.config['APT_SPEC'],
bazel_apt_pkgs=' '.join(current_app.config['BAZEL_APT_PKGS']),
bazel_root=current_app.config['BAZEL_ROOT_PATH'],
bazel_targets=' '.join(['--target-patterns={}'.format(t) for t in bazel_targets]),
Expand Down
28 changes: 0 additions & 28 deletions tests/changes/models/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ def test_autogenerated_commands(self, get_config):
_, implementation = JobPlan.get_build_step_for_job(job.id)

bazel_setup_expected = """#!/bin/bash -eux
# Clean up any existing apt sources
sudo rm -rf /etc/apt/sources.list.d
# Overwrite apt sources
echo "deb http://example.com/debian distribution component1" | sudo tee /etc/apt/sources.list
# apt-get update, and try again if it fails first time
sudo apt-get -y update || sudo apt-get -y update
sudo apt-get install -y --force-yes bazel
/usr/bin/bazel --nomaster_blazerc --blazerc=/dev/null --output_user_root=/bazel/root/path --batch version
Expand All @@ -78,13 +71,6 @@ def test_autogenerated_commands(self, get_config):
""".strip()

collect_targets_expected = """#!/bin/bash -eu
# Clean up any existing apt sources
sudo rm -rf /etc/apt/sources.list.d >/dev/null 2>&1
# Overwrite apt sources
(echo "deb http://example.com/debian distribution component1" | sudo tee /etc/apt/sources.list) >/dev/null 2>&1
# apt-get update, and try again if it fails first time
(sudo apt-get -y update || sudo apt-get -y update) >/dev/null 2>&1
sudo apt-get install -y --force-yes bazel python >/dev/null 2>&1
"/var/changes/input/collect-targets" --output-user-root="/bazel/root/path" --target-patterns=//aa/bb/cc/... --target-patterns=//aa/abc/... --test-flags=--spawn_strategy=sandboxed --test-flags=--genrule_strategy=sandboxed --test-flags=--keep_going --jobs="8" 2> /dev/null
Expand Down Expand Up @@ -127,13 +113,6 @@ def test_autogenerated_commands_with_exclusions(self, get_config):
}

collect_tests_expected = """#!/bin/bash -eu
# Clean up any existing apt sources
sudo rm -rf /etc/apt/sources.list.d >/dev/null 2>&1
# Overwrite apt sources
(echo "deb http://example.com/debian distribution component1" | sudo tee /etc/apt/sources.list) >/dev/null 2>&1
# apt-get update, and try again if it fails first time
(sudo apt-get -y update || sudo apt-get -y update) >/dev/null 2>&1
sudo apt-get install -y --force-yes bazel python >/dev/null 2>&1
"/var/changes/input/collect-targets" --output-user-root="/bazel/root/path" --target-patterns=//foo/bar/baz/... --target-patterns=//bar/bax/... --exclude-tags=flaky --exclude-tags=another_tag --test-flags=--spawn_strategy=sandboxed --test-flags=--genrule_strategy=sandboxed --test-flags=--keep_going --jobs="4" 2> /dev/null
Expand Down Expand Up @@ -178,13 +157,6 @@ def test_autogenerated_commands_with_additional_test_flags(self, get_config):
}

collect_tests_expected = """#!/bin/bash -eu
# Clean up any existing apt sources
sudo rm -rf /etc/apt/sources.list.d >/dev/null 2>&1
# Overwrite apt sources
(echo "deb http://example.com/debian distribution component1" | sudo tee /etc/apt/sources.list) >/dev/null 2>&1
# apt-get update, and try again if it fails first time
(sudo apt-get -y update || sudo apt-get -y update) >/dev/null 2>&1
sudo apt-get install -y --force-yes bazel python >/dev/null 2>&1
"/var/changes/input/collect-targets" --output-user-root="/bazel/root/path" --target-patterns=//foo/bar/baz/... --target-patterns=//bar/bax/... --test-flags=--spawn_strategy=sandboxed --test-flags=--genrule_strategy=sandboxed --test-flags=--keep_going --test-flags=--test_env=testing=123 --jobs="4" 2> /dev/null
Expand Down

0 comments on commit 96dda8f

Please sign in to comment.