-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: ansible-pulp is not used to deploy on Travis
Solution: use ansible-pulp when deploying on Travis This patch was generated using the plugin_template boostrap script. If this works, I will add a separate script that will update plugins instead of bootstrapping new ones. re: #4773 https://pulp.plan.io/issues/4773
- Loading branch information
Showing
8 changed files
with
208 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env sh | ||
set -v | ||
|
||
COMMIT_MSG=$(git show HEAD^2 -s) | ||
export COMMIT_MSG | ||
export PULP_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
export PULP_PLUGIN_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore-plugin\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
export PULP_SMASH_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/PulpQE\/pulp-smash\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
export PULP_ROLES_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/ansible-pulp\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
|
||
# dev_requirements should not be needed for testing; don't install them to make sure | ||
pip install -r test_requirements.txt | ||
|
||
# check the commit message | ||
# uncomment for plugins that use pulp.plan.io as issue tracker | ||
# ./.travis/check_commit.sh | ||
|
||
# Lint code. | ||
flake8 --config flake8.cfg || exit 1 | ||
|
||
cd .. | ||
git clone https://github.com/pulp/ansible-pulp.git | ||
if [ -n "$PULP_ROLES_PR_NUMBER" ]; then | ||
pushd ansible-pulp | ||
git fetch origin +refs/pull/$PULP_ROLES_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
fi | ||
|
||
git clone https://github.com/pulp/pulpcore.git | ||
|
||
if [ -n "$PULP_PR_NUMBER" ]; then | ||
pushd pulpcore | ||
git fetch origin +refs/pull/$PULP_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
fi | ||
|
||
|
||
git clone https://github.com/pulp/pulpcore-plugin.git | ||
|
||
if [ -n "$PULP_PLUGIN_PR_NUMBER" ]; then | ||
pushd pulpcore-plugin | ||
git fetch origin +refs/pull/$PULP_PLUGIN_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
fi | ||
|
||
|
||
if [ -n "$PULP_SMASH_PR_NUMBER" ]; then | ||
git clone https://github.com/PulpQE/pulp-smash.git | ||
pushd pulp-smash | ||
git fetch origin +refs/pull/$PULP_SMASH_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
fi | ||
|
||
if [ "$DB" = 'mariadb' ]; then | ||
# working around https://travis-ci.community/t/mariadb-build-error-with-xenial/3160 | ||
mysql -u root -e "DROP USER IF EXISTS 'travis'@'%';" | ||
mysql -u root -e "CREATE USER 'travis'@'%';" | ||
mysql -u root -e "CREATE DATABASE pulp;" | ||
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'%';"; | ||
else | ||
psql -c 'CREATE DATABASE pulp OWNER travis;' | ||
fi | ||
|
||
pip install ansible | ||
cp pulp_maven/.travis/playbook.yml ansible-pulp/playbook.yml | ||
cp pulp_maven/.travis/postgres.yml ansible-pulp/postgres.yml | ||
cp pulp_maven/.travis/mariadb.yml ansible-pulp/mariadb.yml | ||
|
||
cd pulp_maven |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
#!/usr/bin/env sh | ||
set -v | ||
|
||
psql -U postgres -c 'CREATE USER pulp WITH SUPERUSER LOGIN;' | ||
psql -U postgres -c 'CREATE DATABASE pulp OWNER pulp;' | ||
|
||
mkdir -p ~/.config/pulp_smash | ||
cp ../pulpcore/.travis/pulp-smash-config.json ~/.config/pulp_smash/settings.json | ||
|
||
sudo mkdir -p /var/lib/pulp/tmp | ||
sudo mkdir /etc/pulp/ | ||
sudo chown -R travis:travis /var/lib/pulp | ||
|
||
echo "SECRET_KEY: \"$(cat /dev/urandom | tr -dc 'a-z0-9!@#$%^&*(\-_=+)' | head -c 50)\"" | sudo tee -a /etc/pulp/settings.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,10 @@ | ||
#!/usr/bin/env sh | ||
set -v | ||
|
||
export COMMIT_MSG=$(git show HEAD^2 -s) | ||
export PULP_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
export PULP_PLUGIN_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore-plugin\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
export PULP_SMASH_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/PulpQE\/pulp-smash\/pull\/(\d+)' | awk -F'/' '{print $7}') | ||
# Run Ansible playbook | ||
cd ../ansible-pulp | ||
ansible-galaxy install -r requirements.yml | ||
|
||
pip install -r test_requirements.txt | ||
|
||
cd .. && git clone https://github.com/pulp/pulpcore.git | ||
|
||
if [ -n "$PULP_PR_NUMBER" ]; then | ||
pushd pulpcore | ||
git fetch origin +refs/pull/$PULP_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
fi | ||
|
||
pip install -e ./pulpcore[postgres] | ||
|
||
git clone https://github.com/pulp/pulpcore-plugin.git | ||
|
||
if [ -n "$PULP_PLUGIN_PR_NUMBER" ]; then | ||
pushd pulpcore-plugin | ||
git fetch origin +refs/pull/$PULP_PLUGIN_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
fi | ||
|
||
pip install ./pulpcore-plugin | ||
|
||
if [ -n "$PULP_SMASH_PR_NUMBER" ]; then | ||
pip uninstall -y pulp-smash | ||
git clone https://github.com/PulpQE/pulp-smash.git | ||
pushd pulp-smash | ||
git fetch origin +refs/pull/$PULP_SMASH_PR_NUMBER/merge | ||
git checkout FETCH_HEAD | ||
popd | ||
pip install -e ./pulp-smash | ||
fi | ||
|
||
cd pulp_maven | ||
pip install -e . | ||
ansible-playbook --connection=local --inventory 127.0.0.1, playbook.yml --extra-vars \ | ||
"pulp_python_interpreter=$VIRTUAL_ENV/bin/python, pulp_install_dir=$VIRTUAL_ENV \ | ||
pulp_db_type=$DB" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
pulp_db_backend: django.db.backends.mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
- hosts: all | ||
pre_tasks: | ||
- name: Load DB variables | ||
include_vars: '{{ pulp_db_type }}.yml' | ||
vars: | ||
pulp_default_admin_password: admin | ||
pulp_secret_key: secret | ||
pulp_source_dir: '/home/travis/build/pulp/pulpcore/' | ||
pulp_plugin_source_dir: "/home/travis/build/pulp/pulpcore-plugin" | ||
pulp_install_plugins: | ||
pulp-maven: | ||
app_label: "maven" | ||
source_dir: "/home/travis/build/pulp/pulp_maven" | ||
ansible_python_interpreter: '/opt/pyenv/shims/python3' | ||
pulp_user: 'travis' | ||
developer_user: 'travis' | ||
pulp_install_db: false | ||
pulp_db_user: 'travis' | ||
pulp_db_password: '' | ||
pulp_preq_packages: [] | ||
environment: | ||
DJANGO_SETTINGS_MODULE: pulpcore.app.settings | ||
roles: | ||
- pulp-database | ||
- pulp-workers | ||
- pulp-resource-manager | ||
- pulp-webserver | ||
- pulp-content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
pulp_db_backend: django.db.backends.postgresql_psycopg2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters