Skip to content
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

[JENKINS-71722][JENKINS-71758] Respect globally configured period for Periodic generation #485

Merged
merged 5 commits into from
Aug 7, 2023

Conversation

Dohbedoh
Copy link
Contributor

@Dohbedoh Dohbedoh commented Aug 2, 2023

JENKINS-71722: global configuration (disablement and period) was not respected in the periodic generation.

Testing done

  • Start Jenkins
  • Configure a recurrence period of 2 hours
  • Validate that periodic generation happens every 2 hours

Submitter checklist

@Dohbedoh Dohbedoh requested a review from a team as a code owner August 2, 2023 11:14
@jglick jglick changed the title [JENKINS-71722] Respect globally configured period for Periodic gener… [JENKINS-71722] Respect globally configured period for Periodic generation Aug 2, 2023
@jglick jglick added the bug label Aug 2, 2023
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Looks like it would make the system property not work:

public void setPeriod(Integer period) {
if (!isEnforcedPeriod()) {
this.period = Math.max(Math.min(24, period), 1);
} else {
this.period = SupportPlugin.AUTO_BUNDLE_PERIOD_HOURS;
would honor it only if you saved config. I think it is rather which should load the property if defined?

@Dohbedoh
Copy link
Contributor Author

Dohbedoh commented Aug 3, 2023

Right, testing this, the system property is not effective anymore. Maybe we should put the enforcement in the getter rather than the setter.

@Dohbedoh Dohbedoh changed the title [JENKINS-71722] Respect globally configured period for Periodic generation [JENKINS-71722][JENKINS-71758] Respect globally configured period for Periodic generation Aug 3, 2023
@Dohbedoh
Copy link
Contributor Author

Dohbedoh commented Aug 3, 2023

I have also noticed inconsistencies in the UI JENKINS-71758. I think it is best to fix this as part of this PR too.

@Dohbedoh
Copy link
Contributor Author

Dohbedoh commented Aug 3, 2023

Disabled that is enforced by com.cloudbees.jenkins.support.SupportPlugin.AUTO_BUNDLE_PERIOD_HOURS=0:

enforcedDisable

Period enforced by com.cloudbees.jenkins.support.SupportPlugin.AUTO_BUNDLE_PERIOD_HOURS=2:

enforcedPeriod

if (json.getBoolean("enabled") && !json.has("components")) {

if(isEnforcedDisabled()) {
return true;
Copy link
Member

Choose a reason for hiding this comment

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

This is going to suppress unrelated config like

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It leaves the config untouched actually. I tested this.

  • If you set -Dcom.cloudbees.jenkins.support.SupportPlugin.AUTO_BUNDLE_PERIOD_HOURS=0 and then go to the config page and save, it leaves the entire configuration as is (including com.cloudbees.jenkins.support.config.SupportAutomatedBundleConfiguration.xml). So that if you then remove the system property, you are back to your original configuration that you had.

  • If you set -Dcom.cloudbees.jenkins.support.SupportPlugin.AUTO_BUNDLE_PERIOD_HOURS=2 and then go to the config page and save, it leaves only the period configuration as is (including com.cloudbees.jenkins.support.config.SupportAutomatedBundleConfiguration.xml). If you later remove the system property, the generation is still enabled and you are back to your original period value.

Does that makes sense ?

Copy link
Member

Choose a reason for hiding this comment

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

Whatever you say—I am not familiar with the details of this form.

@Dohbedoh Dohbedoh merged commit 976dacf into jenkinsci:master Aug 7, 2023
16 checks passed
@Dohbedoh Dohbedoh deleted the JENKINS-71722 branch August 7, 2023 02:08
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