Skip to main content

Various tools and utilities which aid with StackStorm pack development.

Project description

Build Status Join our community Slack

This repository contains different utilities and tools which help with the StackStorm integration pack development.

Installation

From PyPi (latest stable version):

pip install st2sdk

From git (latest in development version):

pip install -e git+https://github.com/StackStorm/st2sdk.git@master#egg=st2sdk

Tools

Pack Bootstrap / Scaffolding tool

Pack bootstrap tool makes it easier to get started with the StackStorm pack development.

Currently, the tool creates the correct pack directory structure.

Usage

Run tool in the non-interactive mode:

st2sdk bootstrap <pack name>

This will create a pack directory named <pack name> in the current working directory. This directory will contain all the directories and files which are needed by pack.

Run tool in the interactive mode:

st2sdk bootstrap -i [pack name]

In the interactive mode, the tool will ask you a couple of questions and the answers will be used to populate pack metadata and other files.

Check and Lint scripts

This repository also contains various “check” and “lint” scripts which can be ran standalone or hooked up to your continuous integration system. Those scripts validate metadata file syntax, verify that pack contains pack.yaml file, etc.

Some of those scripts require access to the database and network (e.g. PyPi to download pack dependencies, etc.) and they also manipulate the file system. You should make sure that you provide a clean environment on every invocation of those scripts. This can be achieved by using a fresh VM, docker container or similar for each run.

All of those scripts are also hooked up to our Travis CI system and run on every push to our st2contrib repository.

For some examples on how to utilize this scripts, please refer to the Makefile in st2contrib repository - https://github.com/StackStorm/st2contrib/blob/master/Makefile

As you may notice in the Makefile, we have some scripts and optimizations in place, so by default for Pull Request we only run scripts on changed files and / or pack. This is an important optimization because if we ran scripts for all the files and packs (even the ones which haven’t been touched) this would substantially slow down the CI run time for a particular Pull Request and delay the time it takes for user to get feedback about their PR.

In case you have a lot of custom packs in your repository, you might want to utilize similar approach.

st2-check-validate-yaml-file

This script verifies that a provided YAML file contains a valid syntax. It’s usually used with action metadata files and other YAML files.

Usage:

st2-check-validate-yaml-file <path to YAML file>

Keep in mind that this script just performs syntax and no semantic checks. If you want to confirm that your action or other metadata file is correct, you should also run st2-check-register-pack-resources script which tries to register all the resources in a pack and errors out of registration

st2-check-validate-json-file

This script verified that a provided JSON file contains a valid syntax. It’s usually used with action metadata files and other YAML files.

Usage:

st2-check-validate-json-file <path to JSON file>

Keep in mind that this script just performs syntax and no semantic checks. If you want to confirm that your action or other metadata file is correct, you should also run st2-check-register-pack-resources script which tries to register all the resources in a pack and errors out of registration of a particular resource fails.

st2-check-validate-pack-metadata-exists

This script verifies that a pack contains pack.yaml metadata file.

Usage:

st2-check-validate-pack-metadata-exists <path to the pack root directory>

st2-check-register-pack-resources

This script tries to register all the resources in a particular pack and fails if registering a particular resource fails.

Usage:

st2-check-register-pack-resources <path to the pack root directory>

This script requires access to a fresh database (MongoDB) on each run. In addition to that, it requires all the StackStorm components (st2actions, st2common, etc.) to be in PYTHONPATH. You can achieve that by cloning st2 repository in a particular directly (e.g. /tmp/st2) and then setting ST2_REPO_PATH environment variable to point to that directory when invoking the script.

st2-check-pylint-pack

This script runs pylint on all the Python files inside a particular pack.

Usage:

st2-check-pylint-pack <path to the pack root directory>

This script installs packs regular and test requirements so it needs to run inside a virtual environment which is created for purpose of this script.

Similar to st2-check-register-pack-resources this script also requires access to StackStorm code-base and st2 components. You can achieve that by cloning st2 repository in a particular directly (e.g. /tmp/st2) and then setting ST2_REPO_PATH environment variable to point to that directory when invoking the script.

st2-check-print-pack-tests-coverage

This script prints a test coverage for a particular pack. It prints all the actions which contains tests and the ones which are missing it.

Keep in mind that this script is for informational purposes only - right now it doesn’t fail if some action is missing tests.

Usage:

st2-check-print-pack-tests-coverage <path to the pack root directory>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

st2sdk-0.5.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

st2sdk-0.5.1-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file st2sdk-0.5.1.tar.gz.

File metadata

  • Download URL: st2sdk-0.5.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for st2sdk-0.5.1.tar.gz
Algorithm Hash digest
SHA256 75613642f6c504e1b3e5632a9ee46cb45d9759cac44dc19dcd56d60fc5bb0dc7
MD5 462f35e362d3690176a9b1d7f61b7c73
BLAKE2b-256 5ee913e6639e302d685c4807fb574c6f65bed045131076e00a049dd5cfff1c63

See more details on using hashes here.

File details

Details for the file st2sdk-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: st2sdk-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for st2sdk-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 537049d245e7d07773804156ffa1be15d711f6896da8030db2e81b4cb3efc12b
MD5 90667563ac7e63dd23fc8ad223001fbe
BLAKE2b-256 0d940d2991aec32cd14599fd426d03b8cb8731d756650ae6e534f227a109015f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page