Dzahn has submitted this change and it was merged.
Change subject: zuul: Add zuul-test-repo helper script
......................................................................
zuul: Add zuul-test-repo helper script
zuul-test-repo is a small helper script I've had sitting in my home
directory for a few months now. It is a wrapper around the `zuul`
command that lets you easily trigger jobs in a specific zuul pipeline
for a repository, usually after changing the job definition.
Usage is like:
zuul-test-repo oojs/ui
zuul-test-repo ext:MassMessage # For MediaWiki extensions
zuul-test-repo mediawiki/core postmerge
Change-Id: I735dad7e8ddcb90926d4ecb96e0287ac63ac5995
---
A modules/zuul/files/zuul-test-repo.py
M modules/zuul/manifests/server.pp
2 files changed, 61 insertions(+), 0 deletions(-)
Approvals:
Hashar: Looks good to me, but someone else must approve
Zfilipin: Looks good to me, but someone else must approve
JanZerebecki: Looks good to me, but someone else must approve
jenkins-bot: Verified
Dzahn: Looks good to me, approved
diff --git a/modules/zuul/files/zuul-test-repo.py
b/modules/zuul/files/zuul-test-repo.py
new file mode 100644
index 0000000..8b1b94d
--- /dev/null
+++ b/modules/zuul/files/zuul-test-repo.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python2
+"""Easily trigger zuul pipelines for a Gerrit repository."""
+# Copyright 2015 Legoktm
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from __future__ import print_function
+
+import json
+import requests
+import subprocess
+import sys
+
+if len(sys.argv) < 2:
+ print('Usage: zuul-test-repo repository [pipeline]')
+ sys.exit(1)
+
+repo = sys.argv[1]
+try:
+ pipeline = sys.argv[2]
+except IndexError:
+ pipeline = 'test'
+
+# Allow "ext:MassMessage" as shorthand
+if repo.startswith('ext:'):
+ repo = 'mediawiki/extensions/' + repo.split(':', 1)[1]
+
+# Fetch the latest change for the repo from the Gerrit API
+r = requests.get('https://gerrit.wikimedia.org/r/changes/?'
+ 'q=status:merged+project:%s&n=1&o=CURRENT_REVISION' % repo)
+data = json.loads(r.text[4:])
+if not data:
+ print('Error, could not find any changes in %s.' % repo)
+ sys.exit(1)
+change = data[0]
+change_number = change['_number']
+patchset = change['revisions'][change['current_revision']]['_number']
+print('Going to test %s@%s,%s' % (repo, change_number, patchset))
+subprocess.call(['zuul', 'enqueue',
+ '--trigger', 'gerrit',
+ '--pipeline', pipeline,
+ '--project', repo,
+ '--change', '%s,%s' % (change_number, patchset)])
diff --git a/modules/zuul/manifests/server.pp b/modules/zuul/manifests/server.pp
index 4ac899f..b59a9ac 100644
--- a/modules/zuul/manifests/server.pp
+++ b/modules/zuul/manifests/server.pp
@@ -77,6 +77,14 @@
source => 'puppet:///modules/zuul/zuul-gearman.py',
}
+ file { '/usr/local/bin/zuul-test-repo':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0555',
+ source => 'puppet:///modules/zuul/zuul-test-repo.py',
+ }
+
# Additionally provide a publicly readeable configuration file
exec { 'craft public zuul conf':
cwd => '/etc/zuul/',
--
To view, visit https://gerrit.wikimedia.org/r/247031
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I735dad7e8ddcb90926d4ecb96e0287ac63ac5995
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits