Created
August 26, 2015 16:03
-
-
Save waynr/490d3e9754b759fc9564 to your computer and use it in GitHub Desktop.
Script that compares plugin info between different Jenkins instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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