1

I'm working with Jenkins that runs on a server. I have a pipeline which is triggered by a user that pushes something on a GitHub repository. It performs a script which makes sure the GitHub repository is deployed to the SAP Cloud Platform.

It uses the MTA Archive Builder for building the MTA application which creates a .mtar file. The MTA application has a HTML5 module. After building the .mtar file with the MTA Archive Builder, I deploy it using the NEO Java Web SDK (the library you need to perform neo deploy-mta). "neo deploy-mta" is a command that performs the actual request for deploying your html5 application. This works fine and the project is successfully deployed on the SAP Cloud Platform. The problem is: if a user rapidly pushes 2 times on GitHub, my Jenkins pipeline is triggered twice and performs "neo deploy-mta" 2 times.

In a normal case the SAP Cloud platform should deploy 2 versions, but when I look it only deployed the first deployment request. So it skipped the second request for deployment.

My question is how can I make sure there are 2 versions deployed on the SAP Cloud Platform when 2 pushes happened?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
BillGiot
  • 39
  • 1
  • 7

2 Answers2

1

The Jenkins instance is already waiting until there is no build running. The problem was that the SAP Cloud Platform didn't deploy 2 versions when there were 2 requests for deployment.

The solution for this problem is to add the "--synchronous" parameter to the "neo deploy-mta" command. Now this script will wait until there is no deployment (for this application) running on the SAP Cloud Platform.

BillGiot
  • 39
  • 1
  • 7
0

Most likely it happens because the SAP MTA deployer detects that you have another deploy in progress and thus stops the second deployment.

One version to go about it is to ensure from Jenkins that you don't run the second build until the first one has finished. You can do this with the help of a lock / semaphore like mechanism. There are several ways to do this via Jenkins plugins:

Also look at How can I prevent two Jenkins projects/builds from running concurrently?.

Serban Petrescu
  • 5,127
  • 2
  • 17
  • 34
  • Thanks for the answer, although I found that it was another problem. I'll explain it in the answer. – BillGiot Apr 03 '18 at 07:50