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-32725: cancel quite down after reconfiguration #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/target
/target
/.settings
/.classpath
/.project
/work
/work

# Intellij files
.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected void backupNow(final BackupType type) {
backupPath);
LOGGER.log(Level.SEVERE, msg, e);
} finally {
if (!inQuietModeBeforeBackup)
if (!inQuietModeBeforeBackup || Utils.isQuiteDownOngoingButNeedsToCancel(plugin.isWaitForIdle(), hudson))
hudson.doCancelQuietDown();
else
LOGGER.info("Backup process finsihed, but still in quiet mode as before. The quiet mode needs to be cancled manually, because it is not sure who is putting jenkins/hudson into quiet mode.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.jvnet.hudson.plugins.thinbackup.utils.EnvironmentVariableNotDefinedException;
import org.jvnet.hudson.plugins.thinbackup.utils.Utils;
Expand All @@ -36,6 +37,8 @@

import antlr.ANTLRException;

import static org.jvnet.hudson.plugins.thinbackup.utils.Utils.isQuiteDownOngoingButNeedsToCancel;

public class ThinBackupPluginImpl extends Plugin {

private static final int VERY_HIGH_TIMEOUT = 12 * 60;
Expand Down Expand Up @@ -250,6 +253,11 @@ public String getBackupAdditionalFilesRegex() {
}

public void setWaitForIdle(boolean waitForIdle) {
Jenkins jenkinsInstance = Jenkins.getInstance();

if (isQuiteDownOngoingButNeedsToCancel(waitForIdle, jenkinsInstance))
jenkinsInstance.doCancelQuietDown();

this.waitForIdle = waitForIdle;
}

Expand Down
Loading