You can create a ZIP package that contains the Node.js script and dependencies used by your Cloud Assembly extensibility actions.

There are two methods of building the script for your extensibility actions:

  • Writing your script directly in the extensibility action editor in Cloud Assembly.
  • Creating your script in your local environment and adding it, with any relevant dependencies, to a ZIP package.

By using a ZIP package, you can create a custom preconfigured template of action scripts and dependencies that you can import to Cloud Assembly for use in extensibility actions.

Also, you can use packages to create extensibility actions that contain multiple Node.js script files. Using multiple script files can be useful for organizing the structure of your extensibility action code.

Procedure

  1. On your local machine, create a folder for your action script and dependencies.
    For example, /home/user1/zip-action.
  2. Add your main Node.js action script or scripts to the folder.
    For example, /home/user1/zip-action/main.js.
  3. (Optional) Add any dependencies for your Node.js script to the folder.
    1. Create a package.json file with dependencies in your script folder. See Creating a package.json file and Specifying dependencies and devDependencies in a package.json file.
    2. Open a command-line shell.
    3. Navigate to the folder that you created for the action script and dependencies.
      cd /home/user1/zip-action
    4. Install your package.json file in the script folder by running the following command:
      npm install --production
      Note: This command creates a node_modules directory in your folder.
  4. In the assigned folder, select your script elements and, if applicable, your node_modules directory and compress them to a ZIP package.
    Note: Both your script and dependency elements must be stored at the root level of the ZIP package. When creating the ZIP package in a Linux environment, you might encounter a problem where the package content is not stored at the root level. If you encounter this problem, create the package by running the zip -r command in your command-line shell.
    cd your_script_and_dependencies_folder
    zip -r ../your_action_ZIP.zip *

What to do next

Use the ZIP package to create an extensibility action script. See How do I create extensibility actions.