-
Notifications
You must be signed in to change notification settings - Fork 973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support auto-update flag in pipelines from config repos #11636
Draft
peterrosell
wants to merge
6
commits into
gocd:master
Choose a base branch
from
peterrosell:auto-update-for-materials-in-config-repos
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fcd096f
support auto-update flag in pipelines from config repos
peterrosell bc229cb
Merge branch 'master' into auto-update-for-materials-in-config-repos
chadlwilson b931f50
test
chadlwilson bff7f35
Make auto update mutation clearer
chadlwilson 71eb7e9
Merge remote-tracking branch 'upstream/master' into auto-update-for-m…
chadlwilson 70b749d
Merge remote-tracking branch 'upstream/master' into auto-update-for-m…
chadlwilson File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually setting the value underneath on the
SCM
which is already passed into the constructor via thescmConfig
. For clarity, it appears that if anywhere, this should be set earlier directly on the de-duplicatedSCM
to be less confusing.But it may however highlight a problem with the scope of
auto_update
and how it works when multiple pipelines use the same logical material but declare differentauto_update
values.We might need to understand what the consequences are for this for determinism of behaviour when creating and merging these - at least to ensure it behaves the same way as the non-pluggable SCMs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you mean that the code between line 370 and 392 searches for an duplicated
scmConfig
?To avoid that we find a
scmConfig
that we then modify we should set this flag on thescmConfig
before doing the search.So around line 376 add this
and revert the change on lines 399-403
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, possibly directly setting the value on the scmConfig prior to constructing is clearer that you might be modifying an existing (shared) config, since the property belongs to the overall config rather than the pluggable config.
But I'll still need to check any implications. In general the way this stuff is modelled in GoCD is a bit problematic due to the de-duplication of SCMs. It's not possible to, say, have one pipeline with a material being manual and another pipeline with the same scm (url, branch) that is auto updating (polling). This causes indeterminism by design, and confusion to users. It's even more confusing for users/admins if there are a mixture of config repo and UI-created pipelines.
The workaround for this nornally is for users to use blanket
**/*
denylists in individual pipelines' consumption of a material to vary triggering but that won't stop the polling (where people have a preference for webhooks and want to reduce load on their SCM server) - only stop the triggering of certain pipelines.So I'll want to verify that the way this change behaves is at least similar to git, svn and other SCMs in its determinism/indeterminism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the method
setCommonScmMaterialMembers
(line 480) theautoUpdate
flag is set for material of UI-created pipelines. That method is called intoScmMaterialConfig
for each type of SCM. There is no handling ofSCM
in that method, maybe it's handled in a different way.To verify that it doesn't mess up with the other CSMs we could write a test that...
autoUpdate=true
toPluggableScmMaterialConfig
method withautoUpdate=false
scmConfig
created and not a reused one.Let me know if there is anything I can give any help or if you want to have a look on your own into this area. It's a lot of details, but I guess you knows the much better than me. :-)
About the workaround. My goal is to reduce the load on the git server as we have a lot of pipelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this fix overall is definitely needed, reasonable and should be able to be made work. I'll try and get some time to play "in anger", and can make the minor tweaks.
Perhaps for the non-plugin ones the de-duplication happens at runtime somehow, or I am misinterpreting the "scope" of the de-duplication that is happening here.
Do you mind sharing which SCM plugin you are using/interested in here? Otherwise I'll probably validate with https://github.com/TWChennai/gocd-git-path-material-plugin since I understand it in depth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the gocd-yaml-config-plugin and also tested the corresponding json version just to verify that the problem wasn't with the file syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am asking which SCM plugin you are using, i.e which type of custom material you are trying to configure as
auto_update: false
.