feat: sort the YAML output by name and version #576
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In order to be able to quickly compare the list of plugins across our Jenkins instances, I added sorting to the
YamlPluginOutputConverter.Please let me know if you would like me to also add sorting capabilities elsewhere.
Manual testing
Given
My local development Jenkins instance, I installed some plugins to test with.
When
I ran the last released version (2.12.11):
java -jar path/to/jenkins-plugin-manager-2.12.11.jar --war "${JENKINS_HOME}/jenkins.war" --plugin-download-directory "${JENKINS_HOME}/plugins" --list --output yaml > plugins-2.12.11.yamlThen
I obtained the baseline output in a
plugins-2.12.11.yamlfile.When
I ran the version with these changes:
java -jar path/to/jenkins-plugin-manager-2.12.12-SNAPSHOT.jar --war "${JENKINS_HOME}/jenkins.war" --plugin-download-directory "${JENKINS_HOME}/plugins" --list --output yaml > plugins-2.12.12-SNAPSHOT.yamlThen
I obtained the new and improved output in a
plugins-2.12.12-SNAPSHOT.yamlfile.Comparing the baseline to it with a graphical diff tool (Meld), we see the old-and-busted version on the left and the new hotness on the right, where we clearly have an alphabetically-sorted list on the right:
Mission accomplished!