Merge pull request #2419 from coolo/fix_repo_to_stop

No longer trigger obsrsync directly from rabbitmq messages
This commit is contained in:
Stephan Kulow 2020-03-16 11:22:38 +01:00 committed by GitHub
commit 08c8cd5d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 80 additions and 16 deletions

View File

@ -65,6 +65,14 @@ pipelines:
git: https://github.com/openSUSE/openSUSE-release-tools.git
branch: master
destination: scripts
repos:
git: git://botmaster.suse.de/suse-repos.git
branch: master
destination: repos
notifications:
git: git://botmaster.suse.de/suse-notifications.git
branch: master
destination: notifications
stages:
- Run:
approval:
@ -80,8 +88,7 @@ pipelines:
export PYTHONPATH=$PWD/scripts
git config --global user.email "coolo@suse.de"
git config --global user.name "GoCD Repo Monitor"
git clone git://botmaster.suse.de/suse-repos.git
cd suse-repos
cd repos
../scripts/gocd/rabbit-repoid.py -A https://api.suse.de SUSE:SLE
openSUSE.Repo.Monitor:
group: Monitors
@ -95,6 +102,10 @@ pipelines:
git: https://github.com/openSUSE/openSUSE-release-tools.git
branch: master
destination: scripts
repos:
git: git://botmaster.suse.de/opensuse-repos.git
branch: master
destination: repos
stages:
- Run:
approval:
@ -110,9 +121,73 @@ pipelines:
export PYTHONPATH=$PWD/scripts
git config --global user.email "coolo@suse.de"
git config --global user.name "GoCD Repo Monitor"
git clone git://botmaster.suse.de/opensuse-repos.git
cd opensuse-repos
cd repos
../scripts/gocd/rabbit-repoid.py -A https://api.opensuse.org openSUSE:Factory openSUSE:Leap
openSUSE.ObsRsync:
group: Monitors
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-staging-bot
materials:
scripts:
git: https://github.com/openSUSE/openSUSE-release-tools.git
branch: master
destination: scripts
repos:
git: git://botmaster.suse.de/opensuse-repos.git
branch: master
destination: repos
notifications:
git: git://botmaster.suse.de/opensuse-notifications.git
branch: master
destination: notifications
stages:
- Run:
jobs:
Run:
timeout: 30
resources:
- monitor
tasks:
# endless loop
- script: |-
export PYTHONPATH=$PWD/scripts
git config --global user.email "coolo@suse.de"
git config --global user.name "GoCD Repo Monitor"
echo "Here we would sync"
SUSE.ObsRsync:
group: Monitors
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-staging-bot
materials:
scripts:
git: https://github.com/openSUSE/openSUSE-release-tools.git
branch: master
destination: scripts
repos:
git: git://botmaster.suse.de/suse-repos.git
branch: master
destination: repos
notifications:
git: git://botmaster.suse.de/suse-notifications.git
branch: master
destination: notifications
stages:
- Run:
jobs:
Run:
timeout: 30
resources:
- monitor
tasks:
# endless loop
- script: |-
export PYTHONPATH=$PWD/scripts
git config --global user.email "coolo@suse.de"
git config --global user.name "GoCD Repo Monitor"
echo "Here we would sync"
openSUSE.OriginManagerUpdate:
group: Monitors
lock_behavior: unlockWhenFinished

View File

@ -169,7 +169,7 @@ class Listener(PubSubConsumer):
def routing_keys(self):
ret = []
for suffix in ['.obs.repo.published', '.obs.repo.build_finished', '.openqa.job.done',
for suffix in ['.obs.repo.published', '.openqa.job.done',
'.openqa.job.create', '.openqa.job.restart']:
ret.append(self.amqp_prefix + suffix)
return ret
@ -234,15 +234,6 @@ class Listener(PubSubConsumer):
for p in self.projects:
p.check_published_repo(str(payload['project']), str(payload['repo']), str(payload['buildid']))
def on_finished_repo(self, payload):
# notify openQA to sync the projects - the plugin will check itself it
# the project is to be synced. For now we notify about every 'images' repo
if payload['repo'] == 'images':
try:
self.openqa.openqa_request('PUT', 'obs_rsync/{}/runs'.format(payload['project']), retries=0)
except RequestError as e:
self.logger.info("Got exception on syncing repository: {}".format(e))
def on_openqa_job(self, iso):
self.logger.debug('openqa_job_change %s', iso)
for p in self.projects:
@ -252,8 +243,6 @@ class Listener(PubSubConsumer):
self.acknowledge_message(method.delivery_tag)
if method.routing_key == '{}.obs.repo.published'.format(amqp_prefix):
self.on_published_repo(json.loads(body))
elif method.routing_key == '{}.obs.repo.build_finished'.format(amqp_prefix):
self.on_finished_repo(json.loads(body))
elif re.search(r'.openqa.', method.routing_key):
self.on_openqa_job(json.loads(body).get('ISO'))
else: