Skip to content

Commit

Permalink
Fix Travis tests and test new features
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Jan 26, 2019
1 parent 95b35de commit 35e08fd
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
25 changes: 7 additions & 18 deletions .travis.yml
Expand Up @@ -3,29 +3,18 @@ language: python
python: "2.7"
sudo: required

before_install:
- export GALAXY_HOME=/home/galaxy
- export GALAXY_TRAVIS_USER=galaxy
- export GALAXY_UID=1450
- export GALAXY_GID=1450
- sudo groupadd -r $GALAXY_TRAVIS_USER -g $GALAXY_GID
- sudo useradd -u $GALAXY_UID -r -g $GALAXY_TRAVIS_USER -d $GALAXY_HOME -p travis_testing -c "Galaxy user" $GALAXY_TRAVIS_USER
- sudo mkdir $GALAXY_HOME
- sudo chown -R $GALAXY_TRAVIS_USER:$GALAXY_TRAVIS_USER $GALAXY_HOME
- sudo chmod -R 755 $GALAXY_HOME

install:
# Install an upgraded pip and virtualenv
# Install git
- sudo apt-get install git
- sudo apt-get install python-pip
- pip install virtualenv
- pip install --upgrade pip

# Install Ansible.
# Install Ansible
- pip install ansible==2.5

# Add ansible.cfg to pick up roles path.
# Add ansible.cfg to pick up roles path
- printf '[defaults]\nroles_path = ../' > ansible.cfg

script:
- ansible-playbook -i "localhost, " -c local tests/test_playbook.yml
# Use sudo since we are using become from an unprivileged user to an unprivileged user, to work around:
# https://docs.ansible.com/ansible/latest/user_guide/become.html#becoming-an-unprivileged-user
# On a real system, you would want to use one of the workarounds in the docs (of which this is the third)
- sudo $VIRTUAL_ENV/bin/ansible-playbook -i "localhost, " -c local tests/test_playbook.yml
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -163,7 +163,7 @@ Options for controlling where certain Galaxy components are placed on the filesy
**User management and privilege separation**

- `galaxy_separate_privileges` (default: `no`): Enable privilege separation mode.
- `galaxy_user` (default: `galaxy`): The name of the system user under which Galaxy runs.
- `galaxy_user` (default: user running ansible): The name of the system user under which Galaxy runs.
- `galaxy_privsep_user` (default: `root`): The name of the system user that owns the Galaxy code, config files, and
virtualenv (and dependencies therein).
- `galaxy_group`: Common group between the Galaxy user and privilege separation user. If set and `galaxy_manage_paths`
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Expand Up @@ -62,7 +62,7 @@ galaxy_remote_users: {}
galaxy_separate_privileges: no

# User that Galaxy runs as
galaxy_user: galaxy
galaxy_user: "{{ ansible_user_id }}"

# User that owns Galaxy code, configs, and virutalenv, and that runs `pip install` for dependencies
galaxy_privsep_user: root
Expand Down
2 changes: 1 addition & 1 deletion tasks/clone.yml
Expand Up @@ -35,7 +35,7 @@
- email administrator with commit id

- name: Include virtualenv setup tasks
include_tasks: virtualenv.yml
import_tasks: virtualenv.yml

- name: Remove orphaned .pyc files and compile bytecode
script: "makepyc.py {{ galaxy_server_dir }}/lib"
Expand Down
3 changes: 2 additions & 1 deletion tasks/dependencies.yml
Expand Up @@ -5,7 +5,7 @@
block:

- name: Include virtualenv setup tasks
include_tasks: virtualenv.yml
import_tasks: virtualenv.yml

# virtualenv_command is still required if `virtualenv` isn't on $PATH, even if the venv already exists.
- name: Install Galaxy base dependencies
Expand Down Expand Up @@ -33,6 +33,7 @@
environment:
PYTHONPATH: null
VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
when: conditional_dependencies.stdout_lines | length > 0

remote_user: "{{ galaxy_remote_users.privsep | default(omit) }}"
become: "{{ galaxy_become_users.privsep is not undefined }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/download.yml
Expand Up @@ -29,7 +29,7 @@
when: not download_receipt.stat.exists

- name: Include virtualenv setup tasks
include_tasks: virtualenv.yml
import_tasks: virtualenv.yml

- name: Remove orphaned .pyc files and compile bytecode
script: makepyc.py {{ galaxy_server_dir }}/lib
Expand Down
2 changes: 1 addition & 1 deletion tasks/layout.yml
Expand Up @@ -12,8 +12,8 @@
- galaxy_venv_dir
- galaxy_server_dir
- galaxy_config_dir
- galaxy_mutable_config_dir
- galaxy_mutable_data_dir
- galaxy_mutable_config_dir
- galaxy_shed_tools_dir
- galaxy_cache_dir

Expand Down
17 changes: 14 additions & 3 deletions tests/test_playbook.yml
Expand Up @@ -6,11 +6,22 @@
connection: local
remote_user: travis
vars:
galaxy_commit_id: release_18.05
galaxy_commit_id: release_18.09
galaxy_create_user: yes
galaxy_manage_paths: yes
galaxy_manage_clone: yes
galaxy_manage_download: no
galaxy_server_dir: /home/galaxy/server
galaxy_config_style: yaml
galaxy_layout: root-dir
galaxy_root: /srv/galaxy
galaxy_separate_privileges: yes
galaxy_user: galaxy
galaxy_privsep_user: gxpriv
galaxy_config:
galaxy:
database_connection: sqlite:///{{ galaxy_mutable_data_dir }}/universe.sqlite
# needed because we've disabled facts
ansible_user_uid: "{{ lookup('env', 'UID') }}"
ansible_user_id: "{{ lookup('env', 'USER') }}"
roles:
- role: ansible-galaxy
become: yes

0 comments on commit 35e08fd

Please sign in to comment.