Skip to content

Commit

Permalink
Merge pull request #136 from ibm-datapower/PLUGINS-3892
Browse files Browse the repository at this point in the history
groovy 3 compatibility changes done and deploymentPolicyObjectVariabl…
  • Loading branch information
Amiya-873 authored Sep 24, 2024
2 parents 4cfd2d7 + 3f7f8f2 commit b850d0d
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 15 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches:
- master # Trigger this workflow on pushes to the "master" branch

jobs:
build_and_release:
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '8' # Use the appropriate JDK version
distribution: 'adopt' # Set the Java distribution

- name: Install Ant
run: sudo apt-get install -y ant

- name: Build the project
run: ant -Dskip.chkpii=y # Run the specified Ant command

- name: List files in dist directory
run: ls -l dist # Debugging step to list files

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: Datapower25
files: |
dist/*.zip
dist/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<!-- Java-related defaults -->
<property name="java.debug" value="true"/>
<property name="needed.java.version" value="1.6"/>
<property name="needed.java.version" value="1.7"/>

<!-- Which Xalan version to include -->
<property name="needed.xalan.version" value="2.7.2"/>
Expand All @@ -50,7 +50,7 @@
<property name="needed.ant.version" value="1.9.9"/>

<!-- Plugin version during build time -->
<property name="plugin.version" value="dev"/>
<property name="plugin.version" value="26"/>

<target name="distro" description="Produce a new distribution" depends="clean,plugin">

Expand Down
4 changes: 2 additions & 2 deletions deploy.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'import.file' is required but not defined. This is the .zip or .xcfg file to import into the domain." unless="import.file"/>
<fail message="The Ant property 'deployment.policy.object' is required but not defined. This name of a deployment policy object to apply during the import." unless="deployment.policy.object"/>
<fail message="The Ant property 'deployment.policy.object.variables' is required but not defined. This name of a deployment policy object variables to apply during the import." unless="deployment.policy.object.variables"/>
<!-- <fail message="The Ant property 'deployment.policy.object.variables' is required but not defined. This name of a deployment policy object variables to apply during the import." unless="deployment.policy.object.variables"/> -->
<if>
<not>
<available file="${import.file}"/>
Expand All @@ -1026,7 +1026,7 @@
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<importConfigDPO host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}"
inputfile="${import.file}" dpo="${deployment.policy.object}" dpov="${deployment.policy.object.variables}" ignoreError="${ignore.error}"
inputfile="${import.file}" dpo="${deployment.policy.object}" ignoreError="${ignore.error}"
dcmdir="${dcm.dir}" workdir="${work.dir}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>

</sequential>
Expand Down
4 changes: 2 additions & 2 deletions src/com/ibm/dcm/Soma.java
Original file line number Diff line number Diff line change
Expand Up @@ -3118,8 +3118,8 @@ else if (params.get("local").toLowerCase().endsWith(".zip"))
body += " deployment-policy=\"\"";
if (params.get("deployment-policy-variables") != null)
body += " deployment-policy-variables=\"" + params.get("deployment-policy-variables") + "\"";
else
body += " deployment-policy-variables=\"\"";
// else
// body += " deployment-policy-variables=\"\"";
body += ">";
body += "<soma:input-file>" + Base64.base64FromBinaryFile(params.get("local")) + "</soma:input-file>";

Expand Down
4 changes: 2 additions & 2 deletions src/dcm-taskdefs.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@
<attribute name="inputfile"/> <!-- name of DataPower export file -->
<attribute name="ignoreError" default=""/> <!-- SOMA error to ignore - Note: Can't be empty -->
<attribute name="dpo"/> <!-- name of deployment policy object -->
<attribute name="dpov"/> <!-- name of deployment policy object variables -->
<!-- <attribute name="dpov"/> name of deployment policy object variables -->
<attribute name="dcmdir"/> <!-- directory where DCM is found -->
<attribute name="workdir"/> <!-- tmpdir where a directory can be created, if necessary -->
<attribute name="dumpinput" default="false"/>
Expand All @@ -1786,7 +1786,7 @@
<domain>@{domain}</domain>
<local>@{inputfile}</local>
<deployment-policy>@{dpo}</deployment-policy>
<deployment-policy-variables>@{dpov}</deployment-policy-variables>
<!-- <deployment-policy-variables>@{dpov}</deployment-policy-variables> -->
<hostname>@{host}</hostname>
<port>@{port}</port>
<uid>@{uid}</uid>
Expand Down
8 changes: 4 additions & 4 deletions src/main/zip/classes/com/urbancode/air/AirPluginTool.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class AirPluginTool {
// INSTANCE
//**************************************************************************

final public def isWindows = (System.getProperty('os.name') =~ /(?i)windows/).find()
public def isWindows = (System.getProperty('os.name') =~ /(?i)windows/).find()

def out = System.out;
def err = System.err;
Expand All @@ -43,8 +43,8 @@ public class AirPluginTool {

public Properties getStepProperties() {
def props = new Properties();
final def inputPropsFile = this.inPropsFile;
final def inputPropsStream = null;
def inputPropsFile = this.inPropsFile;
def inputPropsStream = null;
try {
inputPropsStream = new FileInputStream(inputPropsFile);
props.load(inputPropsStream);
Expand All @@ -63,7 +63,7 @@ public class AirPluginTool {
}

public void setOutputProperties() {
final OutputStream outputPropsStream = null;
OutputStream outputPropsStream = null;
try {
outputPropsStream = new FileOutputStream(this.outPropsFile);
outProps.store(outputPropsStream, "");
Expand Down
7 changes: 7 additions & 0 deletions src/main/zip/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,12 @@
<release-note plugin-version="24">
PR #109 - Steps fail with null pointer exception!
</release-note>
<release-note plugin-version="25">
Fixed groovy3 compatibility issue.
Property “Deployment policy object variable name” made optional as some users face issue due to this.
</release-note>
<release-note plugin-version="26">
Added "upload directory" step a a duplicate step to "upload files" to avoid confusion for a users.
</release-note>
</release-notes>
</pluginInfo>
83 changes: 80 additions & 3 deletions src/main/zip/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<header>
<identifier version="24" id="com.ibm.datapower" name="DataPower"/>
<identifier version="26" id="com.ibm.datapower" name="DataPower"/>
<description>The IBM WebSphere DataPower plugin deploys DataPower services.</description>
<tag>Infrastructure/WebSphere DataPower</tag>
</header>
Expand Down Expand Up @@ -1240,7 +1240,7 @@
<arg value="-Denvironment=@environment@"/>
<arg value="-Dimport.file=@fileImport@"/>
<arg value="-Ddeployment.policy.object=@deploymentPolicyObject@"/>
<arg value="-Ddeployment.policy.object.variables=@deploymentPolicyObjectVariables@"/>
<!-- <arg value="-Ddeployment.policy.object.variables=@deploymentPolicyObjectVariables@"/> -->
<arg value="import-dpo"/>
</command>
</step-type>
Expand Down Expand Up @@ -1825,7 +1825,84 @@
</command>
</step-type>


<step-type name="Upload Diectory">
<description>Upload directories</description>
<properties>
<property name="fromDir">
<property-ui type="textBox" default-value="" label="From directory" description="Source directory"/>
</property>
<property name="includes" required="true">
<property-ui type="textAreaBox"
label="Include Files"
default-value="**/*"
description="A list of patterns, separated by newline characters, that describe the files to upload. The
default, **/*, includes all files."/>
</property>
<property name="excludes">
<property-ui type="textAreaBox"
label="Exclude Files"
description="A list of patterns, separated by newline characters, that describe the files to skip. For
example, if you specify **/*.zip, all .zip files in all subdirectories are excluded."/>
</property>
<property name="domainName">
<property-ui type="textBox" default-value="${p:dpDomainName}" label="Domain name" description="Name of the target domain"/>
</property>
<property name="toDir">
<property-ui type="textBox" default-value="local:///" label="To directory" description="Target directory"/>
</property>
<property name="hostname">
<property-ui type="textBox" default-value="${p:dpHostname}" label="DataPower hostname/IP" description="Hostname or IP address of DataPower appliance" hidden="true"/>
</property>
<property name="uid">
<property-ui type="textBox" default-value="${p:dpUserid}" label="DataPower userid" description="Userid on DataPower appliance" hidden="true"/>
</property>
<property name="pwd">
<property-ui type="secureBox" default-value="${p:dpPassword}" label="DataPower password" description="Password for userid on DataPower appliance" hidden="true"/>
</property>
<property name="portXMI">
<property-ui type="textBox" default-value="${p:dpXMIPort}" label="DataPower XMI port" description="XML Management Interface port on DataPower appliance (usually 5550)" hidden="true"/>
</property>
<property name="environment">
<property-ui type="textBox" default-value="${p:environment.name}" label="Target Environment" description="Target environment (e.g. dev, sit, uat, prod)" hidden="true"/>
</property>
<property name="addlProperties">
<property-ui type="textBox" default-value="" label="Additional Properties" description="Additional property mappings - antpropname=...[ '~' more definitions ]" hidden="true"/>
</property>
<property name="memorySize">
<property-ui type="selectBox" default-value="default" label="Java Max Memory Size" description="Set the max Java Heap Memory size for the DCM's Ant call. " hidden="true"/>
<value label="Default">default</value>
<value label="-Xmx256m">-Xmx256m</value>
<value label="-Xmx512m">-Xmx512m</value>
<value label="-Xmx1024m">-Xmx1024m</value>
<value label="-Xmx2048m">-Xmx2048m</value>
<value label="-Xmx4096m">-Xmx4096m</value>
<value label="${p?:environment/memorySize}">${p?:environment/memorySize}</value>
<value label="${p?:resource/memorySize}">${p?:resource/memorySize}</value>
</property>
</properties>
<post-processing><![CDATA[
if (properties.get("exitCode") != 0) {
properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
}
else {
properties.put("Status", "Success");
}
]]></post-processing>
<command program="${GROOVY_HOME}/bin/groovy">
<arg value="-cp"/>
<arg file="classes"/>
<arg file="RunDeployDotAnt.groovy"/>
<arg file="${PLUGIN_INPUT_PROPS}"/>
<arg file="${PLUGIN_OUTPUT_PROPS}"/>
<arg value="-Ddomain=@domainName@"/>
<arg value="-Denvironment=@environment@"/>
<arg value="-Dupload-dir.from=@fromDir@"/>
<arg value="-Dincludes=@includes@"/>
<arg value="-Dexcludes=@excludes@"/>
<arg value="-Dupload-dir.to=@toDir@"/>
<arg value="upload-dir"/>
</command>
</step-type>

<step-type name="Upload from Definition">
<description>Create/overwrite files/directories based on a definition file</description>
Expand Down
4 changes: 4 additions & 0 deletions src/main/zip/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -593,5 +593,9 @@

<migrate to-version="24">
</migrate>
<migrate to-version="25">
</migrate>
<migrate to-version="26">
</migrate>

</plugin-upgrade>

0 comments on commit b850d0d

Please sign in to comment.