Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [JENKINS-28118] Fixed poll on ancestor Poll failed searching in parents when “Show one stream at a time” was checked. Fixed regression in PR #25 * Improved logic for Workspace Was not working with “One stream at a time” settings. * Fixed Change log on Ignore Parent getChangesFromStreams did not respect Ignore Stream Parent. * Fixed getStreamRules. IgnoreStreamParent should be the first to be considered, then One Stream at a time on server, then find all streams. * [JENKINS-31316] Fixed server rename Introduced unique identifiers, also added a migrator to ensure best compatibility moving forward. * Fixed backwards compatibility Made the Server UUID change fully backwards compatibility 🎉 * [JENKINS-13817] Mask the damn password already I cannot believe this has been open since 2012... * StringUtils used * Allow empty password even with OBF * Javadoc and removed unused migrate field * [JENKINS-24710] filter out dispatch transactions These usually originate from accurev sync. * PR #24 fix PollOnMaster enabled when build using workspace builds that use workspace or reftree definitely requires workspace even if PollOnMaster enabled.
- Loading branch information
Showing
18 changed files
with
389 additions
and
233 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package hudson.plugins.accurev; | ||
|
||
import hudson.Plugin; | ||
import hudson.init.Initializer; | ||
import hudson.model.Project; | ||
import jenkins.model.Jenkins; | ||
|
||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
import static hudson.init.InitMilestone.COMPLETED; | ||
import static hudson.init.InitMilestone.JOB_LOADED; | ||
|
||
/** | ||
* Created by josp on 21/09/16. | ||
*/ | ||
public class AccurevPlugin extends Plugin { | ||
private static final Logger LOGGER = Logger.getLogger(AccurevPlugin.class.getName()); | ||
/** | ||
* Launches migration after plugin and jobs already initialized. | ||
* Expected milestone: @Initializer(after = JOB_LOADED) | ||
* | ||
* @throws Exception Exceptions? | ||
* @see #initializers() | ||
*/ | ||
public static void runMigrator() throws Exception { | ||
final Jenkins jenkins = Jenkins.getInstance(); | ||
if (jenkins == null) { | ||
throw new IOException("Jenkins instance is not ready"); | ||
} | ||
boolean changed = false; | ||
AccurevSCM.AccurevSCMDescriptor descriptor = jenkins.getDescriptorByType(AccurevSCM.AccurevSCMDescriptor.class); | ||
for (Project<?, ?> p : jenkins.getAllItems(Project.class)) { | ||
if (p.getScm() instanceof AccurevSCM) { | ||
AccurevSCM scm = (AccurevSCM) p.getScm(); | ||
String serverUUID = scm.getServerUUID(); | ||
if (UUIDUtils.isNotValid(serverUUID) || descriptor.getServer(serverUUID) == null) { | ||
AccurevSCM.AccurevServer server = descriptor.getServer(scm.getServerName()); | ||
if (server == null) { | ||
LOGGER.warning("No server found with that name, Project: " + p.getName() + " Server Name: " + scm.getServerName()); | ||
} else { | ||
changed = true; | ||
String uuid = server.getUUID(); | ||
scm.setServerUUID(uuid); | ||
p.save(); | ||
} | ||
} | ||
} | ||
} | ||
if (changed) descriptor.save(); | ||
|
||
} | ||
|
||
/** | ||
* We need ensure that migrator will run after jobs are loaded | ||
* | ||
* @throws Exception Exceptions? | ||
*/ | ||
@Initializer(after = JOB_LOADED, before = COMPLETED) | ||
public static void initializers() throws Exception { | ||
runMigrator(); | ||
} | ||
} |
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
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
Oops, something went wrong.