From 032c05f18500e798a255af115454d05447168951 Mon Sep 17 00:00:00 2001 From: Luis Toledo Date: Thu, 25 Apr 2019 12:28:13 -0400 Subject: [PATCH 1/2] - Adding option plugin generator (java and script plugin) - Changing template of build.gradle of java plugins in order to use external dependencies - Using a picocli for the client (mainly to improve the help on the command line) --- README.md | 2 + build.gradle | 2 + .../com/rundeck/plugin/Generator.groovy | 65 +++++++------- .../JavaPluginTemplateGenerator.groovy | 4 +- .../ScriptPluginTemplateGenerator.groovy | 7 +- .../plugin/template/ServiceType.groovy | 16 ++++ .../logfilter/build.gradle.template | 39 ++++++++- .../nodeexecutor/build.gradle.template | 39 ++++++++- .../notification/build.gradle.template | 31 ++++++- .../java-plugin/option/Plugin.java.template | 80 ++++++++++++++++++ .../option/PluginSpec.groovy.template | 30 +++++++ .../java-plugin/option/README.md.template | 4 + .../java-plugin/option/build.gradle.template | 68 +++++++++++++++ .../templates/java-plugin/option/icon.png | Bin 0 -> 1704 bytes .../java-plugin/option/java-plugin.structure | 6 ++ .../orchestrator/build.gradle.template | 31 ++++++- .../resourcemodelsource/build.gradle.template | 34 +++++++- .../workflownodestep/build.gradle.template | 33 +++++++- .../workflowstep/build.gradle.template | 33 +++++++- .../script-plugin/option/Makefile.template | 11 +++ .../script-plugin/option/README.md.template | 22 +++++ .../option/build.gradle.template | 21 +++++ .../templates/script-plugin/option/icon.png | Bin 0 -> 1704 bytes .../script-plugin/option/option.template | 7 ++ .../script-plugin/option/plugin.yaml.template | 30 +++++++ .../option/script-plugin.structure | 7 ++ .../JavaPluginTemplateGeneratorTest.groovy | 16 ++++ .../ScriptPluginTemplateGeneratorTest.groovy | 16 ++++ 28 files changed, 599 insertions(+), 55 deletions(-) create mode 100644 src/main/groovy/com/rundeck/plugin/template/ServiceType.groovy create mode 100644 src/main/resources/templates/java-plugin/option/Plugin.java.template create mode 100644 src/main/resources/templates/java-plugin/option/PluginSpec.groovy.template create mode 100644 src/main/resources/templates/java-plugin/option/README.md.template create mode 100644 src/main/resources/templates/java-plugin/option/build.gradle.template create mode 100644 src/main/resources/templates/java-plugin/option/icon.png create mode 100644 src/main/resources/templates/java-plugin/option/java-plugin.structure create mode 100644 src/main/resources/templates/script-plugin/option/Makefile.template create mode 100644 src/main/resources/templates/script-plugin/option/README.md.template create mode 100644 src/main/resources/templates/script-plugin/option/build.gradle.template create mode 100644 src/main/resources/templates/script-plugin/option/icon.png create mode 100644 src/main/resources/templates/script-plugin/option/option.template create mode 100644 src/main/resources/templates/script-plugin/option/plugin.yaml.template create mode 100644 src/main/resources/templates/script-plugin/option/script-plugin.structure diff --git a/README.md b/README.md index fd9decb..40ebc89 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Existing service plugins enabled on boostrap-plugin * LogFilter * NodeExecutor * Orchestrator +* Option #### for Script Plugins: * ResourceModelSource @@ -64,6 +65,7 @@ Existing service plugins enabled on boostrap-plugin * NodeExecutor * FileCopier * NodeExecutorFileCopier: Generate both, Node Executor and File Copier service +* Option #### for UI plugins * UI diff --git a/build.gradle b/build.gradle index edb29b1..36e1287 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,8 @@ dependencies { compile 'com.github.rundeck.cli-toolbelt:toolbelt:0.2.2' compile 'com.github.rundeck.cli-toolbelt:toolbelt-jewelcli:0.2.2' compile 'org.apache.commons:commons-text:1.4' + compile 'info.picocli:picocli:4.0.0-alpha-2' + testCompile 'org.spockframework:spock-core:1.0-groovy-2.4' } diff --git a/src/main/groovy/com/rundeck/plugin/Generator.groovy b/src/main/groovy/com/rundeck/plugin/Generator.groovy index fc59d54..4bda330 100644 --- a/src/main/groovy/com/rundeck/plugin/Generator.groovy +++ b/src/main/groovy/com/rundeck/plugin/Generator.groovy @@ -1,13 +1,14 @@ package com.rundeck.plugin -import com.lexicalscope.jewel.cli.Option import com.rundeck.plugin.template.FilesystemArtifactTemplateGenerator import com.rundeck.plugin.template.PluginType -import org.rundeck.toolbelt.Command -import org.rundeck.toolbelt.CommandRunFailure -import org.rundeck.toolbelt.SubCommand -import org.rundeck.toolbelt.ToolBelt -import org.rundeck.toolbelt.input.jewelcli.JewelInput +import com.rundeck.plugin.template.ServiceType +import picocli.CommandLine +import picocli.CommandLine.Option +import picocli.CommandLine.Command + + +import java.util.concurrent.Callable /* * Copyright 2018 Rundeck, Inc. (http://rundeck.com) @@ -25,36 +26,36 @@ import org.rundeck.toolbelt.input.jewelcli.JewelInput * limitations under the License. */ -@SubCommand -class Generator { +@Command(description = "Create a Rundeck plugin artifact.", + name = "plugin-bootstrap", mixinStandardHelpOptions = true, version = "1.1") +class Generator implements Callable{ - private static final List VALID_PLUGIN_TYPES = ["java","script","ui"] - - public static void main(String[] args) throws IOException, CommandRunFailure { - ToolBelt.with("plugin-bootstrap", new JewelInput(), new Generator()).runMain(args, true); + static void main(String[] args) throws Exception { + try{ + CommandLine.call(new Generator(), args) + }catch(Exception e){ + println(e.getMessage()) + } } - @Command(description = "Create a Rundeck plugin artifact") - public void create(CreateOpts createOpts) { - if(!VALID_PLUGIN_TYPES.contains(createOpts.pluginType)) { - println "Artifact type must be one of: ${VALID_PLUGIN_TYPES.join("|")}" - return - } + @Option(names = [ "-n", "--pluginName" ], description = "Plugin Name." , required = true) + String pluginName; + @Option(names = [ "-t", "--pluginType" ] ,description = 'Plugin Type: ${COMPLETION-CANDIDATES}' , required = true) + PluginType pluginType; + @Option(names = [ "-s", "--serviceType" ],description = 'Rundeck Service Type: ${COMPLETION-CANDIDATES}', required = true) + ServiceType serviceType + @Option(names = [ "-d", "--destinationDirectory" ],description = "The directory in which the artifact directory will be generated", required = true) + String destinationDirectory + + @Override + Void call() throws Exception { FilesystemArtifactTemplateGenerator generator = new FilesystemArtifactTemplateGenerator() - println generator.generate(createOpts.pluginName, - PluginType.valueOf(createOpts.pluginType), - createOpts.serviceType, - createOpts.destinationDirectory) - } - interface CreateOpts { - @Option(shortName = "n",description = "Plugin Name") - String getPluginName() - @Option(shortName = "t",description = "Plugin Type") - String getPluginType() - @Option(shortName = "s",description = "Rundeck Service Type") - String getServiceType() - @Option(shortName = "d",description = "The directory in which the artifact directory will be generated") - String getDestinationDirectory() + println generator.generate(this.pluginName, + this.pluginType, + this.serviceType.toString(), + this.destinationDirectory) + + return null } } diff --git a/src/main/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGenerator.groovy b/src/main/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGenerator.groovy index 8e2a048..bcbedcf 100644 --- a/src/main/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGenerator.groovy +++ b/src/main/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGenerator.groovy @@ -24,7 +24,7 @@ class JavaPluginTemplateGenerator extends AbstractTemplateGenerator { private static final String TEMPLATE_BASE = "templates/java-plugin/" private static final String JAVA_STRUCTURE = "java-plugin.structure" - private static final List ALLOWED_TEMPLATES = ["ResourceModelSource","Notification","WorkflowStep","WorkflowNodeStep","LogFilter","NodeExecutor","Orchestrator"] + private static final List ALLOWED_TEMPLATES = ["ResourceModelSource","Notification","WorkflowStep","WorkflowNodeStep","LogFilter","NodeExecutor","Orchestrator","Option"] @Override Map makeTemplateProperties(final String pluginName, final String providedService) { @@ -51,7 +51,7 @@ class JavaPluginTemplateGenerator extends AbstractTemplateGenerator { @Override void preTemplateValidations(String providedService) { - if(!ALLOWED_TEMPLATES.contains(providedService))throw new Exception("Only "+ALLOWED_TEMPLATES.toString()+" plugins generation are supported at this time") + if(!ALLOWED_TEMPLATES.contains(providedService))throw new Exception("Java plugin does not support this service : ${providedService}. Only "+ALLOWED_TEMPLATES.toString()+" are supported") } @Override diff --git a/src/main/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGenerator.groovy b/src/main/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGenerator.groovy index fdd4d00..f6f8d1e 100644 --- a/src/main/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGenerator.groovy +++ b/src/main/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGenerator.groovy @@ -24,7 +24,7 @@ class ScriptPluginTemplateGenerator extends AbstractTemplateGenerator { private static final String TEMPLATE_BASE = "templates/script-plugin/" private static final String SCRIPT_STRUCTURE = "script-plugin.structure" - private static final List ALLOWED_SERVICE_TYPES = ["NodeExecutor","FileCopier","ResourceModelSource","WorkflowNodeStep","RemoteScriptNodeStep","NodeExecutorFileCopier"] + private static final List ALLOWED_SERVICE_TYPES = ["NodeExecutor","FileCopier","ResourceModelSource","WorkflowNodeStep","RemoteScriptNodeStep","NodeExecutorFileCopier","Option"] @Override Map makeTemplateProperties(final String pluginName, final String providedService) { @@ -51,7 +51,7 @@ class ScriptPluginTemplateGenerator extends AbstractTemplateGenerator { @Override void preTemplateValidations(String providedService) { if(!ALLOWED_SERVICE_TYPES.contains(providedService)) { - throw new Exception("Script plugins do not support serivice: ${providedService}. Allowed types are: ${ALLOWED_SERVICE_TYPES.join(", ")}") + throw new Exception("Script plugin does not support this service: ${providedService}. Allowed types are: ${ALLOWED_SERVICE_TYPES.join(", ")}") } } @@ -73,6 +73,9 @@ class ScriptPluginTemplateGenerator extends AbstractTemplateGenerator { case "NodeExecutorFileCopier": path="nodeexecutor-filecopier" break + default: + path=providedService.toLowerCase() + break } diff --git a/src/main/groovy/com/rundeck/plugin/template/ServiceType.groovy b/src/main/groovy/com/rundeck/plugin/template/ServiceType.groovy new file mode 100644 index 0000000..db5a127 --- /dev/null +++ b/src/main/groovy/com/rundeck/plugin/template/ServiceType.groovy @@ -0,0 +1,16 @@ +package com.rundeck.plugin.template + +enum ServiceType { + ResourceModelSource, + Notification, + WorkflowStep, + WorkflowNodeStep, + LogFilter, + NodeExecutor, + Orchestrator, + FileCopier, + RemoteScriptNodeStep, + NodeExecutorFileCopier, + Option, + UI +} diff --git a/src/main/resources/templates/java-plugin/logfilter/build.gradle.template b/src/main/resources/templates/java-plugin/logfilter/build.gradle.template index 3119ea3..326732d 100644 --- a/src/main/resources/templates/java-plugin/logfilter/build.gradle.template +++ b/src/main/resources/templates/java-plugin/logfilter/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' repositories { @@ -13,24 +19,51 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' +// task to copy plugin libs to output/lib dir +task copyToLib(type: Copy) { + into "\$buildDir/output/lib" + from configurations.pluginLibs +} + jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' - attributes 'Rundeck-Plugin-Tags': 'java,notification' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Tags': 'java,logfilter' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template b/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template index 131b5cd..de1388b 100644 --- a/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template +++ b/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' repositories { @@ -13,9 +19,22 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" @@ -23,16 +42,30 @@ dependencies { testCompile group: 'org.objenesis', name: 'objenesis', version: '1.2' } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' +// task to copy plugin libs to output/lib dir +task copyToLib(type: Copy) { + into "\$buildDir/output/lib" + from configurations.pluginLibs +} + jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' - attributes 'Rundeck-Plugin-Tags': 'java,notification' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Tags': 'java,executor' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/java-plugin/notification/build.gradle.template b/src/main/resources/templates/java-plugin/notification/build.gradle.template index 3119ea3..b714d3b 100644 --- a/src/main/resources/templates/java-plugin/notification/build.gradle.template +++ b/src/main/resources/templates/java-plugin/notification/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' repositories { @@ -13,24 +19,45 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,notification' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/java-plugin/option/Plugin.java.template b/src/main/resources/templates/java-plugin/option/Plugin.java.template new file mode 100644 index 0000000..1d67154 --- /dev/null +++ b/src/main/resources/templates/java-plugin/option/Plugin.java.template @@ -0,0 +1,80 @@ +package com.plugin.${javaPluginClass.toLowerCase()}; + +import com.dtolabs.rundeck.core.plugins.Plugin; +import com.dtolabs.rundeck.core.plugins.configuration.Describable; +import com.dtolabs.rundeck.core.plugins.configuration.Description; +import com.dtolabs.rundeck.plugins.ServiceNameConstants; +import com.dtolabs.rundeck.plugins.descriptions.PluginDescription; +import com.dtolabs.rundeck.plugins.option.OptionValue; +import com.dtolabs.rundeck.plugins.option.OptionValuesPlugin; +import com.dtolabs.rundeck.plugins.util.DescriptionBuilder; +import com.dtolabs.rundeck.plugins.util.PropertyBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Plugin(service=ServiceNameConstants.OptionValues,name="${sanitizedPluginName}") +@PluginDescription(title="${pluginName}", description="My Option plugin description") +public class ${javaPluginClass} implements OptionValuesPlugin, Describable{ + + public static final String SERVICE_PROVIDER_NAME = "${sanitizedPluginName}"; + + /** + * Overriding this method gives the plugin a chance to take part in building the {@link + * com.dtolabs.rundeck.core.plugins.configuration.Description} presented by this plugin. This subclass can use the + * {@link DescriptionBuilder} to modify all aspects of the description, add or remove properties, etc. + */ + @Override + public Description getDescription() { + return DescriptionBuilder.builder() + .name(SERVICE_PROVIDER_NAME) + .title("${pluginName}") + .description("Example Workflow Step") + .property(PropertyBuilder.builder() + .string("example") + .title("Example String") + .description("Example description") + .required(false) + .build() + ) + .property(PropertyBuilder.builder() + .booleanType("exampleBoolean") + .title("Example Boolean") + .description("Example Boolean?") + .required(false) + .defaultValue("false") + .build() + ) + .build(); + } + + @Override + public List getOptionValues(final Map config) { + List options = new ArrayList<>(); + options.add(new StandardOptionValue("Alpha","alpha")); + options.add(new StandardOptionValue("Beta","beta")); + options.add(new StandardOptionValue("Gamma","gamma")); + return options; + } + + class StandardOptionValue implements OptionValue { + + private String name; + private String value; + StandardOptionValue(String name, String value) { + this.name = name; + this.value = value; + } + @Override + public String getName() { + return name; + } + + @Override + public String getValue() { + return value; + } + } + +} \ No newline at end of file diff --git a/src/main/resources/templates/java-plugin/option/PluginSpec.groovy.template b/src/main/resources/templates/java-plugin/option/PluginSpec.groovy.template new file mode 100644 index 0000000..dd22a17 --- /dev/null +++ b/src/main/resources/templates/java-plugin/option/PluginSpec.groovy.template @@ -0,0 +1,30 @@ +package com.plugin.${javaPluginClass.toLowerCase()} + +import com.dtolabs.rundeck.plugins.step.PluginStepContext +import com.dtolabs.rundeck.core.execution.workflow.steps.StepException +import com.dtolabs.rundeck.plugins.PluginLogger +import spock.lang.Specification + +class ${javaPluginClass}Spec extends Specification { + + def getContext(PluginLogger logger){ + Mock(PluginStepContext){ + getLogger()>>logger + } + } + + def "get options"(){ + given: + + def example = new ${javaPluginClass}() + def configuration = [example:"example123",exampleBoolean:"false",] + + when: + def options = example.getOptionValues(configuration) + + then: + options.size() > 0 + } + + +} \ No newline at end of file diff --git a/src/main/resources/templates/java-plugin/option/README.md.template b/src/main/resources/templates/java-plugin/option/README.md.template new file mode 100644 index 0000000..c125df2 --- /dev/null +++ b/src/main/resources/templates/java-plugin/option/README.md.template @@ -0,0 +1,4 @@ +# ${pluginName} Rundeck Plugin + +This is a option plugin. + diff --git a/src/main/resources/templates/java-plugin/option/build.gradle.template b/src/main/resources/templates/java-plugin/option/build.gradle.template new file mode 100644 index 0000000..69adec2 --- /dev/null +++ b/src/main/resources/templates/java-plugin/option/build.gradle.template @@ -0,0 +1,68 @@ +plugins { + id 'groovy' + id 'java' +} + +version = '0.1.0' +defaultTasks 'clean','build' +sourceCompatibility = 1.8 +ext.rundeckPluginVersion= '2.0' +ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' + +repositories { + mavenLocal() + mavenCentral() +} + +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + +dependencies { + compile 'org.rundeck:rundeck-core:3.0.1+' + + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + + testCompile 'junit:junit:4.12' + testCompile "org.codehaus.groovy:groovy-all:2.4.15" + testCompile "org.spockframework:spock-core:1.0-groovy-2.4" +} + +// task to copy plugin libs to output/lib dir +task copyToLib(type: Copy) { + into "\$buildDir/output/lib" + from configurations.pluginLibs +} + +jar { + from "\$buildDir/output" + manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + + attributes 'Rundeck-Plugin-Classnames': pluginClassNames + attributes 'Rundeck-Plugin-File-Version': version + attributes 'Rundeck-Plugin-Name': '${pluginName}' + attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' + attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' + attributes 'Rundeck-Plugin-Tags': 'java,option' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + + } +} + +wrapper { + gradleVersion = '4.4.1' +} diff --git a/src/main/resources/templates/java-plugin/option/icon.png b/src/main/resources/templates/java-plugin/option/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7aaf7e86c71a6ef5ccce85c9a7a081da744f16b8 GIT binary patch literal 1704 zcmV;Z23PrsP);EK~!jg?U{c}Rb?2*Kj&WVy>hRYAA0Y?UzDgIVEC&{4Z>DR zx=?;pD;s8-qaRaO7R8)pxwUDFTGL!<)@DoRudxV_(zRN-OoTZHk~dOpq^O`GAY8cT z^v5j-N=s{JusyACsb+NE9hFQACAqKixtUB$hFsLyXc*CW`0_d{Sx_L^X5~MiLjygiu8-USV5P zLS!VK<_JruHWQ{_>?4r}c?cOv)7Es;xRSZlGsJ9|zeElvc%6enwx)%&VP`Q}1O}*) zevxm;r&7}{B<$Z1%O-9QMX0~TJCrkv)2cQh5n@3hWdOTlI|0qsB_u+g=aA-%nZY{J zd5_yvZA=T9zv7N{E9VK4I^G6~)hpX9){X1dd-*b;N=~77y$4 zanOTPu)D3rOON1O8x}H@4kGE&?bk&ZT>`W%gzI{dGbALID;#DEF|-+R*F-Z;rjXBN z1_}G<-Xm_hDB+U<6Coq9h-}Ufsmo875DN+)vu{9a#(GjIW1Mb3T|$beU_L+SCK1Kg z+|0||ZOB(x$Wp3U$#;fGL~tG#3&|BerLKpNS30M8mr_FnB9M{DBZo#J49CzElE?*$ z*@>NiVG=E@Bc0C~V=9KK5Dy)cu!AT%O_8YK0CBuVy6HHobz~yv*uoUkBx?AO$wF^{ zS}=9_@Na@@YKkYJK(9V&dYW zd;bpvWQvRHSi1C6JRT?0rj4Mc#{4ZxUS0|tHq0hBcNd2a{cI?P>WbKG!S59{HRtj9 zno$(U$w^}S_8dcG{UI&wW;`Az6DQteIEGLi$;{kAeEddIQZ^F^$jqJ{XPD6Kwj*7) zw^ytvCpC2&@4tVv&vU!oirp^u@kh9fTCEa^iNOmqzrSxynKNe$SFaZG_S^UMKC7%; zMr-R!xZQRv7Kws_nY6SN(Arwal`Ah%U7gR>tA)&+JC+w-n90F|i^$DQ;;pwbXlpB^ zsw$t3j@4YdwweP677-Pt-U$n}@wK(jV6$1VS|t<(wr;KJ^SjMvVenu(k&%wxXI`%h zx7&dvNvv6O7i-tfA`pH$=xLkJZb}O>1;BwiSJUIrRuNkk` z#Xa|oX5G5GS-!ly-!TfUh@wDSo1eP6i#+#S1qB6Ph`0g4l`JewLzWe0%=mx_6E-ty zR1p_0wA0fg-(cU_8GLQtyY~d~@f%4`{|JD4?^RD{p%qC^-o&X>mxTxaXN(>ljl*H3 zq2V$|j{E|^rAwXc-(OE&UjN@&N=r`yaQbwR*X6RS@`U6%==Yh8hzO>Z)haP$NH~h3 z(Ae0DEGxvsxbb?O07w!{ojMFz?!OlQ9#c`o>UBtj{Pfc$Ah_ute|!>q_B@2kWkXSd zsj_EJEe?m3W5=GNs3?Q#>U@%t#BbU~pqg5Nz>PV4J!DzI=WC(3xQ?u>@od|+00{0Y ziv^rc8_SlJ5FQ>zW@bWfC(zXuz~QjoFys9#fYw-4d##L&F+@Z-C@b^P-rn~LXV|d8 zq^8DFUw?_Js(Wbr{D58r>^h}-Sx{kx&z3SnUuva`q2+S)}$MZGa0p@7?M=j6%dcsx!v zZ1|R=N6(U$7R$<&(`jz*VEFJi>F(BEc`f`c-S4VZGg!ZVcAuux?+=ijy_2%CA49_N yx3%%Hv60N1Hx7@-NmElBB_$_0cP?~SO1}d1V%O)$wH#Xj0000build.gradle +README.md.template->README.md +icon.png->src/main/resources/resources/icon.png +Plugin.java.template->src/main/java/com/plugin/${javaPluginClass.toLowerCase()}/${javaPluginClass}.java +PluginSpec.groovy.template->src/test/groovy/com/plugin/${javaPluginClass.toLowerCase()}/${javaPluginClass}Spec.groovy + diff --git a/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template b/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template index 7e9afbb..2eefa9c 100644 --- a/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template +++ b/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' repositories { @@ -13,24 +19,45 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,orchestrator' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template b/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template index dbe5f90..f209f68 100644 --- a/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template +++ b/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}Factory' repositories { @@ -13,23 +19,45 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}Factory' jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' + attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' - attributes 'Rundeck-Plugin-Tags': 'java,notification' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Tags': 'java,resourceModel' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template b/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template index 3119ea3..cd9eece 100644 --- a/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template +++ b/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' repositories { @@ -13,24 +19,45 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' - attributes 'Rundeck-Plugin-Tags': 'java,notification' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Tags': 'java,NodeStep' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template b/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template index 3119ea3..319a05a 100644 --- a/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template +++ b/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template @@ -1,3 +1,8 @@ +plugins { + id 'groovy' + id 'java' +} + version = '0.1.0' defaultTasks 'clean','build' apply plugin: 'java' @@ -6,6 +11,7 @@ apply plugin: 'idea' sourceCompatibility = 1.8 ext.rundeckPluginVersion= '2.0' ext.rundeckVersion= '${rundeckVersion}' +ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' repositories { @@ -13,24 +19,45 @@ repositories { mavenCentral() } +configurations{ + //declare custom pluginLibs configuration to include only libs for this plugin + pluginLibs + + //declare compile to extend from pluginLibs so it inherits the dependencies + compile{ + extendsFrom pluginLibs + } +} + dependencies { compile 'org.rundeck:rundeck-core:3.0.1+' + //use pluginLibs to add dependecies, example: + //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + testCompile 'junit:junit:4.12' testCompile "org.codehaus.groovy:groovy-all:2.4.15" testCompile "org.spockframework:spock-core:1.0-groovy-2.4" } -ext.pluginClassNames='com.plugin.${sanitizedPluginName}.${javaPluginClass}' jar { + from "\$buildDir/output" manifest { + def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ') + attributes 'Rundeck-Plugin-Classnames': pluginClassNames attributes 'Rundeck-Plugin-File-Version': version attributes 'Rundeck-Plugin-Name': '${pluginName}' attributes 'Rundeck-Plugin-Description': 'Provide a short description of your plugin here.' attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' - attributes 'Rundeck-Plugin-Tags': 'java,notification' - attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Tags': 'java,WorkflowStep' + attributes 'Rundeck-Plugin-License': 'Apache 2.0' + attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' + attributes 'Rundeck-Plugin-Version': rundeckPluginVersion + attributes 'Rundeck-Plugin-Archive': 'true' + attributes 'Rundeck-Plugin-Libs': "\${libList}" + } } diff --git a/src/main/resources/templates/script-plugin/option/Makefile.template b/src/main/resources/templates/script-plugin/option/Makefile.template new file mode 100644 index 0000000..9bfae30 --- /dev/null +++ b/src/main/resources/templates/script-plugin/option/Makefile.template @@ -0,0 +1,11 @@ +all: install + +clean: + rm -rf build + +build: + mkdir -p build/libs build/zip-content/${sanitizedPluginName} + cp -r contents resources plugin.yaml build/zip-content/${sanitizedPluginName} + cd build/zip-content; zip -r ${sanitizedPluginName}.zip * + mv build/zip-content/${sanitizedPluginName}.zip build/libs + diff --git a/src/main/resources/templates/script-plugin/option/README.md.template b/src/main/resources/templates/script-plugin/option/README.md.template new file mode 100644 index 0000000..322765d --- /dev/null +++ b/src/main/resources/templates/script-plugin/option/README.md.template @@ -0,0 +1,22 @@ +# ${pluginName} Rundeck Plugin + +This is a ${providedService} plugin. + +## Build + +* Using gradle +``` +gradle clean build +``` + +* Using make + +``` +make clean build +``` + +## Install + +``` +cp build/libs/${sanitizedPluginName}.zip \$RDECK_BASE/libext +``` \ No newline at end of file diff --git a/src/main/resources/templates/script-plugin/option/build.gradle.template b/src/main/resources/templates/script-plugin/option/build.gradle.template new file mode 100644 index 0000000..fd9b92a --- /dev/null +++ b/src/main/resources/templates/script-plugin/option/build.gradle.template @@ -0,0 +1,21 @@ +buildscript { + repositories { + mavenCentral() + } +} +plugins { + id 'pl.allegro.tech.build.axion-release' version '1.7.0' +} + +ext.pluginName = '${pluginName}' +ext.pluginDescription = "Provide a short description of your plugin here" +ext.sopsCopyright = "© 2018, Rundeck, Inc." +ext.sopsUrl = "http://rundeck.com" +ext.buildDateString=new Date().format("yyyy-MM-dd'T'HH:mm:ssX") +ext.archivesBaseName = "${sanitizedPluginName}" +ext.pluginBaseFolder = "." + +project.version = "0.1.0-SNAPSHOT" +ext.archiveFilename = ext.archivesBaseName + '-' + version + +apply from: 'https://raw.githubusercontent.com/rundeck-plugins/build-zip/master/build.gradle' \ No newline at end of file diff --git a/src/main/resources/templates/script-plugin/option/icon.png b/src/main/resources/templates/script-plugin/option/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7aaf7e86c71a6ef5ccce85c9a7a081da744f16b8 GIT binary patch literal 1704 zcmV;Z23PrsP);EK~!jg?U{c}Rb?2*Kj&WVy>hRYAA0Y?UzDgIVEC&{4Z>DR zx=?;pD;s8-qaRaO7R8)pxwUDFTGL!<)@DoRudxV_(zRN-OoTZHk~dOpq^O`GAY8cT z^v5j-N=s{JusyACsb+NE9hFQACAqKixtUB$hFsLyXc*CW`0_d{Sx_L^X5~MiLjygiu8-USV5P zLS!VK<_JruHWQ{_>?4r}c?cOv)7Es;xRSZlGsJ9|zeElvc%6enwx)%&VP`Q}1O}*) zevxm;r&7}{B<$Z1%O-9QMX0~TJCrkv)2cQh5n@3hWdOTlI|0qsB_u+g=aA-%nZY{J zd5_yvZA=T9zv7N{E9VK4I^G6~)hpX9){X1dd-*b;N=~77y$4 zanOTPu)D3rOON1O8x}H@4kGE&?bk&ZT>`W%gzI{dGbALID;#DEF|-+R*F-Z;rjXBN z1_}G<-Xm_hDB+U<6Coq9h-}Ufsmo875DN+)vu{9a#(GjIW1Mb3T|$beU_L+SCK1Kg z+|0||ZOB(x$Wp3U$#;fGL~tG#3&|BerLKpNS30M8mr_FnB9M{DBZo#J49CzElE?*$ z*@>NiVG=E@Bc0C~V=9KK5Dy)cu!AT%O_8YK0CBuVy6HHobz~yv*uoUkBx?AO$wF^{ zS}=9_@Na@@YKkYJK(9V&dYW zd;bpvWQvRHSi1C6JRT?0rj4Mc#{4ZxUS0|tHq0hBcNd2a{cI?P>WbKG!S59{HRtj9 zno$(U$w^}S_8dcG{UI&wW;`Az6DQteIEGLi$;{kAeEddIQZ^F^$jqJ{XPD6Kwj*7) zw^ytvCpC2&@4tVv&vU!oirp^u@kh9fTCEa^iNOmqzrSxynKNe$SFaZG_S^UMKC7%; zMr-R!xZQRv7Kws_nY6SN(Arwal`Ah%U7gR>tA)&+JC+w-n90F|i^$DQ;;pwbXlpB^ zsw$t3j@4YdwweP677-Pt-U$n}@wK(jV6$1VS|t<(wr;KJ^SjMvVenu(k&%wxXI`%h zx7&dvNvv6O7i-tfA`pH$=xLkJZb}O>1;BwiSJUIrRuNkk` z#Xa|oX5G5GS-!ly-!TfUh@wDSo1eP6i#+#S1qB6Ph`0g4l`JewLzWe0%=mx_6E-ty zR1p_0wA0fg-(cU_8GLQtyY~d~@f%4`{|JD4?^RD{p%qC^-o&X>mxTxaXN(>ljl*H3 zq2V$|j{E|^rAwXc-(OE&UjN@&N=r`yaQbwR*X6RS@`U6%==Yh8hzO>Z)haP$NH~h3 z(Ae0DEGxvsxbb?O07w!{ojMFz?!OlQ9#c`o>UBtj{Pfc$Ah_ute|!>q_B@2kWkXSd zsj_EJEe?m3W5=GNs3?Q#>U@%t#BbU~pqg5Nz>PV4J!DzI=WC(3xQ?u>@od|+00{0Y ziv^rc8_SlJ5FQ>zW@bWfC(zXuz~QjoFys9#fYw-4d##L&F+@Z-C@b^P-rn~LXV|d8 zq^8DFUw?_Js(Wbr{D58r>^h}-Sx{kx&z3SnUuva`q2+S)}$MZGa0p@7?M=j6%dcsx!v zZ1|R=N6(U$7R$<&(`jz*VEFJi>F(BEc`f`c-S4VZGg!ZVcAuux?+=ijy_2%CA49_N yx3%%Hv60N1Hx7@-NmElBB_$_0cP?~SO1}d1V%O)$wH#Xj0000plugin.yaml +option.template->contents/option +icon.png->resources/icon.png +README.md.template->README.md +build.gradle.template->build.gradle +Makefile.template->Makefile + diff --git a/src/test/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGeneratorTest.groovy b/src/test/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGeneratorTest.groovy index b0818c1..b2debb2 100644 --- a/src/test/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGeneratorTest.groovy +++ b/src/test/groovy/com/rundeck/plugin/generator/JavaPluginTemplateGeneratorTest.groovy @@ -117,4 +117,20 @@ class JavaPluginTemplateGeneratorTest extends Specification { new File(tmpDir,"/my-nodeexecutor-plugin/src/test/groovy/com/plugin/mynodeexecutorplugin/MyNodeexecutorPluginSpec.groovy").exists() } + def "Create Option Template"() { + when: + File tmpDir= File.createTempDir() + JavaPluginTemplateGenerator generator = new JavaPluginTemplateGenerator() + generator.createTemplate("My Option Plugin","Option",tmpDir.absolutePath) + int compileResult = TestUtils.buildGradle(new File(tmpDir,"my-option-plugin")) + + then: + compileResult == 0 + new File(tmpDir,"/my-option-plugin/build.gradle").exists() + new File(tmpDir,"/my-option-plugin/src/main/resources/resources/icon.png").exists() + new File(tmpDir,"/my-option-plugin/README.md").exists() + new File(tmpDir,"/my-option-plugin/src/main/java/com/plugin/myoptionplugin/MyOptionPlugin.java").exists() + new File(tmpDir,"/my-option-plugin/src/test/groovy/com/plugin/myoptionplugin/MyOptionPluginSpec.groovy").exists() + } + } diff --git a/src/test/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGeneratorTest.groovy b/src/test/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGeneratorTest.groovy index eecdeb2..887701d 100644 --- a/src/test/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGeneratorTest.groovy +++ b/src/test/groovy/com/rundeck/plugin/generator/ScriptPluginTemplateGeneratorTest.groovy @@ -34,4 +34,20 @@ class ScriptPluginTemplateGeneratorTest extends Specification { new File(destDir,"test-script-plugin/README.md").exists() } + + def "Generate Option Script Plugin From Template"() { + setup: + File destDir = File.createTempDir() + + when: + ScriptPluginTemplateGenerator generator = new ScriptPluginTemplateGenerator() + generator.createTemplate("Option Script Plugin","Option",destDir.absolutePath) + + then: + new File(destDir,"option-script-plugin/plugin.yaml").exists() + new File(destDir,"option-script-plugin/contents/option").exists() + new File(destDir,"option-script-plugin/resources/icon.png").exists() + new File(destDir,"option-script-plugin/README.md").exists() + + } } From e6295f63e09fefe8b915cf16bda2136983bc3666 Mon Sep 17 00:00:00 2001 From: Luis Toledo Date: Thu, 25 Apr 2019 15:12:39 -0400 Subject: [PATCH 2/2] - removing repo URL from source link - minimum rundeck version should be 3.0.14 --- .../templates/java-plugin/logfilter/build.gradle.template | 4 ++-- .../templates/java-plugin/nodeexecutor/build.gradle.template | 4 ++-- .../templates/java-plugin/notification/build.gradle.template | 4 ++-- .../templates/java-plugin/option/build.gradle.template | 4 ++-- .../templates/java-plugin/orchestrator/build.gradle.template | 4 ++-- .../java-plugin/resourcemodelsource/build.gradle.template | 4 ++-- .../java-plugin/workflownodestep/build.gradle.template | 4 ++-- .../templates/java-plugin/workflowstep/build.gradle.template | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/resources/templates/java-plugin/logfilter/build.gradle.template b/src/main/resources/templates/java-plugin/logfilter/build.gradle.template index 326732d..760cc19 100644 --- a/src/main/resources/templates/java-plugin/logfilter/build.gradle.template +++ b/src/main/resources/templates/java-plugin/logfilter/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -58,7 +58,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,logfilter' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template b/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template index de1388b..67e4f7c 100644 --- a/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template +++ b/src/main/resources/templates/java-plugin/nodeexecutor/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -60,7 +60,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,executor' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/notification/build.gradle.template b/src/main/resources/templates/java-plugin/notification/build.gradle.template index b714d3b..7c0f203 100644 --- a/src/main/resources/templates/java-plugin/notification/build.gradle.template +++ b/src/main/resources/templates/java-plugin/notification/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -52,7 +52,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,notification' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/option/build.gradle.template b/src/main/resources/templates/java-plugin/option/build.gradle.template index 69adec2..7072701 100644 --- a/src/main/resources/templates/java-plugin/option/build.gradle.template +++ b/src/main/resources/templates/java-plugin/option/build.gradle.template @@ -26,7 +26,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -54,7 +54,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,option' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template b/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template index 2eefa9c..01e54b1 100644 --- a/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template +++ b/src/main/resources/templates/java-plugin/orchestrator/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -52,7 +52,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,orchestrator' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template b/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template index f209f68..7a2ca6c 100644 --- a/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template +++ b/src/main/resources/templates/java-plugin/resourcemodelsource/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -52,7 +52,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,resourceModel' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template b/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template index cd9eece..b2146e4 100644 --- a/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template +++ b/src/main/resources/templates/java-plugin/workflownodestep/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -52,7 +52,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,NodeStep' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true' diff --git a/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template b/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template index 319a05a..fa940c5 100644 --- a/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template +++ b/src/main/resources/templates/java-plugin/workflowstep/build.gradle.template @@ -30,7 +30,7 @@ configurations{ } dependencies { - compile 'org.rundeck:rundeck-core:3.0.1+' + compile 'org.rundeck:rundeck-core:3.0.14+' //use pluginLibs to add dependecies, example: //pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2' @@ -52,7 +52,7 @@ jar { attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '3.x' attributes 'Rundeck-Plugin-Tags': 'java,WorkflowStep' attributes 'Rundeck-Plugin-License': 'Apache 2.0' - attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck/plugin-bootstrap' + attributes 'Rundeck-Plugin-Source-Link': 'Please put the link to your source repo here' attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all' attributes 'Rundeck-Plugin-Version': rundeckPluginVersion attributes 'Rundeck-Plugin-Archive': 'true'