zulip/templates/zerver/integrations/openshift.html

93 lines
3.4 KiB
HTML
Raw Normal View History

<p>
Ths integration sends a notification every time a deployment is
made in an OpenShift instance.
</p>
<p>
First, download our
<a href="/api">Pythonbindings and example scripts</a>,
and move it to your local copy of the application's repository.
</p>
<p>
Then, create a new commit including all the changes made to the
repository, and push it to your app.
</p>
<p>
After that, connect to the application through SSH. If you don't know
how to do this, log in to your OpenShift Online account, go to your
application's dashboard, and click "Want to log in to your application?".
<br/>There you'll find the app's SSH user, address, and further
information on SSH, in case you need it.
</p>
<img class="screenshot" src="/static/images/integrations/openshift/002.png"/>
<p>Once you have connected, install the Python bindings by running:</p>
<div class="codehilite"><pre>
<span class="s">$</span> cd ~/app-root/repo/&lt;python_bindings_path&gt;
<span class="s">$</span> python setup.py install</pre>
</div>
<p>
Where <code>&lt;python_bindings_path&gt;</code> is the path where you
saved the bindings in the first step.
</p>
<p>
Next, open <code>integrations/openshift/zulip_openshift_config.py</code>
inside the SSH terminal with your favorite editor, and change the
following lines to specify the email address and API key for your
OpenShift integration:
</p>
<div class="codehilite">
<pre><span class="n">ZULIP_USER</span> <span class="o">=</span> <span class="s">"openshift-bot@example.com"</span>
<span class="n">ZULIP_API_KEY</span> <span class="o">=</span> <span class="s">"0123456789abcdef0123456789abcdef"</span>
{% if api_site_required %}<span class="n">ZULIP_SITE</span> <span class="o">=</span> <span class="s">"{{ external_api_uri_subdomain }}"</span>{% endif %}</pre>
</div>
<p>
You can also specify which pushes will result in
notifications and to what stream the notifications will be sent
by modifying the <code>deployment_notice_destination</code> function
in <code>zulip_openshift_config.py</code>. By default, deployments
triggered by commits pushed to the <code>master</code> and
<code>test-post-receive</code> branches will result in a notification
to stream <code>deployments</code>.
</p>
<p>
Save the file, and symlink
<code>$OPENSHIFT_PYTHON_DIR/virtenv/share/zulip/integrations/openshift/post-receive</code>
into the <code>~/app-root/repo/.openshift/action_hooks</code>
directory.
</p>
<p>
Next, create the stream you'd like to use for OpenShift notifications,
and subscribe all interested parties to this stream. The integration will
use the default stream <code>deployments</code> if no stream is supplied
in the hook; you still need to create the stream even if you are using
this default.
</p>
<p>
<b>Congratulations! You're done!</b><br/> Whenever you make
a push to the <code>master</code> branch of your application's repository
(or whichever branch you configured above), or if you force a deployment,
the Zulip OpenShift plugin will send an automated notification that
looks like this:
</p>
<img class="screenshot" src="/static/images/integrations/openshift/001.png"/>
<p>
<b>Testing</b><br/>You can test the plugin without changing
your <code>master</code> branch by pushing to
the <code>test-post-receive</code> branch.
</p>