Problem in creating build using jenkins in running post build command

#1

Hi,

I recently developed a pipeline in XL Deploy. I setup to create and deploy in Dev env from jenkins and then using xldeploy pipelines I promote that build to higher env.

The setup is fairly simple, just need to deploy a maven jar to one server and run a .bat file to deploy the service there.

When I create/update the jenkins job, XL Deploy was able to perform both of the operations but when I am triggering it again it simply create a new jar but not running command.

Below is the setup:

Please let me know what to do to run all the steps in each run.

#2

Hello Abhishek,

As with most other types, cmd.Command does not deploy(execute) on an update deployment unless it has changed. You could try to add a timestamp or build ID variable to your command name.

The Advanced Command Plugin is an alternative that behaves differently in that regard. It has an alwaysRun option that allows you to run a command on all deployments.

Another alternative would be to create your own type using rules. Here is an example I made a while back.

  1. Add this type extension to /ext/synthetic.xml -
    <type type="script2.ScriptFileDeployed" extends="udm.BaseDeployedArtifact" deployable-type="script2.Scriptfile" container-type="overthere.Host" description="Artifact that can be deployed to an example server">
        <generate-deployable type="script2.Scriptfile" extends="udm.BaseDeployableFileArtifact"/>
        <property name="runCommandOrNot" kind="boolean" default="True"/>
    </type>
  1. Add this rule to /ext/rules.xml -
    <rule name="script2.ScriptFileDeployed.CREATE_MODIFY" scope="deployed">
        <conditions>
            <type>script2.ScriptFileDeployed</type>
            <operation>CREATE</operation>
            <operation>NOOP</operation>
            <operation>MODIFY</operation>
        </conditions>
        <steps>
            <os-script>
                <description expression="true">"Running Script" + str(deployed.runCommandOrNot)</description>
                <order>100</order>
                <script>script2/deploy-artifact</script>
            </os-script>
        </steps>
    </rule>
  1. Create xld_home/ext/script2/deploy-artifact.cmd.ftl and add this line to it -
${deployed.file.path}

Regards,
Adam

1 Like
#3

Thanks Adam! I worked.
Sorry for the late reply.