Skip to content

Commit 95b3a9b

Browse files
authored
Merge branch 'master' into emma-xcode-833
2 parents 3b86e1c + d8d15e2 commit 95b3a9b

File tree

102 files changed

+16417
-407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+16417
-407
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ source/tmp/*
88
tmp/
99
.jekyll-metadata
1010
node_modules
11+
generated-language-mapping.json
12+
_data/trusty_mapping_data.yml

.travis.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ python:
66
- "3.5.2"
77
branches:
88
only:
9-
- gh-pages
9+
- master
1010
env:
1111
global:
1212
- PATH=$HOME/.local/user/bin:$PATH
@@ -18,23 +18,22 @@ cache:
1818
deploy:
1919
provider: heroku
2020
api_key:
21-
secure: fkfayYzRdc0uh9iZeQKzC5/J3cKhVnyrkLRYSJmhixWtBHt87g7yzR1kGgsOce7OjqZ42bRn5W/gxyaDIUa+UMrt7RgURPASLy3rpm5wkk3iK2csvJaCixKcodI8UTXn7kRjYkrpQYcfvO1/25AnKBQKveobxSSAN3BQ3hERe5E=
21+
secure: "hylw2GIHMvZKOKX3uPSaLEzVrUGEA9mzGEA0s4zK37W9HJCTnvAcmgRCwOkRuC4L7R4Zshdh/CGORNnBBgh1xx5JGYwkdnqtjHuUQmWEXCusrIURu/iEBNSsZZEPK7zBuwqMHj2yRm64JfbTDJsku3xdoA5Z8XJG5AMJGKLFgUQ="
2222
app: docs-travis-ci-com
23+
skip_cleanup: true
2324
on:
24-
branch: gh-pages
25+
branch:
26+
- master
2527
notifications:
2628
slack:
2729
rooms:
2830
secure: LPNgf0Ra6Vu6I7XuK7tcnyFWJg+becx1RfAR35feWK81sru8TyuldQIt7uAKMA8tqFTP8j1Af7iz7UDokbCCfDNCX1GxdAWgXs+UKpwhO89nsidHAsCkW2lWSEM0E3xtOJDyNFoauiHxBKGKUsApJTnf39H+EW9tWrqN5W2sZg8=
2931
on_success: never
32+
webhooks:
33+
https://docs.travis-ci.com/update_webhook_payload_doc
3034
install:
3135
- bundle install --deployment
32-
- pip install --upgrade pip
33-
- pip install coala-bears
34-
- npm install remark-cli@2
35-
- npm install -g alex
3636
before_script:
3737
- rvm use 2.3.1 --install
3838
script:
3939
- bundle exec rake test
40-
- coala --non-interactive Language

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ gem 'rack-jekyll'
1212
gem 'rack-ssl-enforcer'
1313
gem 'puma'
1414

15+
gem 'faraday'
16+
1517
gem 'rake'
1618

1719
gem 'html-proofer', '~> 3.0'

Gemfile.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ GEM
1313
concurrent-ruby (1.0.5)
1414
ethon (0.10.1)
1515
ffi (>= 1.3.0)
16+
faraday (0.12.0.1)
17+
multipart-post (>= 1.2, < 3)
1618
ffi (1.9.18)
1719
forwardable-extended (2.6.0)
1820
html-proofer (3.6.0)
@@ -51,6 +53,7 @@ GEM
5153
mercenary (0.3.6)
5254
mini_portile2 (2.1.0)
5355
minitest (5.10.1)
56+
multipart-post (2.0.0)
5457
nokogiri (1.7.1)
5558
mini_portile2 (~> 2.1.0)
5659
parallel (1.11.1)
@@ -83,6 +86,7 @@ PLATFORMS
8386
ruby
8487

8588
DEPENDENCIES
89+
faraday
8690
html-proofer (~> 3.0)
8791
jekyll (>= 3.1.6)
8892
jekyll-paginate
@@ -94,4 +98,4 @@ DEPENDENCIES
9498
rdiscount (>= 2.2.0.1)
9599

96100
BUNDLED WITH
97-
1.13.6
101+
1.14.6

README.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# About this repository [![Build Status](https://travis-ci.org/travis-ci/docs-travis-ci-com.svg?branch=gh-pages)](https://travis-ci.org/travis-ci/docs-travis-ci-com)
1+
# About this repository [![Build Status](https://travis-ci.org/travis-ci/docs-travis-ci-com.svg?branch=master)](https://travis-ci.org/travis-ci/docs-travis-ci-com)
22

33
This is the documentation site for Travis CI! (<http://docs.travis-ci.com/>)
44

@@ -7,40 +7,63 @@ This is the documentation site for Travis CI! (<http://docs.travis-ci.com/>)
77
Fork the repository, read the rest of this README file and make some changes.
88
Once you're done with your changes send a pull request. Thanks!
99

10-
## How to edit the site
10+
## How to check your edit before sending PR
1111

12-
Make sure you have Ruby and RubyGems installed. Next install
13-
[bundler](http://bundler.io/):
12+
You can inspect how your edits will be reflected by the documentation site.
1413

15-
```bash
16-
gem install bundler
17-
```
14+
### Install dependencies
1815

19-
Then install dependencies:
16+
1. Make sure you have Ruby and RubyGems installed.
2017

21-
```bash
22-
bundle install --binstubs
23-
```
18+
1. Install [bundler](http://bundler.io/):
2419

25-
In order to run a local Web server that will serve documentation site, run:
20+
```sh-session
21+
$ gem install bundler
22+
```
2623

27-
```bash
28-
./bin/jekyll serve
29-
```
24+
1. Install application dependencies:
25+
26+
```sh-session
27+
$ bundle install --binstubs
28+
```
3029

31-
and then open [localhost:4000](http://localhost:4000/) in your browser.
30+
### Generate documentation
3231

33-
To regenerate the HTML pages automatically when you make changes to Markdown source files, use
32+
Run
3433

35-
```bash
36-
./bin/jekyll serve --watch
34+
```sh-session
35+
$ ./bin/jekyll build
3736
```
3837

39-
Note that quoted entities may be escaped or unescaped depending on the Ruby
40-
version (1.8 vs. 1.9) used. It is normal.
38+
39+
### Run application server
40+
41+
You are now ready to start your documentation site, using Jekyll or Puma.
42+
For documentation edits, Jekyll is sufficient.
43+
44+
#### Starting and inspecting edits with Jekyll
45+
46+
1. Run Jekyll server:
47+
48+
```sh-session
49+
$ ./bin/jekyll serve
50+
```
51+
52+
1. Open [localhost:4000](http://localhost:4000/) in your browser.
53+
54+
#### Starting and inspecting edits with Puma
55+
56+
For more programmatical PRs (such as handling webhooks notification
57+
via POST), Puma is necessary.
58+
59+
1. Run Puma server:
60+
61+
```sh-session
62+
$ ./bin/puma
63+
```
64+
65+
1. Open [localhost:9292](http://localhost:9292/) in your browser.
4166

4267
## License
4368

4469
Distributed under the [MIT license](https://opensource.org/licenses/MIT); the same as other Travis CI projects.
45-
46-
***

Rakefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ task :test => :build do
1010
end
1111

1212
desc 'Builds the site'
13-
task :build => :remove_output_dir do
13+
task :build => [:remove_output_dir, :gen_trusty_image_data] do
1414
FileUtils.rm '.jekyll-metadata' if File.exist?('.jekyll-metadata')
1515
sh 'bundle exec jekyll build --config=_config.yml'
1616
end
@@ -54,6 +54,23 @@ task :run_html_proofer do
5454
tester.run
5555
end
5656

57+
desc 'Populate Trusty image table data'
58+
task :gen_trusty_image_data do
59+
GENERATED_LANGUAGE_MAP_JSON_FILE = 'https://raw.githubusercontent.com/travis-infrastructure/terraform-config/master/aws-production-2/generated-language-mapping.json'
60+
61+
`curl -OsSfL '#{GENERATED_LANGUAGE_MAP_JSON_FILE}'`
62+
63+
json_data = JSON.load(File.read(File.basename(GENERATED_LANGUAGE_MAP_JSON_FILE)))
64+
yaml_data = json_data.to_yaml
65+
66+
File.write(File.join(File.dirname(__FILE__), '_data', 'trusty_mapping_data.yml'), yaml_data)
67+
end
68+
69+
desc 'Start Jekyll server'
70+
task :serve => [:gen_trusty_image_data] do
71+
sh "bundle exec jekyll serve --config=_config.yml"
72+
end
73+
5774
namespace :assets do
5875
task :precompile do
5976
puts `bundle exec jekyll build`

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ title: "Travis CI Documentation"
22
33
url: "https://docs.travis-ci.com"
44
docs_github: "https://github.com/travis-ci/docs-travis-ci-com/"
5-
exclude: [bin, CNAME, Gemfile, Gemfile.lock, README.md, slate, vendor]
5+
exclude: [bin, CNAME, Gemfile, Gemfile.lock, README.md, slate, vendor, '*.erb']
66
markdown: kramdown
77
permalink: :title
88
syntax-highlighting:

_includes/sidebar.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h3>Getting Started</h3>
3434
<li><a href="/user/customizing-the-build/">Customizing Your Build</a></li>
3535
<li><a href="/user/common-build-problems/">Common Build Problems</a></li>
3636
<li><a href="/user/speeding-up-the-build/">Speeding up the Build</a></li>
37+
<li><a href="/user/build-stages/">Build Stages (beta)</a></li>
3738
<li><a href="/user/docker/">Using Docker in your Build</a></li>
3839
<li><a href="/user/gui-and-headless-browsers/">Headless Testing with Browsers</a></li>
3940
<li><a href="/user/pull-requests/">Building Pull Requests</a></li>
@@ -72,7 +73,7 @@ <h3>Deployments and Uploads</h3>
7273
<h3>CI Environment Reference</h3>
7374
<ul>
7475
<li><a href="/user/ci-environment/">CI Environment Reference</a></li>
75-
<li><a href="/user/osx-ci-environment/">OSX CI Environment Reference</a></li>
76+
<li><a href="/user/osx-ci-environment/">OS X CI Environment Reference</a></li>
7677
<li><a href="/user/trusty-ci-environment/">Trusty CI Environment</a><li>
7778
<li><a href="/user/environment-variables/">Environment Variables</a></li>
7879
<li><a href="/user/multi-os/">Building on Multiple Operating Systems</a></li>
@@ -85,13 +86,14 @@ <h3>Encrypting Files and Data</h3>
8586
<li><a href="/user/encryption-keys/">Encrypting Sensitive Data</a></li>
8687
<li><a href="/user/encrypting-files/">Encrypting Files</a></li>
8788
<li><a href="/user/github-oauth-scopes/">GitHub Permissions used by Travis CI</a></li>
89+
<li><a href="/user/best-practices-security/">Best Practices in Securing Your Data</a></li>
8890
</ul>
8991

9092
<h3>Beta Features</h3>
9193
<ul>
92-
<li><a href="/user/customizing-the-build/#Building-only-the-latest-commit">Auto-cancellation</a></li>
9394
<li><a href="/user/cron-jobs/">Cron Jobs</a></li>
9495
<li><a href="/user/trusty-ci-environment/">Trusty Environment</a></li>
96+
<li><a href="/user/build-stages/">Build Stages</a></li>
9597
</ul>
9698

9799
<h3>Integrations and Notifications</h3>

_layouts/en.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<main id="main" class="main" data-swiftype-index='true'>
1616
{% unless page.no_header %}
17-
<aside class="improve-page"><a href="{{ site.docs_github }}edit/gh-pages/{{ page.path }}" target="_blank" title="Edit this page on GitHub" class="button-pen" data-proofer-ignore>Improve this page on GitHub</a></aside>
17+
<aside class="improve-page"><a href="{{ site.docs_github }}edit/master/{{ page.path }}" target="_blank" title="Edit this page on GitHub" class="button-pen" data-proofer-ignore>Improve this page on GitHub</a></aside>
1818
<h1 class="title">{{ page.title }}</h1>
1919
{% endunless %}
2020
{{ content }}

_plugins/select_env_var_generator.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class SelectEnvVarGenerator < Jekyll::Generator
2+
ENVS = %w(
3+
WEBHOOK_PAYLOAD_GIST_ID
4+
)
5+
def generate(site)
6+
site.config['env'] = {}
7+
8+
ENVS.each do |env|
9+
site.config['env'][env] = ENV[env]
10+
end
11+
end
12+
end
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
require 'faraday'
2+
require 'base64'
3+
require 'openssl'
4+
5+
class WebhookPayloadDocHandler
6+
DEFAULT_API_HOST = 'https://api.travis-ci.org'
7+
API_HOST = ENV.fetch('API_HOST', DEFAULT_API_HOST)
8+
9+
def call(env)
10+
req = Rack::Request.new(env)
11+
gist_token = ENV['TRAVISBOT_GIST_TOKEN']
12+
payload_gist_id = ENV['WEBHOOK_PAYLOAD_GIST_ID']
13+
14+
unless req.post? && gist_token && payload_gist_id
15+
return invalid_req_response
16+
end
17+
18+
payload = URI.decode(req.params["payload"])
19+
sig = Base64.decode64 env["HTTP_SIGNATURE"]
20+
21+
pkey = OpenSSL::PKey::RSA.new(public_key)
22+
23+
unless pkey.verify(OpenSSL::Digest::SHA1.new, sig, payload)
24+
return invalid_sig_response
25+
end
26+
27+
conn = Faraday.new(:url => "https://api.github.com") do |faraday|
28+
faraday.adapter Faraday.default_adapter
29+
end
30+
31+
response = conn.patch "/gists/#{payload_gist_id}" do |req|
32+
req.headers["Content-Type"] = 'application/json'
33+
req.headers["Authorization"] = "token #{gist_token}"
34+
req.body = gist_update_body(payload)
35+
end
36+
37+
if response.success?
38+
return valid_sig_response
39+
else
40+
return gist_update_failure_response
41+
end
42+
rescue
43+
json_response(result: 'error', message: 'Internal server error', status: 500)
44+
end
45+
46+
private
47+
def public_key
48+
return @public_key if @public_key
49+
50+
conn = Faraday.new(:url => API_HOST) do |faraday|
51+
faraday.adapter Faraday.default_adapter
52+
end
53+
response = conn.get '/config'
54+
@public_key = JSON.parse(response.body)["config"]["notifications"]["webhook"]["public_key"]
55+
rescue
56+
''
57+
end
58+
59+
def gist_update_body(payload)
60+
{
61+
"files" => {
62+
"webhookpayload.json" => {
63+
"content" => JSON.pretty_generate(JSON.load(payload))
64+
}
65+
}
66+
}.to_json
67+
end
68+
69+
def json_response(result:, message:, status: 200)
70+
Rack::Response.new(
71+
[{"result" => result, "message" => message}.to_json],
72+
status,
73+
{"Content-Type" => "application/json"}
74+
)
75+
end
76+
77+
def invalid_req_response
78+
json_response(result: 'error', message: 'Invalid request.', status: 400)
79+
end
80+
81+
def invalid_sig_response
82+
json_response(result: 'error', message: 'Invalid signature.', status: 400)
83+
end
84+
85+
def valid_sig_response
86+
json_response(result: 'success', message: 'Signature is valid.')
87+
end
88+
89+
def gist_update_failure_response
90+
json_response(result: 'success', message: 'Signature is valid, but gist update failed.')
91+
end
92+
end

api/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ <h2 id="creating-a-temporary-github-token">Creating a temporary GitHub token</h2
371371
<span class="nb">require</span> <span class="s1">'travis/tools/github'</span>
372372

373373
<span class="c1"># drop_token will make the token a temporary one</span>
374-
<span class="n">github</span> <span class="o">=</span> <span class="no">Travis</span><span class="o">::</span><span class="no">Tools</span><span class="o">::</span><span class="no">Github</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">drop_token: </span><span class="kp">true</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">g</span><span class="o">|</span>
374+
<span class="n">github</span> <span class="o">=</span> <span class="no">Travis</span><span class="o">::</span><span class="no">Tools</span><span class="o">::</span><span class="no">GitHub</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">drop_token: </span><span class="kp">true</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">g</span><span class="o">|</span>
375375
<span class="n">g</span><span class="p">.</span><span class="nf">ask_login</span> <span class="o">=</span> <span class="o">-&gt;</span> <span class="p">{</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"GitHub login: "</span><span class="p">);</span> <span class="nb">gets</span> <span class="p">}</span>
376376
<span class="n">g</span><span class="p">.</span><span class="nf">ask_password</span> <span class="o">=</span> <span class="o">-&gt;</span> <span class="p">{</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"Password: "</span><span class="p">);</span> <span class="nb">gets</span> <span class="p">}</span>
377377
<span class="n">g</span><span class="p">.</span><span class="nf">ask_otp</span> <span class="o">=</span> <span class="o">-&gt;</span> <span class="p">{</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"Two-factor token: "</span><span class="p">);</span> <span class="nb">gets</span> <span class="p">}</span>

0 commit comments

Comments
 (0)