|
1 | 1 | Packs |
2 | 2 | ===== |
3 | 3 |
|
4 | | -Installing packs from st2incubator or st2contrib via ChatOps |
5 | | ------------------------------------------------------------- |
| 4 | +Installing packs with ChatOps |
| 5 | +----------------------------- |
6 | 6 |
|
7 | | -When you have the bot listening for ChatOps commands in a channel, installing extra packs |
8 | | -can be done by running a single command: |
| 7 | +When you have the bot listening for ChatOps commands in a channel, installing extra packs |
| 8 | +from StackStorm Exchange can be done by running a single command: |
9 | 9 |
|
10 | 10 | .. code-block:: bash |
11 | 11 |
|
12 | | - ! pack deploy st2contrib elasticsearch,travis_ci |
13 | | - bot: Deploying the requested pack(s) from *st2contrib* for you.... |
14 | | - @my_user: Successful deployment of *elasticsearch* *travis_ci* ! |
15 | | - > from https://github.com/StackStorm/st2contrib.git (branch: _master_). |
| 12 | + !pack install github,slack,trello |
| 13 | + bot: Installing the requested pack(s) for you. |
| 14 | + @my_user: |
| 15 | + > Successful deployment of *github*, *slack*, *trello* packs! |
16 | 16 |
|
17 | | -If you're adventurous and wish to install and help develop a pack that's |
18 | | -currently in st2incubator you can install one with the following command: |
| 17 | +You can install a pack from any github repository just as easily: supply the full URL |
| 18 | +to the bot. Pack name is unnecessary, as it will be read from ``pack.yaml`` later: |
19 | 19 |
|
20 | 20 | .. code-block:: bash |
21 | 21 |
|
22 | | - ! pack deploy st2incubator vsphere,debian |
23 | | - Deploying the requested pack(s) from *st2incubator* for you |
24 | | - @my_user: Successful deployment of *vsphere* *debian* ! |
25 | | - > from https://github.com/StackStorm/st2incubator.git (branch: _master_). |
| 22 | + !pack install https://github.com/stackstorm/openstack |
| 23 | + bot: Installing the requested pack(s) for you. |
26 | 24 |
|
27 | | -The command takes the following very simple format: |
| 25 | +You can even mix the two formats in one string: |
28 | 26 |
|
29 | 27 | .. code-block:: bash |
30 | | - |
31 | | - ! pack deploy {{repo_name}} {{packs}} {{branch=master}} - Download StackStorm packs via ChatOps |
32 | 28 |
|
33 | | -Deploying Custom packs via ChatOps |
34 | | ----------------------------------- |
| 29 | + !pack install github,slack,trello,https://github.com/stackstorm/openstack |
35 | 30 |
|
36 | | -The same commands can be used to install your own packs just by adding an entry to `/opt/stackstorm/packs/packs/config.yaml` in the following format: |
| 31 | +.. figure :: /_static/images/packs-chatops-install.png |
| 32 | + :align: center |
37 | 33 |
|
38 | | -.. code-block:: yaml |
39 | 34 |
|
40 | | - --- |
41 | | - repositories: |
42 | | - NameOfRep: |
43 | | - repo: "https://github.com/<my-GitHub-user>/my-st2.git" |
44 | | - subtree: true |
| 35 | +Getting information about an installed pack |
| 36 | +------------------------------------------- |
45 | 37 |
|
46 | | -This will allow you to install a pack via: |
| 38 | +The ``!pack get <pack>`` command shows you information about an installed |
| 39 | +pack. There is two sections in the output: the first is pack metadata from |
| 40 | +``pack.yaml``, and the optional second is git information, if your pack has |
| 41 | +been installed from a git source like StackStorm Exchange or a single repo. |
47 | 42 |
|
48 | | -.. code-block:: bash |
49 | | -
|
50 | | - ! pack deploy NameOfRep MyAwesomePack |
51 | | -
|
52 | | -If you don't have multiple packs within the same repository under a `packs` directory, just set `subtree` to `false` and issue the following command: |
53 | | - |
54 | | -.. code-block:: bash |
| 43 | +Git status will tell you if there's a difference between your local pack version |
| 44 | +and the latest version in the origin repository, and also show the remotes |
| 45 | +for your pack. |
55 | 46 |
|
56 | | - ! pack deploy NameOfRep NameOfRep |
| 47 | +If a pack is not installed, but available in StackStorm Exchange, the bot will |
| 48 | +gallantly offer to install it: |
57 | 49 |
|
58 | | -Automating Custom Pack Deployment |
59 | | ---------------------------------- |
| 50 | +.. figure :: /_static/images/packs-chatops-get.png |
| 51 | + :align: center |
60 | 52 |
|
61 | | -Building on the above it's possible to enable auto deployment for a single branch of a |
62 | | -repository which has has `subtree` set to `false` by adding an `auto_deployment` section as shown below: |
| 53 | +Getting information about an available pack |
| 54 | +------------------------------------------- |
63 | 55 |
|
64 | | -.. code-block:: yaml |
| 56 | +The remote counterpart to ``pack get`` is ``pack show``: it will show an |
| 57 | +entry from the StackStorm Exchange, our pack directory, if a pack with the |
| 58 | +given name is available. |
65 | 59 |
|
66 | | - --- |
67 | | - repositories: |
68 | | - my-st2: |
69 | | - repo: "https://github.com/<my-GitHub-user>/my-st2.git" |
70 | | - subtree: false |
71 | | - auto_deployment: |
72 | | - branch: "master" |
73 | | - notify_channel: "my-chatops-channel" |
| 60 | +.. figure :: /_static/images/packs-chatops-show.png |
| 61 | + :align: center |
74 | 62 |
|
75 | | -Then you need a rule (or a sensor) that will trigger the `packs.deploy` action with the right |
76 | | -parameters. The following is based on an post-commit hook from BitBucket Server: |
| 63 | +Searching for a pack |
| 64 | +-------------------- |
77 | 65 |
|
78 | | -.. code-block:: yaml |
| 66 | +To search for a pack in StackStorm Exchange, use ``!pack search <query>``. Note that |
| 67 | +your query will match results in all pack parameters: for example, you can search for |
| 68 | +an author or a keyword, not just name and description. The results are ordered by |
| 69 | +relevance: if you search for "cloud", first you will get packs with "cloud" in their |
| 70 | +name—because they are the most likely to be what you were looking for—and then packs |
| 71 | +with "cloud" in keywords or description. And then packs authored by "Mr. Cloud", if |
| 72 | +any. |
79 | 73 |
|
80 | | - action: |
81 | | - ref: "packs.deploy" |
82 | | - parameters: |
83 | | - auto_deploy: true |
84 | | - repo_name: "{{trigger.body.repository.name}}" |
85 | | - branch: "{{trigger.body.refChanges[0].refId}}" |
86 | | - packs: [ "{{trigger.body.repository.name}}" ] |
87 | | - message: "{{trigger.body.changesets.get('values')[0].toCommit.message}}" |
88 | | - author: "{{trigger.body.changesets.get('values')[0].toCommit.author.name}}" |
| 74 | +**Pro-tip:** if you configure an additional pack index (see "Working with pack indexes" in :doc:`/packs`), |
| 75 | +it will be queried alongside StackStorm Exchange by commands like ``show`` or ``search``. |
89 | 76 |
|
| 77 | +.. figure :: /_static/images/packs-chatops-search.png |
| 78 | + :align: center |
0 commit comments