forked from prospero238/liquibase-runner
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-23908 - Provide way to execute external liquibase
creation of liquibase installation class and available job config
- Loading branch information
1 parent
d95b122
commit 4b64c53
Showing
4 changed files
with
119 additions
and
8 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
58 changes: 58 additions & 0 deletions
58
src/main/java/org/jenkinsci/plugins/liquibase/installation/LiquibaseInstallation.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,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); | ||
} | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
...main/resources/org/jenkinsci/plugins/liquibase/builder/LiquibaseInstallation/config.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,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> |