[JENKINS-63846] From address can't be changed #249
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.
See JENKINS-63846. Versions 2.71 and earlier persisted the address for additional accounts but not the default account. Starting in 2.72, the admin address is copied from the Jenkins Location configuration into the default account at the time
ExtendedEmailPublisherDescriptor
is first saved, but this value is not editable in the UI nor does it get updated when the admin address is subsequently updated in the Jenkins Location configuration. Compare the persisted XML before and after. In the second example, you can see thataddress
has been persisted for the default account at the timeExtendedEmailPublisherDescriptor
was saved. Even though the Jenkins Location configuration was later modified, that change was never propagated back toExtendedEmailPublisherDescriptor
.This change reverts us back to the old (working) design where only additional accounts have a persisted address and the default account has a
null
address, delegating to the Jenkins Location configuration. In order to clear up the bad state that was persisted between 2.72 and 2.77, we unconditionally clear the address for the default account inExtendedEmailPublisherDescriptor#readResolve
.I have added two new tests to verify the correctness of this fix.
ExtendedEmailPublisherTest#testSystemAdminEmailChange
verifies that admin address changes work on the current release, andExtendedEmailPublisherDescriptorTest#persistedConfigurationBeforeDefaultAddress
verifies that the persistent state from 2.72 is correctly cleaned up inExtendedEmailPublisherDescriptor#readResolve
.