Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

dev environment

ray-millward-tessella edited this page Oct 25, 2018 · 7 revisions

Setting up a Development Environment

Code Development

Getting the code

In order to start development you will need to clone the code base from https://github.com/ral-facilities/gridftp_acl_plugin.git or using the corresponding ssh address if you have uploaded your key to GitHub.

Starting a development VM

Locally

The development machine runs inside a vagrant virtual machine, for this you will need to install the following software:

To start the machine navigate to the root of the repo and run

vagrant up

Note the first time it runs it will provision the machine using Ansible, if you need to update the configuration of the machine then you can run vagrant provision at a later time as well

To log into the machine you then run

vagrant ssh

The code is then mounted in the VM at ~/src.

To stop the machine run vagrant halt, to destroy the machine vagrant destroy.

On OpenStack

To configure a machine on OpenStack you will need an Ansible control machine - the local development VM can also act as an Ansible control machine or you can install Ansible on a different machine.

Spin up a machine on openstack.stfc.ac.uk and take note of the IP address, you will also need to add the public ssh of the Ansible control machine to the authorized_keys for the new machine in OpenStack.

Add a hosts file to the dev-environment folder in the code base (there is a hosts.template file) and add the new dev machine IP to the top, fill in your FedID as the user Ansible should run as in order to log into the OpenStack machine.

Then on the Ansible control machine with the dev-environment folder from this codebase in, run:

ansible-playbook -i hosts gridftp-plugin-dev.yml

Wait for the playbook to run and then you can clone the code base on the target machine and follow the instructions below.

Setting up a build environment

Drop into a devtoolset-6 environment to get C++11

scl enable devtoolset-6 bash

Navigate to the src folder inside the VM and then run

mkdir build
cd build
cmake3 -GNinja ../

This will generate the ninja build files needed to build the code. If you modify the CMakeLists.txt file or add new files then you will need to run the cmake3 step again the update the ninja build files.

Building the code

Once the build environment has been created then you simply need to run

ninja

from the src/build directory. This will generate the GridftpACLPlugin executable that can be run.

Testing the code

To run the tests run

ninja test

Running code analysis

To run the static code analysis run:

./run-code-analysis.sh

from the src folder.

To run the code coverage run:

./run-code-coverage.sh

from the src folder. Note this will output to the console but also produce a html report in src/build/coveragereportall

Documentation Development

The documentation for the project is held in the GitHub wiki next to the code (https://github.com/ral-facilities/gridftp_acl_plugin/wiki) and can be edited live or the repo can be cloned and the documentation edited locally (this is a different repo from the one containing the source https://github.com/ral-facilities/gridftp_acl_plugin.wiki.git).

It is just plain markdown so can be edited in any standard text editor but Visual Studio Code is also a good tool with support for previewing the markdown live as you're editing using the Markdown Preview Github Styling extension.

Images

Diagrams are all created using draw.io either in the browser or using the desktop app. The key is that all the images are saved as pngs that embed the source so they can both be integrated into the markdown but also still edited again using draw.io later.