Releasing Server & Data Center apps using Marketplace REST API

Hi,

Does anybody automated releases of Server & Data Center apps using Marketplace REST API?

Currently, we release apps using web interface, and we supply the same artifact for both server & data center versions.

Via the web interface, we upload an artifact, and it creates two app versions with the same version name but different build numbers.

We can’t achieve the same using Marketplace REST API. API doesn’t allow us to create two app versions with the same name and different build numbers (POST /rest/2/addons/{addonKey}/versions).

We tried to create a single app version that is compatible with both deployment types and achieved the following:

We provided the following value ‘compatibilities’ request property in this case

[{
  "application": "jira",
  "hosting": {
    "server": {
      "min": {
        "build": 117
      },
      "max": {
        "build": 117
      }
    },
  }
},
{
  "application": "jira",
  "hosting": {
    "dataCenter": {
      "min": {
        "build": 117
      },
      "max": {
        "build": 117
      }
    }
  }
}]

Is it a valid state?

2 Likes

I second to that question. What is the proper way to release Server and DC by REST API?

We’re currently looking into this as well and was about to ask this very question. It’s a bit concerning that it never got a reply. Any Atlassian that can shed some light on how to achieve the same thing as the web interface (or point us in the right direction)?

When submitting the new Server version to the marketplace, you need to add a header to the request, and a DC version will also be auto-generated:

An excerpt from our deployment automation:

headers = {'X-Mpac-DataCenter-BuildNumber': str(serverBuildNumber + 10)}
6 Likes

We use this same strategy for some of our apps (thanks to @George-Soteri)

Hi @George-Soteri ,

How to get the serverBuildNumber in order to pass it to the header?

The build number can be of your choosing. E.g. you can take the build number of the previous release and add 100. Another strategy is to compute it off your version number – e.g. (major * 1000000 + minor * 1000 + patch)

It works for us. Thank you very much for the suggestion!