Installation scripts for SURF ResearchCloud catalog components
View the Project on GitHub UtrechtUniversity/researchcloud-items
Below list can be used to check the quality of your ResearchCloud-items software and documentation.
Components in the ResearchCloud catalog should contain a brief description:
For Ansible-based Components (see here for more info), both the playbooks and the roles utilized by the playbook should be documented.
ResearchCloud catalog items are effectively compositions that reference various components. Catalog items should be described in the ResearchCloud catalog itself, including:
The description field should provide:
Ansible Playbooks (ResearchCloud components) should be able to run independent of any other Playbooks. This guideline ensures that the Playbook can be reused within the context of different workspace compositions. Dependencies should be managed within, and hidden by, the Playbook. For instance a Role referenced in the Playbook could list the other Roles that it depends on.
Note that the installation script specified by a Playbook will run in isolation from other Playbook installation scripts. For instance Ansible variables are scoped to a single ResearchCloud component (Playbook) and their value will not be passed on to the next component Playbook script.
Ansible Roles should follow the principe “doing one thing well”.
For more information, see Design Principles.
Avoid the use of hardcoded constants or literals in installation scripts. Instead, always reference an Ansible variable and include a default value for such variable in the Role specification.
Parameters provided to Ansible Playbooks must follow the naming conventions for SURF ResearchCloud items.
Source code must always be accompanied by an explicit License. It suffices to mention a common license applicable to the entire Git repository, except where source code deviates from such convention.
Licences should be compatible with licenses for any other software it depends on. The Public License Selector is a tool that has been developed as part of a European Research program. It assists you to select an appropriate and compatible license for software and data.
Supported catalog items and components:
Components should be set to Public (usable by all Collaborative Organisations) only if they meet the above criteria.
Unsupported items/components should include a disclaimer to indicate their experimental status. This alerts end users to double-check compliance with policies.
Catalog item documentation should list the responsibilities of users with regard to security.
As a rule of thumb, it should be clear to end users what level of responsibility they will assume when deploying
a workspace.
A workspace composition should be compliant with applicable policies. When in doubt, limit the authorized use of a workspace type to a specified community/collaboration.
The roles in the uusrc.general collection contain many roles that faciliate best practices on ResearchCloud, for instance:
/usr/bin/python3
), which might break pip
dependencies on which the system depends.While unit tests are not present in these components made for SURF Research Cloud, there are other tools that can help you:
Try to incorporate as much of TDD into developing playbooks and roles: first determine when your code is succesfull or when it should fail, and then code around those requirements.
CI pipelines for Ansible Lint and Molecule are essential to guarding against the introduction of bugs and maintaining code quality.
You can also use Molecule to test and experiment locally.
Using [Molecule tests], you can locally test whether changes to a role or playbook deploy correctly, and whether they function as you expected, using Docker or Podman containers. This can save a lot of time, as running a container is faster than deploying a VM on ResearchCloud.
There is a separate repository that contains Molecule boilerplate configuration tailored for use with ResearchCloud components. This is so that this configuration can easily be included in other repos. See here for more information.
Although local testing (and testing in CI) with Molecule is great for small changes, for bigger changesets it may be wise to also test on ResearchCloud. This is because the container deployment used with Molecule is not fully identical to the ResearchCloud environment.
For testing changes to a Catalog Item on ResearchCloud, best practice is to:
[DEV] My Catalog Item
.
[DEV] ...
version of the catalog item already exists! In that case, you may not need to clone a new version.[DEV] My Catalog Item
. See if the deployment succeeds and everything works as expected.However, note that instead of testing every change on ResearchCloud, you can also start by running Molecule tests locally. This can save a lot of time!