Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
JENKINS-23908 - Provide way to execute external liquibase
creation of liquibase installation class and available job config
- Loading branch information
Showing
with
119 additions
and 8 deletions.
- +33 −6 src/main/java/org/jenkinsci/plugins/liquibase/builder/LiquibaseBuilder.java
- +58 −0 src/main/java/org/jenkinsci/plugins/liquibase/installation/LiquibaseInstallation.java
- +19 −2 src/main/resources/org/jenkinsci/plugins/liquibase/builder/LiquibaseBuilder/config.jelly
- +9 −0 src/main/resources/org/jenkinsci/plugins/liquibase/builder/LiquibaseInstallation/config.jelly
@@ -0,0 +1,58 @@ | ||
package org.jenkinsci.plugins.liquibase.installation; | ||
|
||
import hudson.EnvVars; | ||
import hudson.Extension; | ||
import hudson.model.EnvironmentSpecific; | ||
import hudson.model.Node; | ||
import hudson.model.TaskListener; | ||
import hudson.slaves.NodeSpecific; | ||
import hudson.tools.ToolDescriptor; | ||
import hudson.tools.ToolInstallation; | ||
import hudson.tools.ToolProperty; | ||
import jenkins.model.Jenkins; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import org.jenkinsci.plugins.liquibase.builder.LiquibaseBuilder; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* Describes details of liquibase installation. | ||
*/ | ||
public class LiquibaseInstallation extends ToolInstallation | ||
implements NodeSpecific<LiquibaseInstallation>, EnvironmentSpecific<LiquibaseInstallation> { | ||
|
||
@DataBoundConstructor | ||
public LiquibaseInstallation(String name, String home, List<? extends ToolProperty<?>> properties) { | ||
super(name, home, properties); | ||
} | ||
|
||
public LiquibaseInstallation forEnvironment(EnvVars environment) { | ||
return new LiquibaseInstallation(getName(), getHome(), getProperties().toList()); | ||
} | ||
|
||
public LiquibaseInstallation forNode(Node node, TaskListener log) throws IOException, InterruptedException { | ||
return new LiquibaseInstallation(getName(), getHome(), getProperties().toList()); | ||
} | ||
|
||
|
||
@Extension | ||
public static class DescriptorImpl extends ToolDescriptor<LiquibaseInstallation> { | ||
@Override | ||
public String getDisplayName() { | ||
return "Liquibase"; | ||
} | ||
|
||
@Override | ||
public LiquibaseInstallation[] getInstallations() { | ||
return Jenkins.getInstance().getDescriptorByType(LiquibaseBuilder.DESCRIPTOR.getClass()).getInstallations(); | ||
} | ||
|
||
@Override | ||
public void setInstallations(LiquibaseInstallation... installations) { | ||
Jenkins.getInstance().getDescriptorByType(LiquibaseBuilder.DESCRIPTOR.getClass()) | ||
.setInstallations(installations); | ||
} | ||
} | ||
} |
@@ -0,0 +1,9 @@ | ||
<j:jelly xmlns:j="jelly:core" | ||
xmlns:f="/lib/form"> | ||
<f:entry title="${%name}" field="name"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="LIQUIBASE_HOME" field="home"> | ||
<f:textbox/> | ||
</f:entry> | ||
</j:jelly> |