Combine project_only and rebuild into check

For SLE we run it --no-rebuild, for openSUSE check also rebuilds
This commit is contained in:
Stephan Kulow
2019-07-29 15:29:20 +02:00
parent 071bbf8d66
commit 3bb6d36e29
4 changed files with 81 additions and 77 deletions

View File

@@ -41,13 +41,13 @@ pipelines:
resources:
- repo-checker
tasks:
- script: ./project-installcheck.py -A https://api.suse.de --debug project_only SUSE:SLE-15-SP2:GA
- script: ./project-installcheck.py -A https://api.suse.de --debug check --store SUSE:SLE-15-SP2:GA:Staging/dashboard --no-rebuild SUSE:SLE-15-SP2:GA
SLE_12_SP5:
timeout: 0
resources:
- repo-checker
tasks:
- script: ./project-installcheck.py -A https://api.suse.de --debug project_only SUSE:SLE-12-SP5:GA
- script: ./project-installcheck.py -A https://api.suse.de --debug check --store SUSE:SLE-12-SP5:GA:Staging/dashboard --no-rebuild SUSE:SLE-12-SP5:GA
SLE-SP2.Manager42:
group: SLE.Checkers
lock_behavior: unlockWhenFinished

View File

@@ -41,13 +41,13 @@ pipelines:
resources:
- repo-checker
tasks:
- script: ./project-installcheck.py -A https://api.suse.de --debug project_only SUSE:SLE-15-SP2:GA
- script: ./project-installcheck.py -A https://api.suse.de --debug check --store SUSE:SLE-15-SP2:GA:Staging/dashboard --no-rebuild SUSE:SLE-15-SP2:GA
SLE_12_SP5:
timeout: 0
resources:
- repo-checker
tasks:
- script: ./project-installcheck.py -A https://api.suse.de --debug project_only SUSE:SLE-12-SP5:GA
- script: ./project-installcheck.py -A https://api.suse.de --debug check --store SUSE:SLE-12-SP5:GA:Staging/dashboard --no-rebuild SUSE:SLE-12-SP5:GA
SLE-SP2.Manager42:
group: SLE.Checkers
lock_behavior: unlockWhenFinished

View File

@@ -1,6 +1,6 @@
format_version: 3
pipelines:
Trigger.Rebuilds:
Trigger.Rebuild.Factory:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
@@ -19,22 +19,67 @@ pipelines:
tasks:
- script: |-
echo "openSUSE:Factory"
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Factory:Staging/dashboard openSUSE:Factory standard i586
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Factory:Staging/dashboard openSUSE:Factory standard x86_64
./project-installcheck.py --debug check --store openSUSE:Factory:Staging/dashboard openSUSE:Factory
Trigger.Rebuild.Factory.Power:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-factory-maintainer
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
timer:
spec: 0 0 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- repo-checker
tasks:
- script: |-
echo "openSUSE:Factory:PowerPC"
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Factory:Staging/dashboard openSUSE:Factory:PowerPC standard ppc
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Factory:Staging/dashboard openSUSE:Factory:PowerPC standard ppc64
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Factory:Staging/dashboard openSUSE:Factory:PowerPC standard ppc64le
./project-installcheck.py --debug check --store openSUSE:Factory:Staging/dashboard openSUSE:Factory:PowerPC
Trigger.Rebuild.Leap.152:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-factory-maintainer
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
timer:
spec: 0 0 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- repo-checker
tasks:
- script: |-
echo "openSUSE Leap 15.2"
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Leap:15.2:Staging/dashboard openSUSE:Leap:15.2 standard i586
./project-installcheck.py --osc-debug --debug rebuild --store openSUSE:Leap:15.2:Staging/dashboard openSUSE:Leap:15.2 standard x86_64
./project-installcheck.py --debug check --store openSUSE:Leap:15.2:Staging/dashboard openSUSE:Leap:15.2
Trigger.Rebuild.GNOME:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-factory-maintainer
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
timer:
spec: 0 0 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- repo-checker
tasks:
- script: |-
echo "GNOME devel projects"
./project-installcheck.py --osc-debug --debug rebuild --store home:repo-checker/rebuilds GNOME:Factory openSUSE_Factory i586
./project-installcheck.py --osc-debug --debug rebuild --store home:repo-checker/rebuilds GNOME:Factory openSUSE_Factory x86_64
./project-installcheck.py --osc-debug --debug rebuild --store home:repo-checker/rebuilds GNOME:Factory openSUSE_PPC ppc64le
./project-installcheck.py --osc-debug --debug rebuild --store home:repo-checker/rebuilds GNOME:Next openSUSE_Factory i586
./project-installcheck.py --osc-debug --debug rebuild --store home:repo-checker/rebuilds GNOME:Next openSUSE_Factory x86_64
./project-installcheck.py --osc-debug --debug rebuild --store home:repo-checker/rebuilds GNOME:Next openSUSE_PPC ppc64le
./project-installcheck.py --debug check --store home:repo-checker/rebuilds -r openSUSE_Factory GNOME:Factory
./project-installcheck.py --debug check --store home:repo-checker/rebuilds -r openSUSE_PPC GNOME:Factory
./project-installcheck.py --debug check --store home:repo-checker/rebuilds -r openSUSE_Factory GNOME:Next
./project-installcheck.py --debug check --store home:repo-checker/rebuilds -r openSUSE_PPC GNOME:Next

View File

@@ -30,32 +30,29 @@ class RepoChecker():
self.logger = logging.getLogger('RepoChecker')
self.store_project = None
self.store_package = None
self.rebuild = None
def parse_store(self, project_package):
if project_package:
self.store_project, self.store_package = project_package.split('/')
def project_only(self, project):
repository = self.project_repository(project)
def check(self, project, repository):
print('repository', repository)
if not repository:
repository = self.project_repository(project)
if not repository:
self.logger.error('a repository must be specified via OSRT:Config main-repo for {}'.format(project))
return
config = Config.get(self.apiurl, project)
arch_whitelist = config.get('repo_checker-arch-whitelist')
repository_pairs = repository_path_expand(self.apiurl, project, repository)
self.repository_check(repository_pairs, arch_whitelist=arch_whitelist)
def target_archs(self, project, repository, arch_whitelist=None):
archs = target_archs(self.apiurl, project, repository)
if not len(archs):
self.logger.debug('{} has no relevant architectures'.format(project))
return None
# Check for arch whitelist and use intersection.
if arch_whitelist:
archs = list(set(arch_whitelist.split(' ')).intersection(set(archs)))
# Trick to prioritize x86_64.
return sorted(archs, reverse=True)
for arch in archs:
self.check_pra(project, repository, arch)
def project_pseudometa_file_name(self, project, repository):
filename = 'repo_checker'
@@ -66,37 +63,6 @@ class RepoChecker():
return filename
def repository_check(self, repository_pairs, arch_whitelist=None):
project, repository = repository_pairs[0]
self.logger.info('checking {}/{}@[{}]'.format(
project, repository, len(repository_pairs)))
archs = self.target_archs(project, repository, arch_whitelist)
if not len(archs):
self.logger.debug('{} has no relevant architectures'.format(project))
return None
result = True
comment = []
for arch in archs:
directories = []
for pair_project, pair_repository in repository_pairs:
directories.append(mirror(self.apiurl, pair_project, pair_repository, arch))
parts = installcheck(directories, arch, [], [])
if len(parts):
comment.append('## {}/{}\n'.format(repository_pairs[0][1], arch))
comment.extend(parts)
text = '\n'.join(comment).strip()
if not self.dryrun:
filename = self.project_pseudometa_file_name(project, repository)
project_pseudometa_file_ensure(self.apiurl, project, filename, text + '\n', 'repo_checker project_only run')
else:
print(text)
return result
def _split_and_filter(self, output):
output = output.split("\n")
rebuild_counter_re = re.compile(r'(needed by [^ ]*\-[^-]*)\-[^-]*\.\w+$')
@@ -136,7 +102,7 @@ class RepoChecker():
source_file_ensure(self.apiurl, self.store_project, self.store_package,
self.store_filename, state_yaml, comment='Updated rebuild infos')
def rebuild(self, project, repository, arch):
def check_pra(self, project, repository, arch):
config = Config.get(self.apiurl, project)
oldstate = None
@@ -269,11 +235,11 @@ class RepoChecker():
oldstate['leafs'][state_key] = {'buildinfo': m.hexdigest(),
'rebuild': str(datetime.datetime.now())}
if self.dryrun:
if self.dryrun and self.rebuild:
self.logger.info("To rebuild: %s", ' '.join(rebuilds))
return
if not len(rebuilds):
if self.rebuild and not len(rebuilds):
self.logger.debug("Nothing to rebuild")
# in case we do rebuild, wait for it to succeed before saving
self.store_yaml(oldstate)
@@ -308,25 +274,18 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
return RepoChecker()
@cmdln.option('--store', help='Project/Package to store the rebuild infos in')
def do_rebuild(self, subcmd, opts, project, repository, arch):
@cmdln.option('-r', '--repo', dest='repo', help='Repository to check')
@cmdln.option('--no-rebuild', dest='rebuild', action='store_false', help='Only track issues, do not rebuild')
def do_check(self, subcmd, opts, project):
"""${cmd_name}: Rebuild packages in rebuild=local projects
${cmd_usage}
${cmd_option_list}
"""
self.tool.rebuild = opts.rebuild
self.tool.parse_store(opts.store)
self.tool.apiurl = conf.config['apiurl']
self.tool.rebuild(project, repository, arch)
def do_project_only(self, subcmd, opts, project):
"""${cmd_name}: Update repository repo of a project
${cmd_usage}
${cmd_option_list}
"""
self.tool.apiurl = conf.config['apiurl']
self.tool.project_only(project)
self.tool.check(project, opts.repo)
if __name__ == '__main__':
app = CommandLineInterface()