February 15, 2016
by Jon Middleton, Optimisation Project Lead @ Pulsant Limited
In the post StackStorm QuickTip: ChatOps your pack dev workflow James Fryman gave a ChatOPS alias recipe to reduce the friction for deploying packs and then in the Random Thoughts section asked:
This action is tied directly to the
packs.install
. What about a workflow? Seems like that would be a better way to structure this.
This resonated with me as I had already started working on an internal pack that did just that, as I thought attempting to deploy a pack via an alias (and action) contained within the same pack would be madness (or just lead to interesting race conditions). In the last week, our Pull Request has been merged, documentation has been included in st2docs (link) for a workflow that fulfils the above random thought and should be released with 1.4.
So introducing packs.deploy
, an action written in Mistral to handle the mapping of names for Git repositories to the information required to carry out the packs.install
action.
Yes you can! All you need to do to set up packs.deploy
so that you can deploy from one of your own repositories is to add the following to /opt/stackstorm/packs/packs/config.yaml
under repositories:
for each of your packs.
MyAwesomePackRepo: repo: "https://github.com//my-st2.git" subtree: true
If you don’t have a packs
directory, just set subtree
to false
.
The ChatOPS command has been simplifed to the following (as the Git URL is stored in the config file):
! pack deploy {{repo_name}} {{packs}} {{branch=master}} - Download StackStorm packs via ChatOps
And the ChatOPS responses have been simplified too, so that it’s using the ChatOPS formatting from StackStorm 1.2:
The packs.deploy
action can also be used for automated deployment, you just need to add the following to the definition above
auto_deployment: branch: "master" notify_channel: "my-chatops-channel"
And then set up an StackStorm rule that triggers packs.deploy
with the right parameters (see the docs). There should be an example rule for BitBucket Server merged into the BitBucket
pack before the release of 1.4). Thus a checkin on master happens the action will run and the following will be posted in your notify_channel
.
This is another iteration of the pack deployment user story which further reduces friction. What else would be advantageous and supply another incremental reduction of friction?
@Bot: Say _alas! ear wax!_ to complete your deployment of *AwesomePack* from *MyAwesomePackRepo* branch _Feature/factor-out-earwax-beans_.
@jjm: alas! ear wax!
@Bot: @jjm: Deploying *AwesomePack* from *MyAwesomePackRepo* for you…