gradle-cargo-plugin icon indicating copy to clipboard operation
gradle-cargo-plugin copied to clipboard

Glassfish/Payara : deployment order

Open morayKevin opened this issue 1 year ago • 5 comments

Hi,

We use Jenkins to do deferred deployment of our applications on our production servers.

For this we use Gradle with the Cargo plugin (2.8.0)

It works very well but the deployment order is then reset to 100. This is highly problematic for some applications where this value is important.

my cargo task is

task deployOnGlassfish(type: CargoDeployRemote, dependsOn: validateBranch) {
  description = "Deploys WAR to Glassfish ."  // description of task
  containerId = 'glassfish5x'
  timeout = Duration.ofMinutes(2)
  hostname = "$fedris_test"
  protocol = 'https'
  port = 4848
  username = userLogin // username of tomcat
  password = userPassword  // password of the tomcat

  deployables = [
      new Deployable(files: files("""${rootProject.projectDir}\\build/libs/${applicationName}.war"""), context: """${glassfishApplicationName}""")
  ]
}

after contacting Payara support :

We reviewed the situation with the Cargo plugin, and the problem is that the Gradle version (the one you were using during the discussion on this ticket) is not supported by Codehaus directly, a third party developing the plugin independently. With the Maven version of the plugin we managed to get the deployment order working properly, but sadly we cannot do anything about the Gradle version. You will probably have to raise an issue on their Github page if you require the bug to be fixed.

So is it possible to do something about this?

THANKS

morayKevin avatar Apr 26 '23 06:04 morayKevin

I doubt that the Payara meant to say "Gradle version". Gradle itself does not know anything about interacting with a Cargo. They likely meant the Cargo library version. Try to set the latest Cargo library version, as described here.

bmuschko avatar Apr 26 '23 12:04 bmuschko

Using the instructions in the documentation of the plugin, I was not able to find a way to specify the deployment order and make it persist. Meanwhile, the Maven plugin for Cargo (Codehaus Cargo - Maven 3 Plugin) offers a way to specify a deployment order using the element in cargo.xml, by using the order attribute,

morayKevin avatar Apr 28 '23 12:04 morayKevin

Can you give me a concrete example on how this achieved in the Maven plugin (optimally in XML)? I don't see anything about in the link you sent me.

bmuschko avatar Apr 28 '23 13:04 bmuschko

Here is an example configuration on how to configure the deployment order using the Maven plugin:

<plugin> 
    <groupId>org.codehaus.cargo</groupId> 
    <artifactId>cargo-maven3-plugin</artifactId> 
    <version>1.10.6</version> 
    <configuration> 
      <container> 
        <containerId>payara</containerId> 
        <artifactInstaller> 
          <groupId>fish.payara.distributions</groupId> 
          <artifactId>payara</artifactId> 
          <version>5.2022.5</version> 
        </artifactInstaller> 
      </container> 
    <configuration> 
      <deployables> 
        <deployable> 
          <grroupId>${project.groupId}</groupId> 
          <artifactId>${project.artifactId}</artifactId> 
          <type>war</type> 
          <order>1</order> 
        </deployable> 
        <deployable> 
          <groupId>${project.groupId}</groupId> 
          <artifactId>MavenCargoTest2</artifactId> 
          <type>war</type> 
          <order>2</order> 
        </deployable> 
      </deployables> 
      <home>C:\payara-server\_WORKDIR\5.48.1\payara5\glassfish\domains\</home> 
      <properties> 
        <cargo.hostname>localhost</cargo.hostname> 
        <cargo.servlet.port>8080</cargo.servlet.port> 
        <cargo.glassfish.admin.port>4848</cargo.glassfish.admin.port> 
        <cargo.remote.username>admin</cargo.remote.username> 
        <cargo.remote.password>adminadmin</cargo.remote.password> 
        <cargo.glassfish.deploy.arg.remoteUpload>--upload=true</cargo.glassfish.deploy.arg.remoteUpload> 
      </properties> 
    </configuration> 
  </configuration>
   
  <!-- provides JSR88 client API to deploy on Payara --> 
  <dependencies> 
    <dependency> 
      <groupId>org.glassfish.main.deployment</groupId> 
      <artifactId>deployment-client</artifactId> 
      <version>5.0</version> 
    </dependency> 
  </dependencies> 
</plugin>

I hope this helps!

morayKevin avatar May 02 '23 20:05 morayKevin

Thanks. The plugin uses the Cargo Ant tasks. I don't see anything in their documentation that would let you define a deployment order. You may want to ask on their mailing list.

Alternatively, you could probably set up individual CargoDeployRemote tasks, each of which deploys a single file. To produce the desired order, chain those task together with dependsOn.

bmuschko avatar May 02 '23 22:05 bmuschko