Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 61 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

sudo: required
# https://docs.travis-ci.com/user/trusty-ci-environment/
dist: xenial
Expand All @@ -7,33 +14,66 @@ python:
- "3.6"
- "3.7"
env:
- DB=postgres
addons:
# postgres versions provided by el7 RHSCL (lowest supportable version)
postgresql: "9.6"
matrix:
- DB=postgres TEST=pulp
- DB=postgres TEST=docs


matrix:
exclude:

- python: '3.6'
env: DB=postgres TEST=docs
fast_finish: true
services:
- postgresql
- redis-server
install: source .travis/install.sh
before_script: source .travis/before_script.sh
script: source .travis/script.sh
addons:
apt:
packages:
- httpie
- jq
# postgres versions provided by el7 RHSCL (lowest supportable version)
postgresql: '9.6'
before_install: .travis/before_install.sh
install: .travis/install.sh
before_script: .travis/before_script.sh
script: .travis/script.sh
after_failure:
- sh -c "cat ~/django_runserver.log"
- sh -c "cat ~/resource_manager.log"
- sh -c "cat ~/reserved_workers-1.log"
stages:
- name: test
- name: deploy
if: tag =~ ^3.0.0*
jobs:
include:
- stage: deploy
script: skip
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: pulp
password:
secure: O/1r6kCPWggV5sjmFACgGeml1dgMy8w46ku3atUiXyK5gJIVexbTMIXgLkpfTSu58ODBGoaW+ML6SQmC1K+82Vjq1OMURfrhvzolgSBhREMfM9lNjA52SoKCLzq4ldP31pOy/z3Z9T76vAJOWF7uI80jd2QJ2p+p6h101REl1dk=
on:
tags: true
- stage: deploy-plugin-to-pypi
script: bash .travis/publish_plugin_pypi.sh
if: tag IS present

- stage: publish-daily-client-gem
script: bash .travis/publish_client_gem.sh
env:
- DB=postgres
- TEST=bindings
if: type = cron
- stage: publish-daily-client-pypi
script: bash .travis/publish_client_pypi.sh
env:
- DB=postgres
- TEST=bindings
if: type = cron
- stage: publish-client-gem
script: bash .travis/publish_client_gem.sh
env:
- DB=postgres
- TEST=bindings
if: tag IS present
- stage: publish-client-pypi
script: bash .travis/publish_client_pypi.sh
env:
- DB=postgres
- TEST=bindings
if: tag IS present

notifications: None


86 changes: 86 additions & 0 deletions .travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/usr/bin/env bash

# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

set -mveuo pipefail

export PRE_BEFORE_INSTALL=$TRAVIS_BUILD_DIR/.travis/pre_before_install.sh
export POST_BEFORE_INSTALL=$TRAVIS_BUILD_DIR/.travis/post_before_install.sh

COMMIT_MSG=$(git log --format=%B --no-merges -1)
export COMMIT_MSG

if [ -x $PRE_BEFORE_INSTALL ]; then
$PRE_BEFORE_INSTALL
fi

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}')
export PULP_BINDINGS_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulp-openapi-generator\/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
./.travis/check_commit.sh



# Lint code.
flake8 --config flake8.cfg

cd ..
git clone --depth=1 https://github.com/pulp/ansible-pulp.git
if [ -n "$PULP_ROLES_PR_NUMBER" ]; then
cd ansible-pulp
git fetch --depth=1 origin +refs/pull/$PULP_ROLES_PR_NUMBER/merge
git checkout FETCH_HEAD
cd ..
fi

git clone --depth=1 https://github.com/pulp/pulpcore.git

if [ -n "$PULP_PR_NUMBER" ]; then
cd pulpcore
git fetch --depth=1 origin +refs/pull/$PULP_PR_NUMBER/merge
git checkout FETCH_HEAD
cd ..
fi


git clone --depth=1 https://github.com/pulp/pulpcore-plugin.git

if [ -n "$PULP_PLUGIN_PR_NUMBER" ]; then
cd pulpcore-plugin
git fetch --depth=1 origin +refs/pull/$PULP_PLUGIN_PR_NUMBER/merge
git checkout FETCH_HEAD
cd ..
fi


if [ -n "$PULP_SMASH_PR_NUMBER" ]; then
git clone --depth=1 https://github.com/PulpQE/pulp-smash.git
cd pulp-smash
git fetch --depth=1 origin +refs/pull/$PULP_SMASH_PR_NUMBER/merge
git checkout FETCH_HEAD
cd ..
fi

psql -c 'CREATE DATABASE pulp OWNER travis;'

pip install ansible
cp pulp_python/.travis/playbook.yml ansible-pulp/playbook.yml
cp pulp_python/.travis/postgres.yml ansible-pulp/postgres.yml

cd pulp_python

if [ -x $POST_BEFORE_INSTALL ]; then
$POST_BEFORE_INSTALL
fi
24 changes: 18 additions & 6 deletions .travis/before_script.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#!/usr/bin/env sh

# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

set -v

psql -U postgres -c 'CREATE USER pulp WITH SUPERUSER LOGIN;'
psql -U postgres -c 'CREATE DATABASE pulp OWNER pulp;'
export PRE_BEFORE_SCRIPT=$TRAVIS_BUILD_DIR/.travis/pre_before_script.sh
export POST_BEFORE_SCRIPT=$TRAVIS_BUILD_DIR/.travis/post_before_script.sh

if [ -f $PRE_BEFORE_SCRIPT ]; then
$PRE_BEFORE_SCRIPT
fi


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
if [ -f $POST_BEFORE_SCRIPT ]; then
$POST_BEFORE_SCRIPT
fi
36 changes: 36 additions & 0 deletions .travis/check_commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

# skip this check for everything but PRs
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
exit 0
fi

if [ "$TRAVIS_COMMIT_RANGE" != "" ]; then
RANGE=$TRAVIS_COMMIT_RANGE
elif [ "$TRAVIS_COMMIT" != "" ]; then
RANGE=$TRAVIS_COMMIT
fi

# Travis sends the ranges with 3 dots. Git only wants one.
if [[ "$RANGE" == *...* ]]; then
RANGE=`echo $TRAVIS_COMMIT_RANGE | sed 's/\.\.\./../'`
else
RANGE="$RANGE~..$RANGE"
fi

for sha in `git log --format=oneline --no-merges "$RANGE" | cut '-d ' -f1`
do
python .travis/validate_commit_message.py $sha
VALUE=$?

if [ "$VALUE" -gt 0 ]; then
exit $VALUE
fi
done
52 changes: 16 additions & 36 deletions .travis/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
#!/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}')

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]
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

git clone https://github.com/pulp/pulpcore-plugin.git
set -v

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
if [ "$TEST" = 'docs' ]; then
pip3 install -r doc_requirements.txt
fi

pip install -e ./pulpcore-plugin
pip install -r test_requirements.txt

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
# Run Ansible playbook
cd ../ansible-pulp
ansible-galaxy install -r requirements.yml

cd pulp_python
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"
9 changes: 9 additions & 0 deletions .travis/mariadb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

---
pulp_db_backend: django.db.backends.mysql
41 changes: 41 additions & 0 deletions .travis/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

---
- hosts: all
pre_tasks:
- name: Load DB variables
include_vars: '{{ pulp_db_type }}.yml'
vars:
pulp_default_admin_password: admin
pulp_source_dir: '{{ ansible_env.TRAVIS_BUILD_DIR | dirname }}/pulpcore/'
pulp_plugin_source_dir: "{{ ansible_env.TRAVIS_BUILD_DIR | dirname }}/pulpcore-plugin"
pulp_install_plugins:
pulp-python:
app_label: "python"
source_dir: "$TRAVIS_BUILD_DIR"
ansible_python_interpreter: '/opt/pyenv/shims/python3'
pulp_user: 'travis'
developer_user: 'travis'
pulp_install_db: false
pulp_preq_packages: []
pulp_settings:
content_host: 'localhost:24816'
secret_key: 'secret'
databases:
default:
ENGINE: "{{ pulp_db_backend }}"
USER: 'travis'
PASSWORD: ''
environment:
DJANGO_SETTINGS_MODULE: pulpcore.app.settings
roles:
- pulp-database
- pulp-workers
- pulp-resource-manager
- pulp-webserver
- pulp-content
9 changes: 9 additions & 0 deletions .travis/postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

---
pulp_db_backend: django.db.backends.postgresql_psycopg2
Loading