This document describes how to upload a Plugin from Hub to Cloud Data Fusion without the need of downloading the plugin.
Before you begin
The steps outlined in this document require the use of jq command line library to parse a JSON file.
To install on Mac, you can use HomeBrew
brew install jq
1. Obtaining plugin information from Hub
List available packages in the Hub:
https://hub.cdap.io/v2/packages.json
Once you have identified the plugin package you want, you can get the detail by going to:
https://hub.cdap.io/v2/packages/<PACKAGE NAME>/<PACKAGE VERSION>/spec.json
inside the spec file, look at actions → arguments and obtain the version, name, jar file, and config file.
example:
ARTIFACT NAME: postgresql-plugin ARTIFACT VERSION: 1.1.0 ARTIFACT CONFIG: postgresql-plugin-1.1.0.json ARTIFACT JAR: postgresql-plugin-1.1.0.jar
2. Upload Plugin JAR
curl https://hub.cdap.io/v2/packages/<PACKAGE NAME>/<PACKAGE VERSION>/<ARTIFACT JAR> | curl -X POST --data-binary @- \ -H "Authorization: Bearer ${AUTH_TOKEN}" \ -H "Content-Type: application/octet-stream" \ -H "Artifact-Version: <ARTIFACT VERSION>" \ -H "Artifact-Extends: system:cdap-data-pipeline[6.0.0-SNAPSHOT,7.0.0-SNAPSHOT)/system:cdap-data-streams[6.0.0-SNAPSHOT,7.0.0-SNAPSHOT)" \ "${CDF_ENDPOINT}/v3/namespaces/<NAMESPACE>/artifacts/<ARTIFACT NAME>"
3. Updating Plugin Properties (for Widgets and Docs)
curl https://hub.cdap.io/v2/packages/<PACKAGE NAME>/<PACKAGE VERSION>/<ARTIFACT CONFIG> | jq ".properties" | \ curl -X PUT --data-binary @- \ -H "Authorization: Bearer ${AUTH_TOKEN}" \ -H "Content-Type: application/json" \ "${CDF_ENDPOINT}/v3/namespaces/<NAMESPACE>/artifacts/<ARTIFACT NAME>/versions/<ARTIFACT VERSION>/properties"