jenkinsdeploymentsapui5sap-cloud-platform

SCP neo deploy-mta can't deploy 2 versions in a row


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?


Solution

  • 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.