Skip to Content
Technical Articles

Sync CPI Content for Git and Backups with CPISync (Open-Source)

If you want to track your packages in Git or have regular backups, CPISync provides the easiest, structured & automated way to achieve your goal. It comes under 10 MB and without any dependencies.

Update 2021-02-06: v0.2.0 here with changed config rules, new features, and bug fixes. You can check the changelog here.

 

CPI%20Sync%20-%20It%20is%20raining%20packages%21

CPI Sync – It is raining packages and artifacts!

Quick Setup & Start

  1. Download the latest release for Windows or Linux:

https://github.com/pizug/cpi-sync/releases/latest

  1. Create an empty folder & put cpisync.exe inside:

  1. Copy example configuration JSON and create “cpi-sync.json” file. Change the fields accordingly, and don’t worry about making mistakes! CPI Sync will validate the config file and give helpful error messages.
{
  "cpisync": "0.2.0",

  "tenant": {
    "management_host": "change-tmn.hci.eu1change.hana.ondemand.com",
    "credential": {
      "s_user": {
        "username": "S000change",
        "password_environment_variable": "CPI_PASSWORD"
      }
    }
  },
  "packages": {
    "filter_rules": [
      { "type": "single", "id": "TrainingPackage" },
      { "type": "single", "id": "eDocumentElectronicInvoicingforYou" },
      { "type": "single", "id": "MYPACKAGE" }
    ]
  }
}
  1. Now you can run double-click on “cpisync.exe”

  1. It will ask for your S-user password interactively. Then, if everything is correct it will download the artifacts in packages you have specified.

Since this was the quick start, we went with S-user. For regular usage, I recommend setting up an OAuth client for your CPI management node(“tmn”).

If you need to run it via jobs, run it for CI/CD or want more configuration, you can find further instructions & documentation on GitHub:

https://github.com/pizug/cpi-sync

If you similar have use cases and ideas, you can contact me or create an issue on the repository!

Thanks for reading!

9 Comments
You must be Logged on to comment or reply to a post.
  • Hi Fatih,
    I tried the tool, but I got this error:
    reqwest::Error { kind: Decode, source: Error("missing field `d`", line: 1, column: 101) }
    The json config I am using is:

    {
    "cpisync": "0.1.0",

    "tenant": {
    "management_host": "****.hana.ondemand.com",
    "credential": {
    "s_user": {
    "username": "S00******"
    }
    }
    },
    "packages": [
    {
    "id": "AI_ModelCompany"
    }
    ]
    }

    • Hi Giovanni,

      From the configuration point of view, everything seems correct, and the API check is successful. You can also delete the hostname from the comment.

      Maybe cpisync should show the response body when an error happens...

      Are you sure the package with that ID exists? You should use the Technical Name of the package, click on edit and it will show up there.

      You can also create a GitHub issue or contact me directly.

      Regards,
      Fatih

  • Hello Fatih Pense ,

    Thank you for the helpful blog!! I face a similar issue. Could you please give me a hint on what goes wrong?

    Config:

    {
      "cpisync": "0.1.0",
      "tenant": {
        "management_host": "*******.hci.eu2.hana.ondemand.com",
        "credential": {
          "s_user": {
            "username": "P*********"
          }
        }
      },
      "packages": [
        { "id": "ExternalLandingPageDataInteg**************************" }
      ]
    }
    Response:

     

    Start CPI Sync?
    Press any key to continue...
    Would you like to enter a password for user: P********* to connect host: ********.hci.eu2.hana.ondemand.com?
    Password:
    Processing Package: Package { id: "ExternalLandingPageDataInteg******************", local_dir: None }
    reqwest::Error { kind: Decode, source: Error("missing field `d`", line: 1, column: 67) }
    Press any key to continue...

    • Hello Sokratis,

      Glad it is helpful!

      This error means, these steps are correct:

      1. Configuration can be parsed correctly
      2. Credentials are correct and the tool can access the API

      Then, it can't find the package ID.

      Maybe you have entered Flow ID?

      We can also discuss in detail one-to-one.

      Best regards,
      Fatih Pense

       

  • Hello Fatih Pense ,

    Thanks as always for bringing out such utilities which makes our life easier.

    One question...When I try to use this it works fine but only copy first 15 iflows from the package though my package has 70+ iflows. Do you know if this is by design that only first 15 iflows are fetched or some timeout caused this issue?

    Thanks

    Saurabh

    • Hello Saurabh,

      Thanks for the feedback 🙂

      There is no limitation but there may be bugs I intend to fix this weekend 😉 Does your 16th iflow has a long ID by any chance? Also, is there an error on the command line? You can share it, masking private data.

      I also intend to change the config structure with each version. If you have a use-case that you want better support, you can always give feedback about your dream cpi sync tool.

      I plan to add:

      • filtering package with regex,
      • a  way to exclude packages,
      • inform the user if a package name is used instead of the package id
      • maybe an option to disable zip extraction if you just want backup (not using Git)
      • maybe a field to set target local directory for all packages

      There is also another bug: the tool should skip configure-only packages, but it is not related to your case.

      Best regards,
      Fatih

      • Hello Fatih,

        I dint check the error earlier because as soon as the tool hits an error it automatically closes the application window. Hence this time instead of running cpisync.exe directly, I call it via cmd and hence I was able to see the error as follow for my 16th iflow:

        thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 123, kind: Other, message: "The filename, directory name, or volume label syntax is incorrect." }', src\main.rs:304:66
        note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

        I just paste the snapshot here from the error that I get in CMD:

        /