Skip to content

Instantly share code, notes, and snippets.

@waynr
Created August 26, 2015 16:03
Show Gist options
  • Save waynr/490d3e9754b759fc9564 to your computer and use it in GitHub Desktop.
Save waynr/490d3e9754b759fc9564 to your computer and use it in GitHub Desktop.
Script that compares plugin info between different Jenkins instances
import argparse
import sys
import jenkins
from datadiff import diff
def distill_plugins(plugins_info):
ret = {}
for plugin in plugins_info:
ret[plugin["longName"]] = {
"version": plugin["version"],
"long-name": plugin["longName"],
"short-name": plugin["shortName"]
}
return ret
def compare_plugins(a, b):
a_plugins = a.get_plugins_info()
b_plugins = b.get_plugins_info()
print len(a_plugins)
print len(b_plugins)
print(diff(distill_plugins(a_plugins),
distill_plugins(b_plugins)))
def main():
enterprise_params = ["http://two.jenkins.net",
"user",
"token"]
enterprise = jenkins.Jenkins(*enterprise_params)
platform_params = ["https://one.jenkins.com",
"user",
"token"]
platform = jenkins.Jenkins(*platform_params)
compare_plugins(enterprise, platform)
if __name__== "__main__":
main()
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment