Examples of zpm files?

Infos:

  • Used Zammad version: 3.1
  • Used Zammad installation source: source
  • Operating system: Mac OS X
  • Browser + version: Chrome 75.0.3770.142

I wonder if there are any examples of zpm files somewhere on the web?

I started digging around in the model “Package” (more specifically the method “install”) in order to understand
what the page “Packages” in the GUI actually expects.

Its basically a json
file, with keys “name”,“version”,“vendor” and “files”? So with this I can
basically break everything. Are there any assumptions about these
files, good practice?

Thanks in advance

As far as I’m aware we currently have no examples for that (and no useful documentation for public).

Maybe @thorsteneckel has an example in his back hand.

Hi @njfranck - I just put some lines together to give you an impression on how a szpm file looks like. There is no magic involved:

{
  "name": "Addon",
  "version": "1.0.0",
  "vendor": "Zammad GmbH",
  "license": "GNU AGPL v2",
  "url": "http://zammad.org/",
  "change_log": [
    {
      "version": "1.0.0",
      "date": "2019-08-05 13:37:42 UTC",
      "log": "Initial version."
    }
  ],
  "description": [
    {
      "language": "en",
      "text": "Adding custom functionality XY."
    }
  ],
  "files": [
    {
      "location": "app/model/custom.rb",
      "permission": 644
    }
  ]
}

To get a installable zpm file from this you have to encode the files content via base64 and add it to the corresponding record and add the "encode": "base64", attribute, too. Additionally the buildhost and builddate attributes should get set. The final zpm file would look like this:

{
  "name": "Addon",
  "version": "1.0.0",
  "vendor": "Zammad GmbH",
  "license": "GNU AGPL v2",
  "url": "http://zammad.org/",
  "buildhost": "build.zammad.com",
  "builddate": "2019-08-05 13:37:42 UTC",
  "change_log": [
    {
      "version": "1.0.0",
      "date": "2019-08-05 13:37:23 UTC",
      "log": "Initial version."
    }
  ],
  "description": [
    {
      "language": "en",
      "text": "Adding custom functionality XY."
    }
  ],
  "files": [
    {
      "location": "app/model/custom.rb",
      "permission": 644,
      "encode": "base64",
      "content": "cHV0cyAiSGVsbG8gdGhlcmUgOikgRHJvcCB1cyBhIG1haWwgYXQgam9ic0B6YW1tYWQuY29tIC0gd2UnZCBsaWtlIHRvIHRhbGsgdG8geW91IPCfpbAi"
    }
  ]
}

There is an undocumented gem which does some szpm/zpm handling. We’re using it in our build system.

However, we won’t put much more effort in the szpm/zpm eco system because we will replace the whole packaging mechanism in the future. However, since we have quite a few customer and internal packages we will provide a straight forward migration mechanism / documentation when the time comes. So your work wont be lost if you decide to create a zpm file.

Let me know if I can help you any further.

PS: What are you building? :slight_smile:

Thanks for your reply.

As I thought, it just puts files in the project directory.

For the moment I’m not building anything, but I was wondering
on how zammad could be extended or flavoured. So a bunch
of initializers that reopen models would redefine the existing models.

Absolutely. You can also overwrite any file which comes with the downside of not receiving any updates for this certain file. However, our design goal is to make everything in the frontend and backend overwrite- and customizable.