-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite rebuild actions using javascript java injection
First version of rebuild that includes all the job parameters. Some improvements should be done like have just one common.jelly but not clear how jelly include logic works. Tested using gerrit-trigger Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
- Loading branch information
Showing
11 changed files
with
409 additions
and
4 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
47 changes: 47 additions & 0 deletions
47
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/OriginalLoadedScripts.java
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,47 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2016 CloudBees, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package io.jenkins.plugins.pipelinegraphview.utils; | ||
|
||
import hudson.ExtensionPoint; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution; | ||
|
||
/** | ||
* Defines which scripts are eligible to be replaced by {@link ReplayAction#run}. | ||
*/ | ||
public abstract class OriginalLoadedScripts implements ExtensionPoint { | ||
|
||
/** | ||
* Finds scripts which are eligible for replacement. | ||
* @param execution a build | ||
* @return a map from Groovy class names to their original texts, as in {@link ReplayAction#replace} | ||
*/ | ||
public @NonNull Map<String,String> loadScripts(@NonNull CpsFlowExecution execution) { | ||
return Collections.emptyMap(); | ||
} | ||
|
||
} |
81 changes: 81 additions & 0 deletions
81
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/ReplayCause.java
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,81 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2016 CloudBees, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package io.jenkins.plugins.pipelinegraphview.utils; | ||
|
||
import hudson.console.ModelHyperlinkNote; | ||
import hudson.model.Cause; | ||
import hudson.model.Run; | ||
import hudson.model.TaskListener; | ||
import edu.umd.cs.findbugs.annotations.CheckForNull; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
||
/** | ||
* Marker that a run is a replay of an earlier one. | ||
*/ | ||
public class ReplayCause extends Cause { | ||
|
||
private final int originalNumber; | ||
private transient Run<?,?> run; | ||
|
||
ReplayCause(@NonNull Run<?,?> original) { | ||
this.originalNumber = original.getNumber(); | ||
} | ||
|
||
@Override public void onAddedTo(Run run) { | ||
super.onAddedTo(run); | ||
this.run = run; | ||
} | ||
|
||
@Override public void onLoad(Run<?,?> run) { | ||
super.onLoad(run); | ||
this.run = run; | ||
} | ||
|
||
public Run<?,?> getRun() { | ||
return run; | ||
} | ||
|
||
public int getOriginalNumber() { | ||
return originalNumber; | ||
} | ||
|
||
public @CheckForNull Run<?,?> getOriginal() { | ||
return run.getParent().getBuildByNumber(originalNumber); | ||
} | ||
|
||
@Override public String getShortDescription() { | ||
return "Replayed " + getOriginalNumber(); | ||
} | ||
|
||
@Override public void print(TaskListener listener) { | ||
Run<?,?> original = getOriginal(); | ||
if (original != null) { | ||
listener.getLogger().println("Replayed " + getOriginalNumber()); | ||
} else { | ||
super.print(listener); // same, without hyperlink | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.