Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

DRAFT

TOC


Basics

As coder you can develop and test your webpackage(s) locally using the CDT (Coder DevTools). To provide it for a larger audience you should upload it.
Uploading a webpackage means to transfer all files of a webpackage folder into a selected store of a Cubbles Base instance.


Upload Configuration

Details for the upload of a webpackage are configured by the uploadConfigs Object the .webpackage file within the root folder of each webpackage.

Initial setup

Initially the .webpackage file doesn't contain any configuration.

Just run the grunt task +webpackage-upload to initialize the file with respect to webpackage upload:

# [...]/my-cubbles-project/devtools
$ grunt +webpackage-upload


Now you see the .webpackage file containing an "uploadConfigs" object with 2 example configurations. Just rename / adapt them to your needs. You can define as many configurations as you like. When running an upload you will be prompted to select one of these.

Prompt for a configuration ...
# [...]/my-cubbles-project/devtools
$ grunt +webpackage-upload
Currently mapped Webpackage: super-package (@see ..\webpackages\.workspace)

Running "+webpackage-upload" task
> Reading available configs from '..\webpackages\super-package\.webpackage'
? Please type the index of your choice to SELECT A CONFIG or to CANCEL the upload:
  1) dryRun: {"url":"https://cubbles.world/sandbox", "proxy":"", "dryRun":true}
  2) release: {"url":"https://cubbles.world/sandbox", "proxy":""}
  3) CANCEL
  Answer: 1

The configuration object explained:

  1. url [mandatory, string/url]: This is the url of the Cubbles Base the webpackage will be uploaded to.
  2. proxy [optional, string/url]: If your connection to the Cubbles Base is routed over a proxy server, use this attribute to provide the proxy url.
  3. dryRun [optional, boolean]: This option allowes you to run the upload task, without uploading anything. It's perfect to check your store permissions or your .cubblesignore configuration.
  4. debug [optional, boolean]:  Set the debug option to "true" prints more details.


Ignore files from upload (.cubblesignore)

The .cubblesignore file allows you to prevent individually defined files and folders from upload. Internally we use the glob package - so just read the glob-primer for supported patterns.

.webpackage
{ }


.webpackage (initialised)
{
  "uploadConfigs": {
    "dryRun": {
      "url": "https://cubbles.world/sandbox",
      "proxy": "",
      "dryRun": true
    },
    "release": {
      "url": "https://cubbles.world/sandbox",
      "proxy": ""
    }
  }
}


Some real world examples:


Required Permissions

Uploading a webpackage into a server-side store requires your accout to have appropriated permissions.


Request permissions the stores sandbox and shared via curl:

$ curl -s -X POST -H "Content-type: application/json" https://cubbles.world/_api/authenticate -d '{"user":"{username}","password":"{password}","stores":["sandbox","shared"]}'

Response

{"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiMyIsImdyb3VwcyI6WyJiZGUtdGVzdC5kZXZlbG9wZXJzIiwiY29yZS5kZXZlbG9wZXJzIiwiaW5jb3dpYS5kZXZlbG9wZXJzIiwib2Rpbi5kZXZlbG9wZXJzIiwicGNwLXNhbmRib3guZGV2ZWxvcGVycyIsInNhbmRib3guZGV2ZWxvcGVycyJdLCJwZXJtaXNzaW9ucyI6eyJzYW5kYm94Ijp7InVwbG9hZCI6dHJ1ZX19LCJpYXQiOjE0ODgxNzk2NDYsImV4cCI6MTQ4ODE4MzI0Nn0.hg1a7CvY02h3JBF8f8ZL9_mS_J3w-o6eo83nXvHHR1M"}

The response contains an access token. Just use https://jwt.io/ to decode it and look at the permissions to see for which of the passed stores you have rights for:

 Click here to expand...



Perform an Upload

To perform an upload

  1. run the grunt task +webpackage-upload,
  2. choose the configuration to be used and
  3. provide provide your credentials.

# [...]/my-cubbles-project/devtools
$ grunt +webpackage-upload
Currently mapped Webpackage: super-package (@see ..\webpackages\.workspace)

Running "+webpackage-upload" task
> Reading available configs from '..\webpackages\super-package\.webpackage'
? Please type the index of your choice to SELECT A CONFIG or to CANCEL the upload: 1
Starting upload ...
? username: hrbu
? password: *************

Done, without errors.



Then your webpackage is released and all components a ready to be used.

Use the artifactsearch of the store you uploaded into to see each artifact of your webpackage listed (here the "sandbox" store): https://cubbles.world/sandbox/cubx.core.artifactsearch@1.6.0/artifactsearch/index.html



  • No labels