diff --git a/gocd/checkers.opensuse.gocd.yaml b/gocd/checkers.opensuse.gocd.yaml index 2809eac2..e37e84df 100644 --- a/gocd/checkers.opensuse.gocd.yaml +++ b/gocd/checkers.opensuse.gocd.yaml @@ -42,6 +42,27 @@ pipelines: - repo-checker3 tasks: - script: ./repo_checker.py -A https://api.opensuse.org --debug review + openSUSE.Legal.Check: + group: openSUSE.Checkers + lock_behavior: unlockWhenFinished + timer: + spec: 0 */5 * ? * * + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-legal-auto + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Run: + approval: + type: manual + jobs: + Run: + timeout: 0 + resources: + - staging-bot3 + tasks: + - script: ./legal-auto.py -A https://api.opensuse.org --debug --legaldb http://legaldb.suse.de review Factory.Staging.Report: group: openSUSE.Checkers lock_behavior: unlockWhenFinished diff --git a/gocd/checkers.suse.gocd.yaml b/gocd/checkers.suse.gocd.yaml index bdbd216a..d3ca481e 100644 --- a/gocd/checkers.suse.gocd.yaml +++ b/gocd/checkers.suse.gocd.yaml @@ -197,6 +197,27 @@ pipelines: - staging-bot3 tasks: - script: ./check_source.py -A https://api.suse.de --verbose --skip-add-reviews --group factory-auto review + SLE.Legal.Check: + group: SLE.Checkers + lock_behavior: unlockWhenFinished + timer: + spec: 0 */5 * ? * * + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-legal-auto + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Run: + approval: + type: manual + jobs: + Run: + timeout: 0 + resources: + - staging-bot3 + tasks: + - script: ./legal-auto.py -A https://api.suse.de --debug --legaldb http://legaldb.suse.de review SLE12.SP5.InstallCheck.A: group: SLE.Checkers lock_behavior: unlockWhenFinished diff --git a/gocd/checkers.suse.gocd.yaml.erb b/gocd/checkers.suse.gocd.yaml.erb index 363223b0..28a3cedf 100644 --- a/gocd/checkers.suse.gocd.yaml.erb +++ b/gocd/checkers.suse.gocd.yaml.erb @@ -197,6 +197,27 @@ pipelines: - staging-bot3 tasks: - script: ./check_source.py -A https://api.suse.de --verbose --skip-add-reviews --group factory-auto review + SLE.Legal.Check: + group: SLE.Checkers + lock_behavior: unlockWhenFinished + timer: + spec: 0 */5 * ? * * + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-legal-auto + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Run: + approval: + type: manual + jobs: + Run: + timeout: 0 + resources: + - staging-bot3 + tasks: + - script: ./legal-auto.py -A https://api.suse.de --debug --legaldb http://legaldb.suse.de review <% %w(A B C D H S V Y).each do |letter| -%> SLE12.SP5.InstallCheck.<%= letter %>: group: SLE.Checkers diff --git a/legal-auto.py b/legal-auto.py index b8cd7191..8bf85950 100755 --- a/legal-auto.py +++ b/legal-auto.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # SPDX-License-Identifier: MIT @@ -13,11 +13,7 @@ import requests as REQ import json import time -try: - from urllib.error import HTTPError -except ImportError: - # python 2.x - from urllib2 import HTTPError +from urllib.error import HTTPError try: from xml.etree import cElementTree as ET @@ -307,8 +303,6 @@ class CommandLineInterface(ReviewBot.CommandLineInterface): parser.add_option("--legaldb", dest='legaldb', metavar='URL', default='http://legaldb.suse.de', help="Use different legaldb deployment") - parser.add_option("--token", dest='token', metavar='STRING', - default=False, help="Use token to authenticate") return parser def do_project(self, subcmd, opts, *projects): @@ -322,8 +316,7 @@ class CommandLineInterface(ReviewBot.CommandLineInterface): self.options.group = 'legal-auto' bot = ReviewBot.CommandLineInterface.setup_checker(self) bot.legaldb = self.options.legaldb - if self.options.token: - bot.legaldb_headers['Authorization'] = 'Token ' + self.options.token + bot.legaldb_headers['Authorization'] = 'Token ' + osc.conf.config['legaldb_token'] return bot