Post

2 followers Follow
0
Avatar

Syntax for using set_of_ci in maven.

According to example on http://tech.xebialabs.com/deployit-maven-plugin/4.0.0/examples/generate-dar.html the syntax is:

<myCiRefs>
<ci ref="petclinic-backend"/>
<ci ref="mysql-backend"/>
</myCiRefs>

 

But this just gives an null-error. Is there another working example of syntax for using set_of_ci in maven?

Bjarte Nilsen

Please sign in to leave a comment.

9 comments

0
Avatar

Hi Bjarte,

In the example, you do still need to replace the element name myCiRefs with the specific property name that you want to include.

Can you elaborate a bit on what kind of Deployable you are creating? Are you using a type from an existing plugin, or did you create your own item type?

Kind regards,

Adriaan

 

Adriaan de Jonge 0 votes
0
Avatar

I am trying to make a reference to another ci that sets the unix file permisions.

  <type type="dnb.DeployedLinuxServiceApp" extends="generic.CopiedArtifact" deployable-type="dnb.LinuxServiceApp" >

      <generate-deployable type="dnb.LinuxServiceApp" extends="generic.Folder"/>

      <property name="targetDirectory" default="${deployed.container.targetDirectory}/${deployed.name}/" hidden="true"/>

      <property name="createTargetDirectory" kind="boolean" default="true" hidden="true"/>

      <property name="targetDirectoryShared" kind="boolean" default="false" hidden="true"/>

      <property name="restartRequired" kind="boolean" default="true" hidden="true"/>

      <property name="setExecutable" kind="set\_of\_ci" hidden="false" referenced-type="unix.Permission" as-containment="true"/>

   </type>   

 

But this error is in maven - so not affected by how my synthetics.xml looks like. (Maven doesn't know about anything in synthetics.xml)

 

I try this:

 

                        <deployable>

                            <name>${deployit-name}</name>

                            <type>dnb.LinuxServiceApp</type>

                            <location>./target/${build.filename}-${project.version}</location>

                            <setExecutable>

                                    <ci ref="myUnixpermissionCI1"/>

                                    <ci ref="myUnixpermissionCI2"/>

                            </setExecutable>

 

                        </deployable>

 

In your list example on same page:

<myList>
<value>val1</value>
<value>val2</value>
</myList>

We have to use it like this to make maven happy:

<sharedLibraryNames>

         <list>

             <value>library1</value>

             <value>library2</value>

             <value>library3</value>

        </list>

     </sharedLibraryNames>

Without the <list> tag maven complains with same error "null value for..."

So I just assumed it was the same with the set_of_ci, but couldn't figure out how to describe it in my pom.xml to make maven happy.

Bjarte Nilsen 0 votes
0
Avatar

No help here?  Not anyone with a working example of set_of_ci maven syntax? 

Bjarte Nilsen 0 votes
0
Avatar

Hi Bjarte,It turns out the maven plugin does not support the set type (and also no set_of_ci). I have logged improvement tickets for this omission and brought them to the attention of the product owner. I also logged a bug for the documentation errors.

At this point you'd have to switch to or the list type or the map type. Another workaround would be to build the DAR 'by hand' and using a handcrafted manifest file. (This will be painful to do in maven is my guess)

If you're not married to maven I have some code lying around to create/upload a DAR with gradle.

Cheers,

Ric

 

Ric Klaren 0 votes
0
Avatar

Hi Bjarte,

It seems like you're using legacy format for deployables.

Could you try with the new style format:

<deployables>

<cmd.Command name="install-tc-command">
<order>50</order>
<commandLine>/bin/sh ${install-tc.sh} ${tomcat.zip}</commandLine>
<undoCommand>uninstall-tc-command</undoCommand>
<dependencies>
<ci ref="install-tc" />
<ci ref="tomcat" />
</dependencies>
</cmd.Command>
<cmd.Command name="uninstall-tc-command">
<order>45</order>
<commandLine>/bin/sh ${uninstall-tc.sh}</commandLine>
<dependencies>
<ci ref="uninstall-tc" />
</dependencies>
</cmd.Command>
<file.File name="tomcat" file="tomcat.zip" location="tomcat.zip" />
<file.File name="install-tc" file="install-tc.sh" location="install-tc.sh"/>
<file.File name="uninstall-tc" file="uninstall-tc.sh" location="uninstall-tc.sh"/>

</deployables>

 

Kind regards,

Ivica

 

XebiaLabs Support 0 votes
0
Avatar

Thanks. I just tried this. And still have some questions.

First of all: Your example don't work because there is a mismatch between your commandline placeholder name ${install-tc.sh} + ${tomcat.zip} as the ci-names are without .sh and .zip.

Had this fixed, and it kind of worked, or something. I am having trouble understanding what this dependency is good for. If I map the "install-tc-command" to a target I would expect the dependecies to also automaticly map to same target. Both the two listet, and also the "uninstall-tc-command". This doesn't happen. I still need to map the deployables to same target as the "install-tc-command".

So this would be the same as not listing them under dependencies, or mentioning it in undoCommand.

 

Also the logic is upside down, as a initial deploy starts with executing the installscript, then after that, it copies the script to target. E.g tries to execute a script that isn't copied to target yet:

 

2014-10-21 14:14:16.736 [qtp939127-189] {username=admin} INFO  c.x.d.s.deployment.DeploymentService - Generated plan:

 * Deploying 4202-dnb-xldeploy-dnb-plugin-testapp 1.0.0-20141021-144703 on environment dnb_stest_01

   ------------------------------------------------------------------------------------------------

 1. ( 45) - Execute uninstall-tc-command  (StepWithDelta)

            *checkpoint*  CREATE Infrastructure/stest/kakeritsu-wasadmin/uninstall-tc-command

 2. ( 50) - Execute install-tc-command  (StepWithDelta)

            *checkpoint*  CREATE Infrastructure/stest/kakeritsu-wasadmin/install-tc-command

 3. ( 60) - Copy install-tc to Infrastructure/stest/kakeritsu-wasadmin  (StepWithDelta)

            *checkpoint*  CREATE Infrastructure/stest/kakeritsu-wasadmin/install-tc

 4. ( 60) - Copy tomcat to Infrastructure/stest/kakeritsu-wasadmin  (StepWithDelta)

            *checkpoint*  CREATE Infrastructure/stest/kakeritsu-wasadmin/tomcat

 5. ( 60) - Copy uninstall-tc to Infrastructure/stest/kakeritsu-wasadmin  (StepWithDelta)

            *checkpoint*  CREATE Infrastructure/stest/kakeritsu-wasadmin/uninstall-tc

 

 

 

So I am having trouble understanding what this dependency logic really adds to the deploy process. Or was supposed to do, but doesn't happen in our system.

 

Also your examples on http://docs.xebialabs.com/releases/4.5/xl-deploy/commandPluginManual.html is using different notations for referencing to a ci:

 

First example uses:

        <dependencies>

            <ci ref="install-tc.sh" />

            <ci ref="tomcat.zip" />

        </dependencies>

The two next ones under "Sample Usage Senario - Provision a Tomcat server" on same page uses:

    <dependencies>

        <value>install-tc.sh</value>

        <value>tomcat.zip</value>

    </dependencies>

 

Bjarte Nilsen 0 votes
0
Avatar

Btw: just for the record: New style format works in our maven and dependecies listen in pom are listed under dependencies in XLDeploy when deploying the artifact. (my initial problem when starting this thread)

Bjarte Nilsen 0 votes
0
Avatar

Hi Bjarte,

I'm glad you solved the issue and thank you for pointing out to the errors in the docs.

I've created an issue  for the command plugin documentation discrepancies.

Just for the sake of other users: for all of the questions related to the packaging syntax please refer to the Packaging manual (http://docs.xebialabs.com/releases/4.5/xl-deploy/packagingmanual.html#properties-referring-to-other-cis).

To answer your questions:

  • the sample I provided is not self contained and does not work (for example targetPath property is missing), I have copy pasted it after fiddling with the file.File names (which you noticed) just as a syntax hint - I'm sorry for not communicating it clearly

  • the files are dependencies of the install/uninstall commands and will be uploaded to the host before those scripts are executed

  • the file artifacts will also be uploaded to the target path, but as you noticed - that would happen only after the script would be executed (which is not problem if you don't mind seeing it uploaded twice). This is related to your observation that you also had to map dependencies, that's because cmd.Command needs a reference to the file.File and file.File is deployed to the host - we have filled enhancement for this (mis-)behaviour under ( DEPL-2784).

 

We're working on improving quality of the docs and we really appreciate your help and input.

 

 

Kind regards,

Ivica

 

XebiaLabs Support 0 votes