Allow reordering config repo pipelines#6043
Merged
marques-work merged 4 commits intogocd:masterfrom Apr 2, 2019
Merged
Conversation
457d0dd to
05a00f4
Compare
…-1 in target_version 4
05a00f4 to
29c95aa
Compare
marques-work
approved these changes
Apr 2, 2019
This was referenced Apr 4, 2019
arvindsv
added a commit
that referenced
this pull request
Apr 5, 2019
The order of the fields determines the output during pipeline export to JSON. This is just to make it look nicer.
arvindsv
added a commit
to arvindsv/gocd
that referenced
this pull request
Apr 5, 2019
arvindsv
added a commit
that referenced
this pull request
Apr 5, 2019
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Attempt to implement #6042.
See documentation for:
How it works:
At the level of a pipeline (for instance, here), add a property called:
display_orderset to any integer. When the repository is parsed and the pipeline is shown in the dashboard, the order of the pipelines in each group is based on their weight, lowest to highest. Pipelines defined in XML have a weight of-1and there is no way provided to change that.Ideally, the
format_versionof the JSON file should be changed to4, but earlier versions will also work.Example:
{ "format_version" : 4, "display_order": 11, "name": "allmaterials", "group" : "configrepo-example", "enable_pipeline_locking": true, "environment_variables": [], "materials": [ { "url": "https://github.com/tomzo/gocd-json-config-example.git", "type": "git", "name" : "mygit", "destination" : "mydest" } ...Todo:
display_order_weightto order pipelines within a gr… gocd-contrib/gocd-groovy-dsl-config-plugin#60]Consider: Is[Changed todisplay_order_weightthe right term to use?display_order]Note: This PR can be merged now. This doesn't need to wait for the todos. But, if no one has concerns and this gets merged, the rest can be worked on.
Scenarios considered:
display_orderset to10.display_orderset to10. Doesn't complain. Uses10.display_orderset to-10(shows up before pipelines defined in XML).4and nodisplay_orderis set. Defaults to-1.Export to JSON/YAML might not export[Checked: Works in all three plugins.]display_order. I'm not too worried about it. I think it's ok not to.Trying it out manually:
After building using the code from this PR, adding this repository as a JSON code repo, should work: https://github.com/arvindsv/gocd_6043
Since the JSON plugin doesn't really do much validation, it will work, even without any support added to it.
Reviewing this change:
It's not very complicated.
A temporary weight is stored at the pipeline config level.
A jolt migration which is tested here takes care of defaulting the value to -1. It's just to maintain consistency. This wasn't strictly needed.
This is where order used to get lost, earlier.
This test shows how it is used in the dashboard representer, just before sending it.
Most of the rest of the code is test files, most of which consist of just some small refactoring.