This README is for SDK developers. If you are a plugin developer please refer to README.md.
The artifact produced by this repository is a set of Python distributions that make up the SDK.
There are two parts of the SDK that are important to think about separately since they have slightly different workflows.
- The
tools
package is the SDK's CLI. This aids in plugin development, testing, and distribution. common
,libs
, andplatform
contain what are collectively called the "wrappers". These are vanilla Python classes that abstract the Virtualization API protobuf messages (published by app-gate) away from plugin developers. These expose the API plugin developers write against.
All dependencies of a plugin must be packaged with the plugin including the protobuf messages (dvp-api
) and the wrappers.
This is done automatically by dvp build
.
This is what causes the slightly different workflows in development. Changes to tools
are completely isolated from the
Delphix Engine and wrappers changes only impact the plugin build.
At a very high level, our development process usually looks like this:
- Create a fork of the delphix/virtualization-sdk repository.
- Clone the forked repository.
- Make changes to SDK code. Test these changes manually and with unit tests. Iterate on this until you have everything working.
- Bump major/minor/patch/build version depending on the scope of the change. Refer to versioning section for instructions.
- Commit your changes. Refer to the contribution guideline for commit message format.
- Make sure the version number of the packages is updated appropriately in your commit. That includes all files mentioned
in
.bumpversion.cfg
and the string intest_get_version()
insidetest_package_util.py
. - Push your changes to a branch in the forked repository.
- Run blackbox tests against that branch.
- Publish a pull request to the delphix/virtualization-sdk once your code is ready for review.
- Once the pull request is approved, merge the pull request into delphix/virtualization-sdk repository.
These steps are described in more detail below.
Development should be done in a personal virtualenv. To setup the virtual environment:
virtualenv /path/to/env/root
. This should be a Python 2.7 virtualenv.source ~/path/to/env/root/bin/activate
.
To install the SDK, follow these steps:
-
Create a file at
<virtualenv-root>/pip.conf
that contains:[install] index-url=https://pypi.org/simple/ extra-index-url=https://test.pypi.org/simple/
One of the SDK dependencies - dvp-api - is currently hosted on TestPyPi. By default
pip
looks at pypi.org for packages to install. In order to successfully install the SDK, you have to configure pip to search an additional package repository - test.pypi.org. -
To build the project, run
sh bin/build_project.sh -b
. -
For more information on the script options, use
sh bin/build_project.sh -h
.
To better understand how to develop and test tools
changes, see tools/README-dev.md.
The SDK is shipped as five Python packages that are currently versioned and shipped together: dvp, dvp-common, dvp-libs, dvp-platform, and dvp-tools.
The first thing to do is to change the version number of all the packages. Our versioning scheme follows the rules of semantic versioning in order to help developers manage their "dependency hell". We use bump2version to make the version management of all five packages easier. Semantic versioning rules are the following:
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards compatible manner, and
PATCH version when you make backwards compatible bug fixes.
Source: https://semver.org/
The version format is MAJOR.MINOR.PATCH for released versions and ...dev for development builds.
For more details see .bumpversion.cfg
in the root of this repository.
If you want to bump the build number from 1.1.0.dev7
to 1.1.0.dev8
, run bumpversion dev
.
If you want to bump the major/minor/patch version, run bumpversion [major|minor|patch]
.
If you want to get rid of the dev label (bump from 1.1.0.dev7
to 1.1.0
), run bumpversion release
.
Note: After bumpversion the tools unit test will need to be manually updated to test for the new version.
Currently, there are three types of SDK testing: unit, manual, and functional (blackbox).
Go into one of the package directories (common, dvp, libs, platform, tools) and follow these steps:
- Install the package's development dependencies and package itself by following the directions in the SDK installation section.
- Run unit tests:
python -m pytest src/test/python
. - To run unit tests in all packages with one command, run
sh bin/build_project.sh -t
. - For more information on the script options, use
sh bin/build_project.sh -h
.
The only way to manually test the new wrappers code is to build a plugin, upload it to a Delphix Engine and run through all the standard workflows. The same workflows will be exercised by functional (blackbox) tests.
To run blackbox tests, follow these steps:
- Push your code to a branch in the forked repository on Github. Let's say the branch is called
my-feature
in repository called<username>/virtualization-sdk
. - If you bumped the version (one of major, minor, or micro, not the dev version part), then QA will have to createa a new branch (qa-appdata-toolkits branch sdk-3-2-0 for example with version 3.2.0) and update their map before you can run the blackbox tests:
- automation/regression/BlackBox/blackbox/appdata/virtualization_sdk/dvp_settings.py
- Navigate to the app-gate directory and start tests using
git blackbox
. For the guide on which test suite to use, see the next sections.
At a minimum, each pull request should pass appdata_python_samples
and appdata_basic
tests with a direct or staged plugin.
See the section below for the description of each test suite.
- appdata_python_samples (sample plugins from the app-gate):
git blackbox -s appdata_python_samples --extra-params="-p virt-sdk-repo=https://github.com/<username>/virtualization-sdk.git -p virt-sdk-branch=my-feature"
, - appdata_basic with a direct Python plugin on CentOS 7.3:
git blackbox -s appdata_basic -c APPDATA_PYTHON_DIRECT_CENTOS73 -a --extra-params="-p virt-sdk-repo=https://github.com/<username>/virtualization-sdk.git -p virt-sdk-branch=my-feature"
, - appdata_basic with a staged Python plugin on CentOS 7.3:
git blackbox -s appdata_basic -c APPDATA_PYTHON_STAGED_CENTOS73 -a --extra-params="-p virt-sdk-repo=https://github.com/<username>/virtualization-sdk.git -p virt-sdk-branch=my-feature"
.
- virtualization_sdk (installs and tests a direct Python plugin on Ubuntu 18):
git blackbox -s virtualization_sdk -c APPDATA_SDK_UBUNTU18_DIRECT_CENTOS73 --extra-params="-p virt-sdk-repo=https://github.com/<username>/virtualization-sdk.git -p virt-sdk-branch=my-feature"
, - virtualization_sdk (installs and tests a staged Python plugin on Ubuntu 18):
git blackbox -s virtualization_sdk -c APPDATA_SDK_UBUNTU18_STAGED_CENTOS73 --extra-params="-p virt-sdk-repo=https://github.com/<username>/virtualization-sdk.git -p virt-sdk-branch=my-feature"
.