Building a TIBCO Flogo® App Executable from an Existing App with the API

Using the API you can build an app executable for an existing app. The executable can then be deployed and run outside the TIBCO Cloud™. After building the executable, use the GET ​/v1​/subscriptions​/{subscriptionLocator}​/apps​/{appId}​/flogo​/build method to download it.

Note: A best practice is to validate the source app in the User Interface before building the executable.

Considerations

To build an app executable you need the following: 

  1. Use the POST ​/v1​/subscriptions​/{subscriptionLocator}​/apps​/{appId}​/flogo​/build method to build an app executable.
  2. Include the os query parameter to select an operating system build option that is compatible with your operating system. Default is linux. Options include linux, darwin, or windows.
  3. Include the arch query parameter to select a system architecture that is compatible with your system. Options include amd64 or 386. Default is amd64.
    Note: Refer to https://golang.org/doc/install/source#environment for additional supported os and arch options.
  4. As the executable builds messages are updated in the response body. When the process is complete, a success message or error message is sent in the response.
Note: Executables are removed from the TIBCO Cloud™ when they are downloaded or after 24 hours.

Sample Script

The following script shows how to build, download, run, and cleanup your executable.

Copy
#!/bin/bash

#CIC Token
CIC_TOKEN="<your OAuth token>"
#Flogo App Id
appId="pbqkrdkwhac56ptzwmrpm4wl2wi376w3"

OS=darwin
Arch=amd64
Compress=true

# This example assumes you are in the AWS US region
BuildBinary() {

  code=$(curl -X POST "https://api.cloud.tibco.com/tci/v1/subscriptions/0/apps/${appId}/flogo/build?os=${OS}&arch=${Arch}" -w "%{http_code}" -H  "accept: application/json" -H  "Authorization: Bearer ${CIC_TOKEN}" -o output.json)
  echo "Status code: ${code}"
  if [[ "$code" != "200" ]]; then
    echo "Build Binary failed, due to: "
    cat output.json
    exit 1
  fi

  Status=$(jq -r ".[-1].status" output.json)
  if [[ "$Status" == "error" ]]; then
    echo "Build binary for appId: ${appId} error"
    jq -r ".[-1].details" output.json
    exit 1
  else
    echo "Build binary for AppId succesfully"
  fi
}

DownloadBinary() {
    curl -X GET "https://api.cloud.tibco.com/tci/v1/subscriptions/0/apps/${appId}/flogo/build?os=${OS}&arch=${Arch}&compress=${Compress}" -H  "accept: application/octet-stream" -H  "Authorization: Bearer ${CIC_TOKEN}" -o binaryApp
}

RunBinary() {
  chmod u+x binaryApp
  ./binaryApp
}

cleanup() {
  rm -rf binaryApp output.json
}


cleanup
BuildBinary
DownloadBinary
RunBinary

Role Requirements

Related Topics

Managing Apps with the TIBCO Cloud™ Integration API

Downloading a TIBCO Flogo® App Executable Using the App ID with the API