Shared modules as code
2 minute read
Once a shared module is linked to a repository, you can push it, preview the changes, and later refresh the module from the repository. You can also create a module from one already in a repository. This requires a repository linked to Cloud Management Platform (CMP) and repository credentials on your profile so commits are attributed to you. See Integrate a remote source code repository.
Push and refresh a shared module
Open the module from Admin > Shared Modules, then select its repository tab. The tab is named Repository until the module is linked to a repository; then it is named GitHub or GitLab.
Push to Remote Source opens a form for a Repository, Branch, and Commit Message. If the module has been pushed before, select Preview first to see what changed. After the push, the result includes a link to open a pull request.
Refresh from Remote Source prompts for a Repository and Branch, then updates the module in CMP based on the repository’s contents. It appears once the module has been pushed or created from a repository, and the tab also shows the repository, the remote source URL, and when the module was last refreshed.
An action that imports a shared module includes it; when the action is pushed, the module is also written to the repository, so the exported action still has the code it depends on.
A module from a repository is read-only unless Remote Content Mode in Miscellaneous Settings allows editing. While it is read-only, Push to Remote Source is disabled.
Create a shared module from a repository
- Go to Admin > Shared Modules.
- Select Create from Repository.
- Provide a Repository, Branch, and Shared Module JSON File.
- Select Save.
Related
- Integrate a remote source code repository: Linking a repository and setting credentials for your commits.
- Shared modules: Reusing Python code across plugins and other modules.