Skip to content

Commit

Permalink
Merge 094b5d1 into 6abc794
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Nov 26, 2019
2 parents 6abc794 + 094b5d1 commit 7257206
Show file tree
Hide file tree
Showing 31 changed files with 705 additions and 5,415 deletions.
6 changes: 5 additions & 1 deletion dist/ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ services:
command: /usr/sbin/memcached -u memcached
api:
<<: *obs
command: chroot --userspec=wwwrun / /bin/bash -c "cd /srv/www/obs/api && RAILS_ENV=production rake ts:rebuild && /usr/bin/bundle exec rails s -e production"
command: >
chroot --userspec=wwwrun / /bin/bash -c "cd /srv/www/obs/api &&
RAILS_ENV=production rake ts:rebuild &&
RAILS_ENV=production ./script/delayed_job.api.rb --queues=staging,quick start &&
/usr/bin/bundle exec rails s -e production"
depends_on:
- db
- cache
Expand Down
2 changes: 1 addition & 1 deletion metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Duplicate Leap config to handle 13.2 without issue.
osclib.conf.DEFAULT[
r'openSUSE:(?P<project>[\d.]+)$'] = osclib.conf.DEFAULT[
r'openSUSE:(?P<project>Leap:(?P<version>[\d.]+))(?::NonFree)?$']
r'openSUSE:(?P<project>Leap:(?P<version>[\d.]+))$']

# Provide osc.core.get_request_list() that swaps out search() implementation to
# capture the generated query, paginate over and yield each request to avoid
Expand Down
93 changes: 11 additions & 82 deletions osc-staging.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import os.path
import subprocess
Expand All @@ -23,7 +21,6 @@
from osclib.check_duplicate_binaries_command import CheckDuplicateBinariesCommand
from osclib.cleanup_rings import CleanupRings
from osclib.conf import Config
from osclib.config_command import ConfigCommand
from osclib.freeze_command import FreezeCommand
from osclib.ignore_command import IgnoreCommand
from osclib.unignore_command import UnignoreCommand
Expand Down Expand Up @@ -101,8 +98,6 @@ def clean_args(args):
help='indicate the project on which to operate, default is openSUSE:Factory')
@cmdln.option('--force', action='store_true',
help='force action, overruling internal checks (CAUTION)')
@cmdln.option('-o', '--old', action='store_true',
help='use the old check algorithm')
@cmdln.option('-v', '--version', action='store_true',
help='print the plugin version')
@cmdln.option('--no-freeze', dest='no_freeze', action='store_true',
Expand All @@ -124,8 +119,6 @@ def clean_args(args):
@cmdln.option('--strategy', help='apply a specific strategy')
@cmdln.option('--no-color', action='store_true', help='strip colors from output (or add staging.color = 0 to the .oscrc general section')
@cmdln.option('--save', action='store_true', help='save the result to the pseudometa package')
@cmdln.option('--append', action='store_true', help='append to existing value')
@cmdln.option('--clear', action='store_true', help='clear value')
def do_staging(self, subcmd, opts, *args):
"""${cmd_name}: Commands to work with staging projects
Expand All @@ -146,35 +139,6 @@ def do_staging(self, subcmd, opts, *args):
"check_duplicate_binaries" list binaries provided by multiple packages
"config" will modify or view staging specific configuration
Target project OSRT:Config attribute configuration applies to all
stagings. Both configuration locations follow the .oscrc format (space
separated list).
config
Print all staging configuration.
config key
Print the value of key for stagings.
conf key value...
Set the value of key for stagings.
config --clear
Clear all staging configuration.
config --clear key
Clear (unset) a single key from staging configuration
config --append key value...
Append value to existing value or set if no existing value.
All of the above may be restricted to a set of stagings.
The staging configuration is automatically cleared anytime staging
psuedometa is cleared (accept, or unstage all requests).
The keys that may be set in staging configuration are:
- repo_checker-binary-whitelist[-arch]: appended to target project list
- todo: text to be printed after staging is accepted
"cleanup_rings" will try to cleanup rings content and print
out problems
Expand Down Expand Up @@ -229,7 +193,6 @@ def do_staging(self, subcmd, opts, *args):
- ./action/target/@devel_project_super: super devel project if relevant
- ./action/target/@ring: the ring to which the package belongs
- ./@aged: either True or False based on splitter-request-age-threshold
- ./@nonfree: set to nonfree if targetting nonfree sub project
- ./@ignored: either False or the provided message
Some useful examples:
Expand Down Expand Up @@ -332,9 +295,8 @@ def do_staging(self, subcmd, opts, *args):
Usage:
osc staging accept [--force] [--no-cleanup] [LETTER...]
osc staging adi [--move] [--by-develproject] [--split] [REQUEST...]
osc staging check [--old] [STAGING...]
osc staging check [STAGING...]
osc staging check_duplicate_binaries
osc staging config [--append] [--clear] [STAGING...] [key] [value]
osc staging cleanup_rings
osc staging freeze [--no-bootstrap] STAGING...
osc staging frozenage [STAGING...]
Expand Down Expand Up @@ -436,32 +398,13 @@ def do_staging(self, subcmd, opts, *args):
# call the respective command and parse args by need
if cmd == 'check':
if len(args) == 1:
CheckCommand(api).perform(None, opts.old)
CheckCommand(api).perform(None)
else:
for prj in args[1:]:
CheckCommand(api).perform(prj, opts.old)
CheckCommand(api).perform(prj)
print()
elif cmd == 'check_duplicate_binaries':
CheckDuplicateBinariesCommand(api).perform(opts.save)
elif cmd == 'config':
projects = set()
key = value = None
stagings = api.get_staging_projects_short(None) + \
api.get_staging_projects()
for arg in args[1:]:
if arg in stagings:
projects.add(api.prj_from_short(arg))
elif key is None:
key = arg
elif value is None:
value = arg
else:
value += ' ' + arg

if not len(projects):
projects = api.get_staging_projects()

ConfigCommand(api).perform(projects, key, value, opts.append, opts.clear)
elif cmd == 'freeze':
for prj in args[1:]:
prj = api.prj_from_short(prj)
Expand All @@ -477,24 +420,9 @@ def do_staging(self, subcmd, opts, *args):
api.days_since_last_freeze(prj)))
elif cmd == 'accept':
cmd = AcceptCommand(api)
for prj in args[1:]:
if cmd.perform(api.prj_from_letter(prj), opts.force):
cmd.reset_rebuild_data(prj)
else:
return
if not opts.no_cleanup:
if api.item_exists(api.prj_from_letter(prj)):
cmd.cleanup(api.prj_from_letter(prj))
cmd.accept_other_new()
if opts.project.startswith('openSUSE:'):
cmd.update_factory_version()
if api.item_exists(api.crebuild):
cmd.sync_buildfailures()
cmd.accept_all(args[1:], opts.force, not opts.no_cleanup)
elif cmd == 'unselect':
if opts.message:
print('Ignoring requests first')
IgnoreCommand(api).perform(args[1:], opts.message)
UnselectCommand(api).perform(args[1:], opts.cleanup)
UnselectCommand(api).perform(args[1:], opts.cleanup, opts.message)
elif cmd == 'select':
# Include list of all stagings in short-hand and by full name.
existing_stagings = api.get_staging_projects_short(None)
Expand Down Expand Up @@ -523,7 +451,7 @@ def do_staging(self, subcmd, opts, *args):
print('--move and --filter-from must be used with explicit staging and request list')
return

open_requests = api.get_open_requests({'withhistory': 1}, include_nonfree=False)
open_requests = api.get_open_requests({'withhistory': 1})
if len(open_requests) == 0:
print('No open requests to consider')
return
Expand Down Expand Up @@ -620,10 +548,11 @@ def do_staging(self, subcmd, opts, *args):
request_ids = map(str, info['requests'].keys())
target_project = api.prj_from_short(info['staging'])

if 'merge' not in info:
# Assume that the original splitter_info is desireable
# and that this staging is simply manual followup.
api.set_splitter_info_in_prj_pseudometa(target_project, info['group'], info['strategy'])
# TODO: Find better place for splitter info
# if 'merge' not in info:
# Assume that the original splitter_info is desireable
# and that this staging is simply manual followup.
# api.set_splitter_info_in_prj_pseudometa(target_project, info['group'], info['strategy'])

SelectCommand(api, target_project) \
.perform(request_ids, no_freeze=opts.no_freeze)
Expand Down

0 comments on commit 7257206

Please sign in to comment.