Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
Simplify and just use the whole file for stub and rewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
batmat committed May 1, 2019
1 parent 2bf2336 commit 08ab821
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Expand Up @@ -30,10 +30,11 @@
* So using the Evergreen Jenkins plugin, we detect these outdated files, and update them in place, so next update will not just crash
* instances.
*/
@Extension
public class EvergreenCascUpdater {
@Extension @Symbol("remotingCLI")
@Restricted(NoExternalUse.class)
public class RemotingCLIEvergreenStub extends GlobalConfiguration implements PersistentDescriptor {

private static final Logger LOGGER = Logger.getLogger(EvergreenCascUpdater.class.getName());
private static final Logger LOGGER = Logger.getLogger(RemotingCLIEvergreenStub.class.getName());
private static final String SHA1_BEFORE_CHANGE = "8d4ef50d006e24d26c4eaf0a9122a2dfc4f40dd9";

@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED, before = InitMilestone.JOB_LOADED)
Expand All @@ -50,7 +51,7 @@ static void fixFileIfNeeded(Path createAdminUserFilePath) throws IOException {

if (SHA1_BEFORE_CHANGE.equals(fileSha1)) {
LOGGER.log(Level.WARNING, "Outdated config file detected, updating it with new version");
Files.copy(EvergreenCascUpdater.class.getResourceAsStream(
Files.copy(RemotingCLIEvergreenStub.class.getResourceAsStream(
"/io/jenkins/plugins/evergreen/create-admin-user-without-remotingCLI.yaml"),
createAdminUserFilePath,
StandardCopyOption.REPLACE_EXISTING);
Expand All @@ -60,8 +61,4 @@ static void fixFileIfNeeded(Path createAdminUserFilePath) throws IOException {
}
}

@Extension @Symbol("remotingCLI")
@Restricted(NoExternalUse.class)
public static class RemotingCLIEvergreenStub extends GlobalConfiguration implements PersistentDescriptor {
}
}
Expand Up @@ -30,7 +30,7 @@ public void fixFileIfNeeded() throws IOException {
StandardCopyOption.REPLACE_EXISTING);

// When
EvergreenCascUpdater.fixFileIfNeeded(filePath);
RemotingCLIEvergreenStub.fixFileIfNeeded(filePath);

// Then
final byte[] data = Files.readAllBytes(filePath);
Expand Down

0 comments on commit 08ab821

Please sign in to comment.