Frage

I am trying to set up CI with Cloudbees for a Spring Boot application. No problem setting up a Jenkins Maven job. The code is pulled from a github repository and Jenkins builds and deploys the application successfully.

But I am learning Gradle. When I create a Gradle Jenkins job, it builds the project successfully but it looks like the Jenkins CloudBees Deployer plugin cannot find war file.

I create the job as "Build a free-style software project" and invoke gradle script using the Gradle Wrapper. The project builds fine and I would like Jenkins to deploy it as well but the Deploy button doesn't show.

In the RUN@Cloud settings for the Jenkins job, the error message "There are no archived artifacts" is shown (see image). There are no archived artifacts

If I look in the workspace I can see the war file in /build/libs/myApp.war.

I can deploy the application directly using the Gradle CloudBees Plugin, as explained by Sean Gilligan in SpringBoot CloudBees Sample, but I'd rather have Jenkins to do that for me :).

P.S. Adding a post build action using the Ant match **/*.war deploys the application successfully after build. Which is good enough for me. So the problem is just with the "One-Click Deployment" functionality. Is it a bug?

P.S.2 Like Valentina suggested, adding a post build action to archive the artifact and building the application once, then "One-Click Deployment" button becomes available. However, deploy fails with the following error:

[cloudbees-deployer] Deploying via API server at https://api-eu.cloudbees.com/api
[cloudbees-deployer] 0 MB

[cloudbees-deployer] 1 MB
[cloudbees-deployer] 2 MB

[cloudbees-deployer] 3 MB
[cloudbees-deployer] 4 MB
[cloudbees-deployer] 5 MB
[cloudbees-deployer] 6 MB

[cloudbees-deployer] 7 MB
[cloudbees-deployer] 8 MB
[cloudbees-deployer] 9 MB
[cloudbees-deployer] 10 MB

[cloudbees-deployer] 11 MB
[cloudbees-deployer] 12 MB
[cloudbees-deployer] 13 MB
[cloudbees-deployer] 14 MB
[cloudbees-deployer] 15 MB
[cloudbees-deployer] 16 MB
[cloudbees-deployer] 17 MB

com.cloudbees.plugins.deployer.exceptions.DeployException: Server.InternalError - Deployment type not supported: war
    at com.cloudbees.plugins.deployer.engines.Engine.process(Engine.java:180)
    at com.cloudbees.plugins.deployer.engines.Engine.perform(Engine.java:112)
    at com.cloudbees.plugins.deployer.DeployNowRunAction$Deployer.perform(DeployNowRunAction.java:588)
    at com.cloudbees.plugins.deployer.DeployNowRunAction.run(DeployNowRunAction.java:500)
    at com.cloudbees.plugins.deployer.DeployNowTask$ExecutableImpl.run(DeployNowTask.java:158)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:246)
Caused by: hudson.util.IOException2: Server.InternalError - Deployment type not supported: war
    at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl$DeployFileCallable.invoke(RunEngineImpl.java:363)
    at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl$DeployFileCallable.invoke(RunEngineImpl.java:270)
    at com.cloudbees.plugins.deployer.engines.Engine$FingerprintingWrapper.invoke(Engine.java:252)
    at com.cloudbees.plugins.deployer.engines.Engine.process(Engine.java:174)
    ... 6 more
Caused by: com.cloudbees.api.BeesClientException: Server.InternalError - Deployment type not supported: war
    at com.cloudbees.api.BeesClient.readResponse(BeesClient.java:1794)
    at com.cloudbees.api.BeesClient.applicationDeployArchive(BeesClient.java:732)
    at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl$DeployFileCallable.invoke(RunEngineImpl.java:355)
    ... 9 more
Duration: 8.8 sec
Finished: FAILURE

After removing the post build archive action, is again deploying successfully just with the post build deploy action.

P.S.3 The problem was in my build.gradle (I should have posted it in first place):

cloudBees {
    apiKey = cloudbeesApiKey
    apiSecret = cloudbeesApiSecret
    appId = 'myAppId'
    archiveType = 'jar'
    archiveFile = war.archivePath
    deltaDeploy = true
    parameters = [containerType: "java", 'runtime.class': springBootWarLauncherClassName]
}

archiveType = 'jar' has to be archiveType = 'war' I thought that part of my build.gradle would not make any difference because I have commented the cloudbees plugin line:

apply plugin: 'war'
// apply plugin: 'cloudbees'

war {
    baseName = 'myApp'
    version =  '0.0.1-SNAPSHOT'
}
War es hilfreich?

Lösung

I have tried to reproduce your case.

First, a freestylejob, has to be configured with a post build action to archives the artifacts if you want to enable the "Deploy Now" button.

Before building your job, fork the project and change the package type to "war" in the build.gradle. You can refer to my own version here https://github.com/valentina1987/springboot-gradle-cloudbees-sample where I have changed the archiveType filed in the build.gradle from "jar" to "war".

Now it should work :)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top