File: README

package info (click to toggle)
libfabric 2.1.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,108 kB
  • sloc: ansic: 387,262; python: 3,171; sh: 2,555; makefile: 1,313; cpp: 617; perl: 474; ruby: 123; asm: 27
file content (129 lines) | stat: -rw-r--r-- 4,242 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
This directory contains the Github webhook for verifying that all
commits on an ofiwg PR contain a "Signed-off-by" line, and its
relevant configuration.

The bot runs as a Ruby Sinatra server on flatbed.openfabrics.org.  It
was initially heavily inspired by
http://git-scm.com/book/en/v2/GitHub-Scripting-GitHub.

The original flatbed server was running RHEL (CentOS, actually, but
close enough).  As of Feb 2016, it is now Ubuntu.  So this README
shows info about both Ubunutu and RHEL (mainly for hysterical
raisins).

===================

RHEL background:

Sadly, I did not take good notes about how to get Sinatra installed on
Flatbed.  Looking on flatbed on 17 Feb 2016, I see the following RPMs
installed:

- rubygems
- rubygem-sinatra

These seem to be the key RPMs to install.  Hopefully, they're in the
CentOS yum repo -- I do not have any notes on where I got them from.
The following RPMs seem to be dependencies of Sinatra; hopefully yum
just pull them in:

- rubygem-crack
- rubygem-daemons
- rubygem-rack-test
- rubygem-httparty
- rubygem-eventmachine
- rubygem-thin
- rubygem-rack
- rubygem-json

Ubuntu backgruond:

On Ubuntu, it was straightforward to install the Sinatra server:

# apt-get install ruby-sinatra ruby-htttparty

===================

There are several important files in this directory:

1. github-webhook-ofiwg-init.d-rhel and
   github-webhook-ofiwg-init.d-ubuntu

The /etc/init.d/github-webhook-ofiwg (one for RHEL and one for Ubuntu)
script that starts and stops the Ruby Sinatra server script that
actually listens for the incoming Github webhook pings.

2. verify-signed-off.rb

The Ruby Sinatra server (i.e., a Ruby script that uses the Sinatra
framework for listening for incoming HTTP requests) that listens for
Github webhook pings.  When it gets an incoming ping, if it's for a
pull request, the script gets a listing of all the commits on that
pull request and verifies that they all have a "Signed-off-by" line in
them.  If they all do, all commits have a "success" status set (at
Github).  If any are missing this line, then those commits have a
"failed" status set, and the last commit on the PR also has a "failed"
status set (because Github shows the overall status of the PR as the
last commit's status).

Every time commits are pushed to the PR, all the commits will be
checked again.  This ensures that even if you replace all the commits,
we'll check them all (it's one HTTP request to get all the commit
messages, anyway, so it's not like it makes the check take
significantly longer).

Note that the Ruby Sinatra server listens on localhost port 5000; it
is not directly accessible to the outside world.

On flatbed.openfabrics.org, the file is located in:

RHEL: /var/www/github-webhooks/ofiwg/verify-signed-off.rb
Ubuntu: /var/www/html/github-webhooks/ofiwg/verify-signed-off.rb

3. apache-config.txt

This is a snipit from flatbed.openfabrics.org:

RHEL: /etc/httpd/conf.d/20-ssl.conf
Ubuntu: etc/apache2/mods-enabled/proxy.conf

This snipit is inserted in the SSL version of www.openfabrics.org
config to enable the reverse proxy (i.e., incoming web requests to
https://www.openfabrics.org/github-webhooks/ofiwg get routed
internally to http://localhost:5000/ -- i.e., the Ruby Sinatra
server).

On Ubuntu, I had to load the mod_proxy Apache module by:

# a2enmod proxy
# a2enmod proxy_http
# cd /etc/apache2/mods-enabled
# ln -s ../mods-available/proxy.conf
        ^^ This is the file to add the apache proxy config

===================

There is one additional file needed on flatbed.openfabrics.org:

RHEL: /etc/sysconfig/github-webhook-ofiwg
Ubuntu: /etc/default/github-webhook-ofiwg

The init.d script will source this file; it needs to set an
environment variable that verify-signed-off.rb will look for:
$GITHUB_AUTH_TOKEN.

Specifically, this file should contain a line like this:

export GITHUB_AUTH_TOKEN="...the token..."

(this file is not here in the git repo, of course -- because then
everyone could see our auth token!)

A Github auth token can be obtained from
https://github.com/settings/tokens of a user who has commit access to
the target Github repo(s).  The token needs to have the following
permissions when you create it:

- repo
- public_repo
- repo:status