forked from geoffbullen/build-pipeline-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from jenkinsci/JENKINS-38670
Refactor build card into extensible class
- Loading branch information
Showing
16 changed files
with
1,006 additions
and
543 deletions.
There are no files selected for viewing
304 changes: 39 additions & 265 deletions
304
src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java
Large diffs are not rendered by default.
Oops, something went wrong.
399 changes: 399 additions & 0 deletions
399
.../java/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension.java
Large diffs are not rendered by default.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...n/java/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/StandardBuildCard.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,64 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2016 the Jenkins project | ||
* | ||
* 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 au.com.centrumsystems.hudson.plugin.buildpipeline.extension; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Descriptor; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
|
||
/** | ||
* @author dalvizu | ||
*/ | ||
@Extension | ||
public class StandardBuildCard | ||
extends BuildCardExtension { | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
@DataBoundConstructor | ||
public StandardBuildCard() { | ||
|
||
} | ||
|
||
@Override | ||
public long getIndex() { | ||
return 0; | ||
} | ||
|
||
/** | ||
* Descriptor, since we're in the UI | ||
*/ | ||
@Extension | ||
public static class DescriptorImpl | ||
extends Descriptor<BuildCardExtension> { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Standard build card"; | ||
} | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
...umsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/buildCardHelpers.jelly
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,22 @@ | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt"> | ||
<!-- | ||
This file is included once in the build pipeline file - it is intended to allow a BuildCardExtension to contribute | ||
any 'global' scripts or assets to the build pipeline. This includes the ability to add a Handlebars helper | ||
(if you really, really must be using JS in a handlebars template). | ||
By default we just include helpers to append script tags to your build card | ||
--> | ||
<![CDATA[ | ||
<script type="text/javascript"> | ||
Handlebars.registerHelper('startScript', function() { | ||
return new Handlebars.SafeString("<scr" + "ipt>"); | ||
}); | ||
Handlebars.registerHelper('endScript', function() { | ||
return new Handlebars.SafeString("</scr" + "ipt>"); | ||
}); | ||
</script> | ||
]]> | ||
</j:jelly> |
Oops, something went wrong.