Skip to content

[JENKINS-70558] Fix TopicAssociation not set after Jenkins restart #484

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

Merged
merged 3 commits into from
Mar 3, 2023
Merged

[JENKINS-70558] Fix TopicAssociation not set after Jenkins restart #484

merged 3 commits into from
Mar 3, 2023

Conversation

ckreisl
Copy link
Contributor

@ckreisl ckreisl commented Feb 3, 2023

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

The PR #481 introduced a small bug that the TopicAssociation field is not set after a Jenkins restart.

Description from Jenkins issue: https://issues.jenkins.io/browse/JENKINS-70558

In the job configuration if TopicAssociation is enabled and Jenkins is restarted the option is not set anymore.
The reason is that the readResolve() function checks the config value
private transient boolean enableTopicAssociation = Config.DEFAULT_ENABLE_TOPIC_ASSOCIATION;
(GerritTrigger.java) which is always false. Since this condition is always the case the topicAssociation value in the GerritTrigger class is set to "null".

*
* @param enable true or false.
*/
@Deprecated
@DataBoundSetter
Copy link
Contributor Author

@ckreisl ckreisl Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's the way how we want it. If the old build configuration xml is read it will set the value already and create the new TopicAssociation class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.xml deserialization doesn't care about @DataBoundSetter et.al. Those are only relevant for form submission and CasC.

Copy link
Member

@rsandell rsandell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write a test using JenkinsSessionRule or RealJenkinsRule to test that the configuration actually survives a restart.

*
* @param enable true or false.
*/
@Deprecated
@DataBoundSetter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.xml deserialization doesn't care about @DataBoundSetter et.al. Those are only relevant for form submission and CasC.

@rsandell rsandell added the bug label Feb 24, 2023
@ckreisl
Copy link
Contributor Author

ckreisl commented Feb 26, 2023

You can write a test using JenkinsSessionRule or RealJenkinsRule to test that the configuration actually survives a restart.

Thanks for the pointer, added a test now and removed the @DataBoundSetter.

@ckreisl ckreisl requested a review from rsandell March 1, 2023 09:46
@rsandell rsandell merged commit 27d6cdc into jenkinsci:master Mar 3, 2023
@ckreisl ckreisl deleted the fix-topic-association-not-set-after-jenkins-restart branch March 4, 2023 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants