Skip to content

Commit 34ee02c

Browse files
supertassuGithub Action
andauthored
Add a deny-all robots.txt (#92)
* Add a deny-all robots.txt Bug: T397502 Change-Id: Iaee739a3f407eb1b1fffedf541781cc61ff95047 * auto update of tag --------- Co-authored-by: Github Action <auto@github.com>
1 parent fc5fbba commit 34ee02c

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

helm-quarry/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
web:
22
repository: 'quay.io/wikimedia-quarry/quarry'
3-
tag: pr-90 # web tag managed by github actions
3+
tag: pr-92 # web tag managed by github actions
44
resources:
55
requests:
66
memory: "300Mi"
@@ -11,7 +11,7 @@ web:
1111

1212
worker:
1313
repository: 'quay.io/wikimedia-quarry/quarry'
14-
tag: pr-90 # worker tag managed by github actions
14+
tag: pr-92 # worker tag managed by github actions
1515
resources:
1616
requests:
1717
memory: "400Mi"

quarry/web/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import current_app, Flask, render_template, g
1+
from flask import current_app, Flask, render_template, g, Response
22
from flask_caching import Cache
33
from werkzeug.middleware.proxy_fix import ProxyFix
44

@@ -72,6 +72,10 @@ def index():
7272
stats_count_runs=global_conn.session.query(QueryRun).count(),
7373
)
7474

75+
@app.route("/robots.txt")
76+
def robots_txt():
77+
return Response("User-Agent: *\nDisallow: /\n", mimetype="text/plain")
78+
7579
return app
7680

7781

tests/test_app.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ def test_frontpage(self, mocker, client):
3535
assert response.data
3636
assert "5 users" in response.data.decode("utf8")
3737
assert f"{5 * 3 * 3 * 3} queries" in response.data.decode("utf8")
38+
39+
def test_robots_txt(self, client):
40+
response = client.get("/robots.txt")
41+
assert response.status_code == 200
42+
assert response.headers["Content-Type"] == "text/plain; charset=utf-8"
43+
assert "User-Agent: *" in response.data.decode("utf8")

0 commit comments

Comments
 (0)