mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-02 20:59:06 +08:00
Merge #1496 Upgrade Vagrant to use Fedora 31
This commit is contained in:
96
Vagrantfile
vendored
96
Vagrantfile
vendored
@@ -7,73 +7,35 @@ $script = <<SCRIPT
|
||||
echo "export MODULE_BUILD_SERVICE_DEVELOPER_ENV=1" > /etc/profile.d/module_build_service_developer_env.sh
|
||||
source /etc/profile.d/module_build_service_developer_env.sh
|
||||
dnf install -y \
|
||||
fedmsg-hub \
|
||||
fedmsg-relay \
|
||||
fedpkg \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
git \
|
||||
koji \
|
||||
krb5-devel \
|
||||
krb5-workstation \
|
||||
libffi-devel \
|
||||
mock-scm \
|
||||
openssl-devel \
|
||||
python \
|
||||
python-devel \
|
||||
python2-dnf \
|
||||
python-docutils \
|
||||
python-flask \
|
||||
python2-libmodulemd \
|
||||
python-m2ext \
|
||||
python-mock \
|
||||
python-qpid \
|
||||
python-solv \
|
||||
python-sqlalchemy \
|
||||
python-futures \
|
||||
python2-pungi \
|
||||
python3 \
|
||||
python3-devel \
|
||||
python3-docutils \
|
||||
python3-pungi \
|
||||
python3-virtualenv \
|
||||
redhat-rpm-config \
|
||||
redhat-rpm-config \
|
||||
rpm-build \
|
||||
swig \
|
||||
sqlite \
|
||||
bash-completion \
|
||||
wget \
|
||||
which
|
||||
|
||||
bash-completion \
|
||||
python3-flake8 \
|
||||
python3-mock \
|
||||
python3-pytest \
|
||||
python3-pytest-cov \
|
||||
python3-tox \
|
||||
rpm-build \
|
||||
sqlite
|
||||
# Install the runtime dependencies from the module-build-service spec file
|
||||
curl -s https://src.fedoraproject.org/rpms/module-build-service/raw/master/f/module-build-service.spec -o /tmp/module-build-service.spec
|
||||
dnf install -y $(rpmspec --parse /tmp/module-build-service.spec | grep ^Requires: | tr -s ' ' | cut -d ' ' -f2)
|
||||
mbs_config_dir=/etc/module-build-service
|
||||
[ -e "$mbs_config_dir" ] || mkdir "$mbs_config_dir"
|
||||
cp -r /opt/module_build_service/conf/* "$mbs_config_dir"
|
||||
cd /opt/module_build_service
|
||||
cp -r conf/* "$mbs_config_dir"
|
||||
|
||||
# Workaround because python3-koji has no egg-info file
|
||||
sed -i '/koji/d' requirements.txt
|
||||
# Remove Python 2 only dependencies
|
||||
sed -i '/futures/d' requirements.txt
|
||||
sed -i '/enum34/d' requirements.txt
|
||||
|
||||
python3 setup.py develop --no-deps
|
||||
python3 setup.py egg_info
|
||||
SCRIPT
|
||||
|
||||
$make_devenv = <<DEVENV
|
||||
set -e
|
||||
env_dir=~/devenv
|
||||
pip=${env_dir}/bin/pip
|
||||
py=${env_dir}/bin/python
|
||||
code_dir=/opt/module_build_service
|
||||
|
||||
test -e $env_dir && rm -rf $env_dir
|
||||
|
||||
# solv is not availabe from pypi.org. libsolv has to be installed by dnf.
|
||||
(cd; virtualenv -p python2 --system-site-packages devenv)
|
||||
|
||||
$pip install --upgrade pip kobo
|
||||
$pip install -r $code_dir/test-requirements.txt
|
||||
$pip install ipython
|
||||
|
||||
cd $code_dir
|
||||
$py setup.py develop
|
||||
$py setup.py egg_info
|
||||
|
||||
if ! grep ". $env_dir/bin/activate" ~/.bashrc >/dev/null; then
|
||||
echo ". $env_dir/bin/activate" >> ~/.bashrc
|
||||
fi
|
||||
if ! grep "^cd $code_dir" ~/.bashrc >/dev/null; then
|
||||
# Go to working directory after login
|
||||
echo "cd $code_dir" >> ~/.bashrc
|
||||
@@ -81,7 +43,7 @@ $make_devenv = <<DEVENV
|
||||
DEVENV
|
||||
|
||||
$config_pgsql = <<PGSQL
|
||||
dnf install -y postgresql postgresql-server python2-psycopg2
|
||||
dnf install -y postgresql postgresql-server python3-psycopg2
|
||||
|
||||
pg_hba_conf=/var/lib/pgsql/data/pg_hba.conf
|
||||
|
||||
@@ -112,22 +74,12 @@ systemctl restart postgresql
|
||||
psql -U postgres -h 127.0.0.1 -c "DROP DATABASE IF EXISTS mbstest"
|
||||
psql -U postgres -h 127.0.0.1 -c "CREATE DATABASE mbstest"
|
||||
|
||||
bashrc=/home/vagrant/.bashrc
|
||||
|
||||
echo "******** Run Tests with PostgreSQL ********"
|
||||
echo "Set this environment variable to test with PostgreSQL"
|
||||
echo "export DATABASE_URI=postgresql+psycopg2://postgres:@127.0.0.1/mbstest"
|
||||
echo
|
||||
PGSQL
|
||||
|
||||
$script_services = <<SCRIPT_SERVICES
|
||||
bin_dir=~/devenv/bin
|
||||
cd /opt/module_build_service
|
||||
$bin_dir/mbs-upgradedb > /tmp/mbs-base.out 2>&1
|
||||
$bin_dir/fedmsg-relay < /dev/null >& /tmp/fedmsg-relay.out &
|
||||
$bin_dir/fedmsg-hub < /dev/null >& /tmp/fedmsg-hub.out &
|
||||
$bin_dir/mbs-frontend < /dev/null >& /tmp/mbs-frontend.out &
|
||||
SCRIPT_SERVICES
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "fedora/31-cloud-base"
|
||||
@@ -135,12 +87,10 @@ Vagrant.configure("2") do |config|
|
||||
# Disable the default share
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
config.vm.network "forwarded_port", guest_ip: "0.0.0.0", guest: 5000, host: 5000
|
||||
config.vm.network "forwarded_port", guest_ip: "0.0.0.0", guest: 13747, host: 13747
|
||||
config.vm.provision "shell", inline: $script
|
||||
config.vm.provision "shell", inline: "usermod -a -G mock vagrant"
|
||||
config.vm.provision "shell", inline: $config_pgsql
|
||||
config.vm.provision "shell", inline: $make_devenv, privileged: false
|
||||
config.vm.provision "shell", inline: $script_services, privileged: false, run: "always"
|
||||
config.vm.provider "libvirt" do |v, override|
|
||||
override.vm.synced_folder "./", "/opt/module_build_service", type: "sshfs"
|
||||
v.memory = 1024
|
||||
|
||||
Reference in New Issue
Block a user