Skip to content

Commit

Permalink
Merge pull request #6250 from coolo/merge_master_staging
Browse files Browse the repository at this point in the history
Merge master into staging-workflow
  • Loading branch information
coolo committed Nov 14, 2018
2 parents c2bb93c + 3d295dd commit 0d7aa17
Show file tree
Hide file tree
Showing 269 changed files with 10,785 additions and 3,065 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ In particular, this community seeks the following types of contributions:
Read this guide on how to do that.

1. [How to contribute code](#how-to-contribute-code)
1. [How to review code submissions](#how-to-review-code-submissions)
1. [How to contribute issues](#how-to-contribute-issues)
1. [How to contribute documentation](#how-to-contribute-documentation)
1. [How to conduct yourself when contributing](#how-to-conduct-yourself-when-contributing)
1. [How to setup an OBS development environment](#how-to-setup-an-obs-development-environment)
2. [How to review code submissions](#how-to-review-code-submissions)
3. [How to contribute bug reports](#how-to-contribute-bug-reports)
4. [How to contribute documentation](#how-to-contribute-documentation)
5. [How to conduct yourself when contributing](#how-to-conduct-yourself-when-contributing)
6. [How to setup an OBS development environment](#how-to-setup-an-obs-development-environment)


# How to Contribute Code
Expand Down
5 changes: 2 additions & 3 deletions dist/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
include ../Makefile.include

INIT_SCRIPTS := obsscheduler obsworker obsapisetup obsstoragesetup
INIT_SCRIPTS := obsscheduler obsworker obsstoragesetup
LOGROTATE_CONFIGS := obs-api obs-server obs-source_service
OBS_BIN_SCRIPTS := obs_productconvert
OBS_SBIN_SCRIPTS := obs_admin obs_serverstatus
SYSTEMD_TARGET_FILES := obs-api-support
SYSTEMD_SERVICE_FILES := obs-clockwork obs-delayedjob-queue-project_log_rotate obs-delayedjob-queue-consistency_check obs-delayedjob-queue-default obs-delayedjob-queue-releasetracking obs-delayedjob-queue-issuetracking obs-delayedjob-queue-mailers obs-sphinx obsdeltastore obsdispatcher obsdodup obswarden obssrcserver obsrepserver obspublisher obssigner obsservice obsservicedispatch obsgetbinariesproxy obsclouduploadserver obsclouduploadworker
SYSTEMD_SERVICE_FILES := obs-clockwork obs-delayedjob-queue-project_log_rotate obs-delayedjob-queue-consistency_check obs-delayedjob-queue-default obs-delayedjob-queue-releasetracking obs-delayedjob-queue-issuetracking obs-delayedjob-queue-mailers obs-sphinx obsdeltastore obsdispatcher obsdodup obswarden obssrcserver obsrepserver obspublisher obssigner obsservice obsservicedispatch obsgetbinariesproxy obsclouduploadserver obsclouduploadworker obsapisetup
SYSTEMD_SERVICE_FILES_WITHOUT_LINK := obs-delayedjob-queue-quick@

FILLUPDIR := /var/adm/fillup-templates
Expand All @@ -17,7 +17,6 @@ install: install_obsapisetup install_apache install_initscripts install_project_
#install_overview

install_obsapisetup: system_dirs
$(INSTALL) -m 755 obsapisetup $(DESTDIR)/etc/init.d/obsapisetup
$(INSTALL) -m 755 setup-appliance.sh $(DESTDIR)$(OBS_BACKEND_PREFIX)/setup-appliance.sh

install_apache:
Expand Down
5 changes: 4 additions & 1 deletion dist/obs-bundled-gems.spec
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ This package bundles all the gems required by the Open Build Service
to make it easier to deploy the obs-server package.

%define rake_version 12.3.1
%define rack_version 2.0.6

%package -n obs-api-deps
Summary: Holding dependencies required to run the OBS frontend
Expand All @@ -63,6 +64,7 @@ Requires: sphinx >= 2.1.8
Requires: perl(GD)
Requires: rubygem(ruby:2.5.0:bundler)
Requires: rubygem(ruby:2.5.0:rake:%{rake_version})
Requires: rubygem(ruby:2.5.0:rack:%{rack_version})

%description -n obs-api-deps
To simplify splitting the test suite packages off the main package,
Expand Down Expand Up @@ -102,8 +104,9 @@ bundle config build.nokogiri --use-system-libraries
%install
bundle --local --path %{buildroot}%_libdir/obs-api/

# test that the rake_version macro is still matching our Gemfile
# test that the rake and rack macros is still matching our Gemfile
test -f %{buildroot}%_libdir/obs-api/ruby/2.5.0/gems/rake-%{rake_version}/rake.gemspec
test -f %{buildroot}%_libdir/obs-api/ruby/2.5.0/gems/rack-%{rack_version}/rack.gemspec

# run gem clean up script
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%_libdir/obs-api/ruby/*/
Expand Down
4 changes: 2 additions & 2 deletions dist/obs-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,7 @@ usermod -a -G docker obsservicerun
/srv/www/obs/api/config/application.rb
/srv/www/obs/api/config/clock.rb
%config(noreplace) /etc/logrotate.d/obs-api
/etc/init.d/obsapisetup
/usr/sbin/rcobsapisetup
%{_unitdir}/obsapisetup.service
%{_unitdir}/obs-api-support.target
%{_unitdir}/obs-clockwork.service
%{_unitdir}/obs-delayedjob-queue-consistency_check.service
Expand All @@ -731,6 +730,7 @@ usermod -a -G docker obsservicerun
%{_sbindir}/rcobs-delayedjob-queue-project_log_rotate
%{_sbindir}/rcobs-delayedjob-queue-releasetracking
%{_sbindir}/rcobs-sphinx
%{_sbindir}/rcobsapisetup
/srv/www/obs/api/app
%attr(-,%{apache_user},%{apache_group}) /srv/www/obs/api/db/structure.sql
%attr(-,%{apache_user},%{apache_group}) /srv/www/obs/api/db/data_schema.rb
Expand Down
70 changes: 0 additions & 70 deletions dist/obsapisetup

This file was deleted.

3 changes: 2 additions & 1 deletion dist/obsstoragesetup
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ case "$1" in
[ -d $backenddir/run ] || mkdir -p $backenddir/run
[ -d $backenddir/log ] || mkdir -p $backenddir/log
# fix ownership
chown $bsuser:$bsgroup $backenddir
chown $bsuser:$bsgroup $backenddir{,/log,/run}
chmod g+w $backenddir{/log,/run}
fi

# offer hook to make random special things in your setup
Expand Down
17 changes: 16 additions & 1 deletion dist/setup-appliance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,14 @@ function get_hostname {
if [[ $1 && $BOOTSTRAP_TEST_MODE == 1 ]];then
FQHOSTNAME=$1
else
FQHOSTNAME=`hostname -f 2>/dev/null`
TIMEOUT=600
while [ -z "$FQHOSTNAME" ];do
FQHOSTNAME=`hostname -f 2>/dev/null`
TIMEOUT=$(($TIMEOUT-1))
[ "$TIMEOUT" -le 0 ] && break
echo "Waiting for FQHOSTNAME ($TIMEOUT)"
sleep 1
done
fi

if type -p ec2-public-hostname; then
Expand Down Expand Up @@ -608,10 +615,18 @@ if [[ ! $BOOTSTRAP_TEST_MODE == 1 && $0 != "-bash" ]];then
--non-interactive) NON_INTERACTIVE=1;;
--setup-only) SETUP_ONLY=1;;
--enable-optional-services) ENABLE_OPTIONAL_SERVICES=1;;
--force) OBS_API_AUTOSETUP="yes";;
esac
shift
done

if [ "$OBS_API_AUTOSETUP" != "yes" ]; then
echo "OBS API Autosetup is not enabled in sysconfig, skipping!"
exit 0
fi

[[ $HOME == '' ]] && export HOME=/root

# prepare configuration for obssigner before any other backend service
# is started, because obssigner configuration might affect other services
# too
Expand Down
11 changes: 11 additions & 0 deletions dist/systemd/obsapisetup.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=OBS API Setup
Before=apache2.service
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/lib/obs/server/setup-appliance.sh --non-interactive --setup-only

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion dist/systemd/obsrepserver.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=OBS repository server
After=network.target
After=network.target obsstoragesetup.service

[Service]
EnvironmentFile=/etc/sysconfig/obs-server
Expand Down
2 changes: 1 addition & 1 deletion dist/systemd/obsservice.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=OBS source service server
After=network.target
After=network.target obsstoragesetup.service

[Service]
EnvironmentFile=/etc/sysconfig/obs-server
Expand Down
2 changes: 1 addition & 1 deletion dist/systemd/obsservicedispatch.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=OBS source service dispatcher
After=obsstoragesetup.service
After=obsstoragesetup.service obsservice.service

[Service]
EnvironmentFile=/etc/sysconfig/obs-server
Expand Down
2 changes: 1 addition & 1 deletion dist/systemd/obssrcserver.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=OBS source repository server
After=network.target
After=network.target obsstoragesetup.service obsservice.service

[Service]
EnvironmentFile=/etc/sysconfig/obs-server
Expand Down
4 changes: 1 addition & 3 deletions dist/t/0030-installed-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ export BASH_TAP_ROOT=$(dirname $0)
#
. $(dirname $0)/bash-tap-bootstrap
#
plan tests 7
plan tests 5
for i in \
$DESTDIR/etc/logrotate.d/obs-server\
$DESTDIR/usr/lib/systemd/system/obssrcserver.service\
$DESTDIR/usr/lib/systemd/system/obsrepserver.service\
$DESTDIR/usr/sbin/obs_admin\
$DESTDIR/usr/sbin/obs_serverstatus
do
Expand Down
90 changes: 48 additions & 42 deletions dist/t/0050-test-appliance.ta
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
#!/bin/bash

export BOOTSTRAP_TEST_MODE=1
export NON_INTERACTIVE=1
export BASH_TAP_ROOT=$(dirname $0)

. $(dirname $0)/bash-tap-bootstrap

plan tests 2

for i in $(dirname $0)/../setup-appliance.sh /usr/lib/obs/server/setup-appliance.sh;do
[[ -f $i && -z $SETUP_APPLIANCE ]] && SETUP_APPLIANCE=$i
done

if [[ -z $SETUP_APPLIANCE ]];then
BAIL_OUT "Could not find setup appliance"
fi

. $SETUP_APPLIANCE

MAX_WAIT=300

tmpcount=$MAX_WAIT

# Service enabled and started
for srv in \
obsapisetup
do
STATE=` systemctl is-enabled $srv\.service 2>/dev/null`
is "$STATE" "enabled" "Checking $srv enabled"
ACTIVE=`systemctl is-active $srv\.service`
while [[ $ACTIVE != 'active' ]];do
tmpcount=$(( $tmpcount - 1 ))
ACTIVE=`systemctl is-active $srv\.service`
if [[ $tmpcount -le 0 ]];then
ACTIVE='timeout'
break
fi
sleep 1
done
is "$ACTIVE" "active" "Checking $srv status"
done
#!/usr/bin/perl

use strict;
use warnings;
use Test::More;

our @services = ('obsapisetup.service');

plan tests => 2 * scalar(@services);

my $TIMEOUT = 300;

for my $srv (@services) {
my $enabled = `systemctl is-enabled $srv 2>/dev/null`;
chomp($enabled);
is($enabled, 'enabled', "Checking $srv enabled");

my $success = 'timeout';
my $tmp = $TIMEOUT;

my ($legacy, $trash) = split /\./, $srv, 2;
my $is_legacy = ( -f "/etc/init.d/$legacy") ? 1 : 0;

while ($tmp > 0) {
$tmp--;
my $result;
if ($is_legacy) {
$result = `systemctl is-active $srv`;
chomp $result;
if ($result eq 'active') {
$success=$result;
last
}
} else {
$result = `systemctl status $srv|grep "(code=exited, status=0/SUCCESS)"`;
if ($result) {
$success = 'active';
last
}
}
print ".";
sleep 1;
}

is($success, 'active', "Checking if $srv startup succeed");
}

exit 0;
16 changes: 12 additions & 4 deletions dist/t/0070-check_recommended_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@

use strict;
use warnings;
use Test::More;
use FindBin;
use lib "$FindBin::Bin/lib";

BEGIN {
unshift @::INC,
"$FindBin::Bin/lib",
"$FindBin::Bin/../../src/backend/build",
"/usr/lib/build"
;
}

use OBS::Test::Utils;
use Test::More;
use Build::Rpm;

my $test_count = 6;
my $max_wait = 300;

my @daemons = qw/obsdodup obssigner obsdeltastore/;
my $pkg_ver = OBS::Test::Utils::get_package_version('obs-server', 2);

if ( $pkg_ver > 2.8) {
if ( Build::Rpm::verscmp($pkg_ver, "2.8.99") > 0) {
$test_count = 8;
push (@daemons, 'obsservicedispatch');
}
Expand Down
5 changes: 4 additions & 1 deletion dist/t/lib/OBS/Test/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use warnings;
sub get_package_version {
my ($pkg, $num) = @_;
my @pkg_ver = `rpm -q --qf '%{version}' $pkg`;
my @ver_raw = split(/\./,$pkg_ver[0]);
my $raw_ver = $pkg_ver[0];
chomp $raw_ver;
$raw_ver =~ s/^([\d\.]*).*/$1/;
my @ver_raw = split(/\./, $raw_ver);
my @ver = splice(@ver_raw, 0, $num);
return join('.',@ver);
}
Expand Down

0 comments on commit 0d7aa17

Please sign in to comment.