Skip to content

Commit

Permalink
Problem: plugin is out of date
Browse files Browse the repository at this point in the history
Solution: use plugin-template to update travis config

The code is now also formatted with black.

Migrations are committed.

closes: #5217
https://pulp.plan.io/issues/5217
  • Loading branch information
dkliban committed Aug 4, 2019
1 parent 2a6c167 commit 7f69c6f
Show file tree
Hide file tree
Showing 33 changed files with 564 additions and 476 deletions.
19 changes: 14 additions & 5 deletions .travis.yml
@@ -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 @@ -10,27 +17,24 @@ env:
matrix:
- DB=postgres TEST=pulp
- DB=postgres TEST=docs
- DB=mariadb TEST=pulp


matrix:
exclude:
- python: '3.6'
env: DB=mariadb TEST=pulp

- python: '3.6'
env: DB=postgres TEST=docs
fast_finish: true
services:
- postgresql
- redis-server
- mariadb
addons:
apt:
packages:
- httpie
- jq
# postgres versions provided by el7 RHSCL (lowest supportable version)
postgresql: '9.6'
mariadb: '10.3'
before_install: .travis/before_install.sh
install: .travis/install.sh
before_script: .travis/before_script.sh
Expand All @@ -44,6 +48,7 @@ jobs:
- 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:
Expand All @@ -68,3 +73,7 @@ jobs:
- DB=postgres
- TEST=bindings
if: tag IS present

notifications: None


74 changes: 44 additions & 30 deletions .travis/before_install.sh
@@ -1,73 +1,87 @@
#!/usr/bin/env sh
set -v
#!/usr/bin/env bash

COMMIT_MSG=$(git show HEAD^2 -s)
# 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 [ -f $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

# run black separately from flake8 to get a diff
black --check --diff .

# Lint code.
flake8 --config flake8.cfg || exit 1
flake8 --config flake8.cfg

cd ..
git clone https://github.com/pulp/ansible-pulp.git
git clone --depth=1 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
cd ansible-pulp
git fetch --depth=1 origin +refs/pull/$PULP_ROLES_PR_NUMBER/merge
git checkout FETCH_HEAD
popd
cd ..
fi

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

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


git clone https://github.com/pulp/pulpcore-plugin.git
git clone --depth=1 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
cd pulpcore-plugin
git fetch --depth=1 origin +refs/pull/$PULP_PLUGIN_PR_NUMBER/merge
git checkout FETCH_HEAD
popd
cd ..
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 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
popd
cd ..
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
psql -c 'CREATE DATABASE pulp OWNER travis;'

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

if [ -f $POST_BEFORE_INSTALL ]; then
$POST_BEFORE_INSTALL
fi
21 changes: 21 additions & 0 deletions .travis/before_script.sh
@@ -1,5 +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

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


if [ -f $POST_BEFORE_SCRIPT ]; then
$POST_BEFORE_SCRIPT
fi
7 changes: 7 additions & 0 deletions .travis/check_commit.sh
@@ -1,5 +1,12 @@
#!/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
Expand Down
14 changes: 14 additions & 0 deletions .travis/install.sh
@@ -1,6 +1,20 @@
#!/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

if [ "$TEST" = 'docs' ]; then
pip3 install -r doc_requirements.txt
fi

pip install -r test_requirements.txt

# Run Ansible playbook
cd ../ansible-pulp
ansible-galaxy install -r requirements.yml
Expand Down
7 changes: 7 additions & 0 deletions .travis/mariadb.yml
@@ -1,2 +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
22 changes: 17 additions & 5 deletions .travis/playbook.yml
@@ -1,13 +1,19 @@
# 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_secret_key: secret
pulp_source_dir: '/home/travis/build/pulp/pulpcore/'
pulp_plugin_source_dir: "/home/travis/build/pulp/pulpcore-plugin"
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-maven:
app_label: "maven"
Expand All @@ -16,9 +22,15 @@
pulp_user: 'travis'
developer_user: 'travis'
pulp_install_db: false
pulp_db_user: 'travis'
pulp_db_password: ''
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:
Expand Down
7 changes: 7 additions & 0 deletions .travis/postgres.yml
@@ -1,2 +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
12 changes: 9 additions & 3 deletions .travis/publish_client_gem.sh
@@ -1,5 +1,12 @@
#!/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

echo "---
:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
sudo chmod 600 ~/.gem/credentials
Expand All @@ -14,7 +21,7 @@ if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then
export VERSION=${REPORTED_VERSION}
else
export EPOCH="$(date +%s)"
export VERSION=${REPORTED_VERSION}.${EPOCH}
export VERSION=${REPORTED_VERSION}${EPOCH}
fi

export response=$(curl --write-out %{http_code} --silent --output /dev/null https://rubygems.org/gems/pulp_maven_client/versions/$VERSION)
Expand All @@ -28,8 +35,7 @@ cd
git clone https://github.com/pulp/pulp-openapi-generator.git
cd pulp-openapi-generator

sudo ./generate.sh pulp_maven ruby $VERSION
sudo chown -R travis:travis pulp_maven-client
./generate.sh pulp_maven ruby $VERSION
cd pulp_maven-client
gem build pulp_maven_client
GEM_FILE="$(ls | grep pulp_maven_client-)"
Expand Down
14 changes: 10 additions & 4 deletions .travis/publish_client_pypi.sh
@@ -1,18 +1,25 @@
#!/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

pip install twine

django-admin runserver 24817 >> ~/django_runserver.log 2>&1 &
sleep 5

cd /home/travis/build/pulp/pulp_maven/
cd "${TRAVIS_BUILD_DIR}"
export REPORTED_VERSION=$(http :24817/pulp/api/v3/status/ | jq --arg plugin pulp_maven -r '.versions[] | select(.component == $plugin) | .version')
export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)"
if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then
export VERSION=${REPORTED_VERSION}
else
export EPOCH="$(date +%s)"
export VERSION=${REPORTED_VERSION}.${EPOCH}
export VERSION=${REPORTED_VERSION}${EPOCH}
fi

export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulp-file-client/$VERSION/)
Expand All @@ -26,8 +33,7 @@ cd
git clone https://github.com/pulp/pulp-openapi-generator.git
cd pulp-openapi-generator

sudo ./generate.sh pulp_maven python $VERSION
sudo chown -R travis:travis pulp_maven-client
./generate.sh pulp_maven python $VERSION
cd pulp_maven-client
python setup.py sdist bdist_wheel --python-tag py3
twine upload dist/* -u pulp -p $PYPI_PASSWORD
Expand Down
9 changes: 8 additions & 1 deletion .travis/publish_plugin_pypi.sh
@@ -1,6 +1,13 @@
#!/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

pip install twine

python setup.py sdist bdist_wheel --python-tag py3
twine upload dist/* -u pulp -p $PYPI_PASSWORD
twine upload dist/* -u None -p $PYPI_PASSWORD

0 comments on commit 7f69c6f

Please sign in to comment.