Skip to content

Commit

Permalink
Fix Travis-CI cache sometimes erroring on updating (#1112)
Browse files Browse the repository at this point in the history
* try chown on /home/travis/.stack

* remove unnecessary check

* chown the right directory

* update pylint_runner to be python3 on travis
  • Loading branch information
MasterOdin committed Jun 28, 2017
1 parent 68653ec commit ec9e197
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MASTER]
ignore=sample_files,more_autograding_examples,vendor
7 changes: 6 additions & 1 deletion .setup/bin/create_untrusted_users.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env python

"""
This creates untrusted users for the system starting at untrusted00 and going up to untrusted59.
We use these users to then run our autograding tests against student submissions in a tmp directory.
These users have very little permissions and access to the system at large.
"""
import os
import pwd


for i in range(0, 60):
user = "untrusted" + str(i).zfill(2)
try:
Expand Down
37 changes: 22 additions & 15 deletions .setup/bin/partial_reset.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/usr/bin/env python3
"""
This does a more partial reset of the system compared to reset_system.py, primarily not wiping various changes like
removing DB users, all created users (including system ones like hwphp, hwcgi, etc.), removing networking stuff, etc.
This script acts more like the inverse of "setup_sample_courses.py" so that we could only run these two scripts in
opposition and not run into a corrupted system state. This should then give us a nice stability that
This does a more partial reset of the system compared to reset_system.py, primarily not wiping
various changes like removing DB users, all created users (including system ones like hwphp,
hwcgi, etc.), removing networking stuff, etc.
This script acts more like the inverse of "setup_sample_courses.py" so that we could only run
these two scripts in opposition and not end up in a corrupted system state. This gives us a
nice balance for developing when we're not actively changing integral parts of the system that
would require a new vagrant install (or at least a rerun of install_system.sh).
"""
import argparse
import glob
import os
import pwd
import shutil
import sys

import yaml

Expand Down Expand Up @@ -62,20 +64,22 @@ def cmd_exists(cmd):


def parse_args():
"""Generate arguments for the CLI"""
parser = argparse.ArgumentParser(description="")
parser.add_argument("--force", action="store_true",
help="Run this script skipping the 'are you sure' prompts. These are also bypassed if .vagrant "
"folder is detected.")
help="Run this script skipping the 'are you sure' prompts. These are also "
"bypassed if .vagrant folder is detected.")
parser.add_argument("--users_path", default=os.path.join(SETUP_DATA_PATH, "users"),
help="Path to folder that contains .yml files to use for user creation. Defaults to "
"../data/users")
help="Path to folder that contains .yml files to use for user creation. "
"Defaults to ../data/users")
parser.add_argument("--courses_path", default=os.path.join(SETUP_DATA_PATH, "courses"),
help="Path to the folder that contains .yml files to use for course creation. Defaults to "
"../data/courses")
help="Path to the folder that contains .yml files to use for course "
"creation. Defaults to ../data/courses")
return parser.parse_args()


def main():
"""Primary function"""
args = parse_args()
if not os.path.isdir(os.path.join(CURRENT_PATH, "..", "..", ".vagrant")) and not args.force:
inp = input("Do you really want to reset the system? There's no undo! [y/n]")
Expand All @@ -91,10 +95,12 @@ def main():
os.system("rm -rf {}/*_logs".format(SUBMITTY_DATA_DIR))
os.system('rm -r {}/.vagrant/autograding_logs'.format(SUBMITTY_REPOSITORY))
os.system('mkdir {}/.vagrant/autograding_logs'.format(SUBMITTY_REPOSITORY))
os.system('ln -s {}/.vagrant/autograding_logs {}/autograding_logs'.format(SUBMITTY_REPOSITORY, SUBMITTY_DATA_DIR))
os.system('ln -s {}/.vagrant/autograding_logs {}/autograding_logs'
.format(SUBMITTY_REPOSITORY, SUBMITTY_DATA_DIR))
os.system('rm -r {}/.vagrant/tagrading_logs'.format(SUBMITTY_REPOSITORY))
os.system('mkdir {}/.vagrant/tagrading_logs'.format(SUBMITTY_REPOSITORY))
os.system('ln -s {}/.vagrant/tagrading_logs {}/tagrading_logs'.format(SUBMITTY_REPOSITORY, SUBMITTY_DATA_DIR))
os.system('ln -s {}/.vagrant/tagrading_logs {}/tagrading_logs'
.format(SUBMITTY_REPOSITORY, SUBMITTY_DATA_DIR))

if cmd_exists('psql'):
os.environ['PGPASSWORD'] = 'hsdbu'
Expand All @@ -118,7 +124,8 @@ def main():
groups.append(course['code'] + "_archive")
groups.append(course['code'] + "_tas_www")
for queue in ["to_be_graded_batch", "to_be_graded_interactive"]:
for queue_file in glob.iglob(os.path.join(SUBMITTY_DATA_DIR, queue, "*__{}__*".format(course['code']))):
path = os.path.join(SUBMITTY_DATA_DIR, queue, "*__{}__*".format(course['code']))
for queue_file in glob.iglob(path):
os.remove(queue_file)

for group in groups:
Expand Down
2 changes: 1 addition & 1 deletion .setup/bin/reset_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def remove_lines(filename, lines):
"""
if not os.path.isfile(filename):
return
if not isinstance(lines, list) or len(lines) == 0:
if not isinstance(lines, list) or not lines:
return
stat = os.stat(filename)
with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp_file:
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ before_install:
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

install:
- if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.5" ]]; then sudo add-apt-repository -y ppa:ondrej/php; sudo apt-get -qq update; fi
- sudo add-apt-repository -y ppa:ondrej/php; sudo apt-get -qq update;
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then sudo apt-get -y install libapache2-mod-php5.6 php5.6-pgsql php5.6-curl; a2enmod php5.6; fi
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then sudo apt-get -y install libapache2-mod-php7.0 php7.0-pgsql php7.0-curl; a2enmod php7.0; fi
- wget http://chromedriver.storage.googleapis.com/2.24/chromedriver_linux64.zip
Expand Down Expand Up @@ -130,12 +130,13 @@ script:
- if [ ${INTEGRATION_SUITE} = false ]; then vendor/bin/phpunit --configuration tests/phpunit.xml; fi
- if [ ${INTEGRATION_SUITE} = false ]; then TEST_URL="http://localhost" nose2 -v --start-dir="tests/e2e"; fi
- if [ ${INTEGRATION_SUITE} = true ]; then sudo python /usr/local/submitty/test_suite/integrationTests/run.py; fi
- sudo chown -R ${USER}:${USER} ${HOME}/.stack

# Add more linters to the build process here
after_script:
# Eventually this should be moved into the "script" once we've gotten the build to a point where all contained
# python files will actually pass (which a lot right now will not)
- pylint_runner -v ${TRAVIS_BUILD_DIR}
- pylint_runner3 -v ${TRAVIS_BUILD_DIR}
# - sudo ./.setup/travis/print_debug.sh
# if this fails, it only prints, travis does not fail
- sudo /usr/local/submitty/bin/check_everything.py
Expand Down

0 comments on commit ec9e197

Please sign in to comment.