/mgmt/shared/iapp/build-package

API for packaging iControl LX/iApps LX files into an RPM so that it can be exported.


RPM build task object read only attributes

The tables below show most relevate read only attributes. For a list of writable attributes, see section Action: Build RPM packages from directory.

RPM Task Attributes
Attribute Type Description
step String Current sub-state of the task, see table below for details.
buildCommand String The buildprm command as passed to the shell.
force Boolean If true, then rebuild and overwrite rpm, even if it already exists. If false, then use existing rpm if it exists and complete this task immediately.
isSpecFileToCleanUp Boolean Flag to let the rpm build command know whether or not there is a spec file that requires clean-up.
builtRpmPackageFilePath String Path to RPM file built by this task.
status String Possible status states: CREATED, STARTED, CANCEL_REQUESTED, CANCELED, FAILED, FINISHED
ownerMachineId String (UUID) In a high-availability environment, the machineId of the host running the task.
userReference A link to the user who initiated the task.  
identityReferences RO A list of the authenticated identities used to initiate the task.

RPM Task Build step Attribute Enumeration
Value Description
INITIAL Newly created task that has not yet started processing.
GET_LATEST_BLOCK_STATES_AND_PERSIST_TO_DISK Query BCW to get latest template blocks, because the templates on disk may be stale. Persist the states with name and guid in filename.
GET_INSTALLED_PACKAGE_VERSION If re-building an installed package, then get the package metadata.
GENERATE_SPEC_FILE Generate a spec file if necessary.
GET_MANIFEST_STATE_AND_PERSIST_TO_DISK Recreate manifest.json from installedPackages worker and persist to disk.
RUN_BUILD_RPM_TASK Start the RPM build and wait for it to complete.
RPM_BUILD_COMPLETED rpmbuild command has exited.
CLEAN Always clean up file artifacts after completing build.
COPY_RPM Move the built RPM file to the default iApp RPM repository /var/config/rest/iapps/RPMS
COMPLETE_TASK Task completed successfully. Task is in a final state.

Action: Get list of all RPM build tasks

Returns a list of all build tasks in an array in the items attribute.

URI Path HTTP Method
/mgmt/shared/iapp/build-package GET

Success Response

HTTP/1.1 200 OK
{
  "items": [
    {
      "step": "COMPLETE_TASK",
      "packageDirectory": "/var/config/rest/iapps/MyWorker",
      "appName": "NotMyWorker",
      "specFilePath": "/var/config/rest/node/tmp/c983d7aa-76e7-4b1e-adc7-a207de034a5b.spec",
      "buildCommand": "rpmbuild -bb --define '_tmppath /shared/tmp' --define 'main /var/config/rest/iapps/MyWorker' --define '_topdir /var/config/rest/node/tmp' '/var/config/rest/node/tmp/c983d7aa-76e7-4b1e-adc7-a207de034a5b.spec'",
      "packageVersion": "0.2.0",
      "packageRelease": "003",
      "force": true,
      "rpmDescription": "My wonderful new app",
      "rpmSummary": "It's awesome",
      "isSpecFileToCleanUp": true,
      "builtRpmPackageFilePath": "/var/config/rest/iapps/RPMS/NotMyWorker-0.2.0-003.noarch.rpm",
      "id": "759fb3f3-4372-4134-b916-6f8180e1edf0",
      "status": "FINISHED",
      "startTime": "2018-01-29T21:26:33.760-0800",
      "endTime": "2018-01-29T21:26:34.511-0800",
      "userReference": {
        "link": "https://localhost/mgmt/shared/authz/users/admin"
      },
      "identityReferences": [
        {
          "link": "https://localhost/mgmt/shared/authz/users/admin"
        }
      ],
      "ownerMachineId": "44e002f8-c5e9-49b5-aed4-67a4e79c1b6b",
      "generation": 10,
      "lastUpdateMicros": 1517289994511667,
      "kind": "shared:iapp:build-package:buildrpmtaskstate",
      "selfLink": "https://localhost/mgmt/shared/iapp/build-package/759fb3f3-4372-4134-b916-6f8180e1edf0"
    },
    {
      "step": "GET_INSTALLED_PACKAGE_VERSION",
      "packageDirectory": "/var/config/rest/iapps/MyWorker",
      "appName": "MyWorker",
      "force": true,
      "rpmDescription": "My wonderful new app",
      "rpmSummary": "It's awesome",
      "id": "a58ccb50-6ec0-4323-9bc2-facecf3ac032",
      "status": "FAILED",
      "startTime": "2018-01-29T21:30:47.635-0800",
      "endTime": "2018-01-29T21:30:47.678-0800",
      "errorMessage": "Package not installed. You must specify packageVersion to build MyWorker",
      "userReference": {
        "link": "https://localhost/mgmt/shared/authz/users/admin"
      },
      "identityReferences": [
        {
          "link": "https://localhost/mgmt/shared/authz/users/admin"
        }
      ],
      "ownerMachineId": "44e002f8-c5e9-49b5-aed4-67a4e79c1b6b",
      "generation": 4,
      "lastUpdateMicros": 1517290247679352,
      "kind": "shared:iapp:build-package:buildrpmtaskstate",
      "selfLink": "https://localhost/mgmt/shared/iapp/build-package/a58ccb50-6ec0-4323-9bc2-facecf3ac032"
    }
  ],
  "generation": 155,
  "kind": "shared:iapp:build-package:buildrpmcollectionstate",
  "lastUpdateMicros": 1517290247686602,
  "selfLink": "https://localhost/mgmt/shared/iapp/build-package"
}

Error Response

HTTP/1.1 401 Unauthorized

Example Call

curl -sk -u 'admin:admin' https://<BIG-IP>/mgmt/shared/iapp/build-package

Action: Get info of single RPM build task

Returns the attributes for a single RPM build task using the tasks id attribute appened to the base URL.

URI Path HTTP Method
/mgmt/shared/iapp/build-package/<task_UUID> GET

Success Response

HTTP/1.1 200 OK
{
  "step": "COMPLETE_TASK",
  "packageDirectory": "/var/config/rest/iapps/MyWorker",
  "appName": "NotMyWorker",
  "specFilePath": "/var/config/rest/node/tmp/c983d7aa-76e7-4b1e-adc7-a207de034a5b.spec",
  "buildCommand": "rpmbuild -bb --define '_tmppath /shared/tmp' --define 'main /var/config/rest/iapps/MyWorker' --define '_topdir /var/config/rest/node/tmp' '/var/config/rest/node/tmp/c983d7aa-76e7-4b1e-adc7-a207de034a5b.spec'",
  "packageVersion": "0.2.0",
  "packageRelease": "003",
  "force": true,
  "rpmDescription": "My wonderful new app",
  "rpmSummary": "It's awesome",
  "isSpecFileToCleanUp": true,
  "builtRpmPackageFilePath": "/var/config/rest/iapps/RPMS/NotMyWorker-0.2.0-003.noarch.rpm",
  "id": "759fb3f3-4372-4134-b916-6f8180e1edf0",
  "status": "FINISHED",
  "startTime": "2018-01-29T21:26:33.760-0800",
  "endTime": "2018-01-29T21:26:34.511-0800",
  "userReference": {
    "link": "https://localhost/mgmt/shared/authz/users/admin"
  },
  "identityReferences": [
    {
      "link": "https://localhost/mgmt/shared/authz/users/admin"
    }
  ],
  "ownerMachineId": "44e002f8-c5e9-49b5-aed4-67a4e79c1b6b",
  "generation": 10,
  "lastUpdateMicros": 1517289994511667,
  "kind": "shared:iapp:build-package:buildrpmtaskstate",
  "selfLink": "https://localhost/mgmt/shared/iapp/build-package/759fb3f3-4372-4134-b916-6f8180e1edf0"
}

Error Response

Unauthorized

HTTP/1.1 401 Unauthorized

Task GUID does not exist

HTTP/1.1 404 Not Found
{
  "code": 404,
  "message": "shared/iapp/build-package/123fb3f3-4372-4134-abcd-6f8180e1edf1",
  "referer": "192.168.1.1",
  "restOperationId": 14151167,
  "kind": ":resterrorresponse"
}

Example Call

curl -sk -u 'admin:admin' https://<BIG-IP>/mgmt/shared/iapp/build-package/759fb3f3-4372-4134-b916-6f8180e1edf0

Action: Build RPM packages from directory

It will generate a spec file if one is not provided. If a spec file is provided it will use that file to build the RPM.

Note

This action is asynchronous. Once you call this action you must then use the id UUID attribute to call the API to check the status. See section Action: Get info of single RPM build task for more details.

URI Path HTTP Method
/mgmt/shared/iapp/build-package POST

Data Parameters

Attribute Name Required Type Description
packageDirectory N String Directory name to build package from (e.g. /var/config/rest/iapps/MyWorker).
appName Y String Name of iApp package, or if packageDirectory is not provide then directory name relative to /var/config/rest/iapps/ (e.g. MyWorker).
specFilePath N String Path to RPM spec file. If this is not provided, this worker will generate a spec file to use in the RPM build based on the appName.
rpmDescription N String Default is: Default exported iApp description.
rpmSummary N String Default is: Default exported iApp summary.
packageVersion Y String The version number for this package, typically following the SemVer spec (e.g. 0.1.0)
packageRelease Y String The release number for the package (e.g. 0001)

Example:

{
   "packageDirectory": "/var/config/rest/iapps/MyWorker",
   "appName": "NotMyWorker",
   "rpmDescription": "My wonderful new app",
   "rpmSummary": "It's awesome",
   "packageVersion": "0.1.0",
   "packageRelease": "0001"
}

Success Response

HTTP/1.1 200 OK
{
  "step": "GET_LATEST_BLOCK_STATES_AND_PERSIST_TO_DISK",
  "packageDirectory": "/var/config/rest/iapps/MyWorker",
  "appName": "NotMyWorker",
  "packageVersion": "0.1.0",
  "packageRelease": "0001",
  "force": true,
  "rpmDescription": "My wonderful new app",
  "rpmSummary": "It's awesome",
  "isSpecFileToCleanUp": true,
  "id": "93c7ad8b-28e7-4cd9-a7d6-91d5b3b95116",
  "status": "CREATED",
  "userReference": {
    "link": "https://localhost/mgmt/shared/authz/users/admin"
  },
  "identityReferences": [
    {
      "link": "https://localhost/mgmt/shared/authz/users/admin"
    }
  ],
  "ownerMachineId": "44e002f8-c5e9-49b5-aed4-67a4e79c1b6b",
  "generation": 1,
  "lastUpdateMicros": 1517287030294542,
  "kind": "shared:iapp:build-package:buildrpmtaskstate",
  "selfLink": "https://localhost/mgmt/shared/iapp/build-package/93c7ad8b-28e7-4cd9-a7d6-91d5b3b95116"
}

Error Response

HTTP/1.1 401 Unauthorized

Example Call

curl -sk -H 'Content-Type: application/json' -u 'admin:admin' \
 https://<BIG-IP>/mgmt/shared/iapp/build-package -d @rpm.json