diff --git a/Bobfile b/Bobfile index edc3a96ed..37f001b79 100644 --- a/Bobfile +++ b/Bobfile @@ -11,12 +11,12 @@ version = 1 name = "quay" Dockerfile = "Dockerfile.web" project = "quay" - tags = ["git:short", "latest"] + tags = ["git:short"] [[container]] name = "builder" Dockerfile = "Dockerfile.buildworker" project = "builder" - tags = ["git:short", "latest"] + tags = ["git:short"] # vim:ft=toml \ No newline at end of file diff --git a/Dockerfile.buildworker b/Dockerfile.buildworker index f3ea2a4d5..1917db423 100644 --- a/Dockerfile.buildworker +++ b/Dockerfile.buildworker @@ -2,7 +2,6 @@ FROM phusion/baseimage:0.9.11 ENV DEBIAN_FRONTEND noninteractive ENV HOME /root -WORKDIR / # Install the dependencies. RUN apt-get update # 15JUL2014 diff --git a/Dockerfile.web b/Dockerfile.web index 4d1cda7af..6cfd76f94 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -2,7 +2,6 @@ FROM phusion/baseimage:0.9.11 ENV DEBIAN_FRONTEND noninteractive ENV HOME /root -WORKDIR / # Install the dependencies. RUN apt-get update # 15JUL2014 diff --git a/binary_dependencies/builder/lxc-docker-1.1.0-tutum_1.1.0-tutum-20140711175158-768e3fe-dirty_amd64.deb b/binary_dependencies/builder/lxc-docker-1.1.0-tutum_1.1.0-tutum-20140711175158-768e3fe-dirty_amd64.deb deleted file mode 100644 index 29d023891..000000000 Binary files a/binary_dependencies/builder/lxc-docker-1.1.0-tutum_1.1.0-tutum-20140711175158-768e3fe-dirty_amd64.deb and /dev/null differ diff --git a/binary_dependencies/builder/lxc-docker-1.1.1-tutum_1.1.1-tutum-20140725172804-3fff5b7-dirty_amd64.deb b/binary_dependencies/builder/lxc-docker-1.1.1-tutum_1.1.1-tutum-20140725172804-3fff5b7-dirty_amd64.deb new file mode 100644 index 000000000..c066f6a08 Binary files /dev/null and b/binary_dependencies/builder/lxc-docker-1.1.1-tutum_1.1.1-tutum-20140725172804-3fff5b7-dirty_amd64.deb differ diff --git a/data/model/legacy.py b/data/model/legacy.py index c34c0ec3e..e428f174f 100644 --- a/data/model/legacy.py +++ b/data/model/legacy.py @@ -1100,6 +1100,9 @@ def _get_repository_images_base(namespace_name, repository_name, query_modifier) # Make sure we're always retrieving the same image object. image = location.storage.image + # Set the storage to the one we got from the location, to prevent another query + image.storage = location.storage + if not image.id in images: images[image.id] = image image.storage.locations = set() diff --git a/endpoints/api/trigger.py b/endpoints/api/trigger.py index 484601ee7..3203e4a79 100644 --- a/endpoints/api/trigger.py +++ b/endpoints/api/trigger.py @@ -81,10 +81,11 @@ class BuildTrigger(RepositoryParamResource): 'service': trigger.service.name, 'config': config_dict}, repo=model.get_repository(namespace, repository)) + trigger.delete_instance(recursive=True) + if trigger.write_token is not None: trigger.write_token.delete_instance() - trigger.delete_instance(recursive=True) return 'No Content', 204 diff --git a/endpoints/common.py b/endpoints/common.py index fdd5932a8..00435503e 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -69,6 +69,17 @@ def truthy_param(param): return param not in {False, 'false', 'False', '0', 'FALSE', '', 'null'} +def param_required(param_name): + def wrapper(wrapped): + @wraps(wrapped) + def decorated(*args, **kwargs): + if param_name not in request.args: + abort(make_response('Required param: %s' % param_name, 400)) + return wrapped(*args, **kwargs) + return decorated + return wrapper + + @login_manager.user_loader def load_user(username): logger.debug('User loader loading deferred user: %s' % username) @@ -200,7 +211,7 @@ def start_build(repository, dockerfile_id, tags, build_name, subdir, manual, build_request = model.create_repository_build(repository, token, job_config, dockerfile_id, build_name, - trigger, pull_robot_name = pull_robot_name) + trigger, pull_robot_name=pull_robot_name) dockerfile_build_queue.put([repository.namespace, repository.name], json.dumps({ 'build_uuid': build_request.uuid, diff --git a/endpoints/web.py b/endpoints/web.py index cce13752d..07ef3ffb0 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -14,7 +14,7 @@ from auth.permissions import AdministerOrganizationPermission from util.invoice import renderInvoiceToPdf from util.seo import render_snapshot from util.cache import no_cache -from endpoints.common import common_login, render_page_template, route_show_if, route_hide_if +from endpoints.common import common_login, render_page_template, route_show_if, param_required from endpoints.csrf import csrf_protect, generate_csrf_token from util.names import parse_repository_name from util.gravatar import compute_hash @@ -190,9 +190,9 @@ def receipt(): abort(401) return - id = request.args.get('id') - if id: - invoice = stripe.Invoice.retrieve(id) + invoice_id = request.args.get('id') + if invoice_id: + invoice = stripe.Invoice.retrieve(invoice_id) if invoice: user_or_org = model.get_user_or_org_by_customer_id(invoice.customer) @@ -335,6 +335,9 @@ def deny_application(): @web.route('/oauth/authorize', methods=['GET']) @no_cache +@param_required('client_id') +@param_required('redirect_uri') +@param_required('scope') def request_authorization_code(): provider = FlaskAuthorizationProvider() response_type = request.args.get('response_type', 'code') @@ -384,6 +387,12 @@ def request_authorization_code(): @web.route('/oauth/access_token', methods=['POST']) @no_cache +@param_required('grant_type') +@param_required('client_id') +@param_required('client_secret') +@param_required('redirect_uri') +@param_required('code') +@param_required('scope') def exchange_code_for_token(): grant_type = request.form.get('grant_type', None) client_id = request.form.get('client_id', None) diff --git a/initdb.py b/initdb.py index 1021f35ea..1a3265a68 100644 --- a/initdb.py +++ b/initdb.py @@ -349,46 +349,6 @@ def populate_database(): (1, [(1, [], 'v5.0'), (1, [], 'v6.0')], None)], None)) - """ - __generate_repository(new_user_1, 'insane', None, False, [], - (2, [(3, [], 'v2.0'), - (1, [(1, [(1, [], ['latest', 'prod'])], - 'staging'), - (1, [], None)], None), - (20, [], 'v3.0'), - (22, [(14, [], 'v3.11')], 'v3.1'), - (20, [], 'v3.2'), - (28, [], 'v3.3'), - (16, [(14, [], 'v3.41'), (18, [], 'v3.42'), (12, [], 'v3.43')], 'v3.4'), - (21, [(6, [], 'v3.51'), (18, [], 'v3.52')], 'v3.5'), - (21, [(7, [], 'v3.61'), (17, [], 'v3.62')], 'v3.6'), - (21, [(8, [], 'v3.71'), (16, [], 'v3.72')], 'v3.7'), - (21, [(9, [], 'v3.81'), (15, [], 'v3.82')], 'v3.8'), - (21, [(10, [], 'v3.91'), (14, [], 'v3.92'), (11, [], 'v3.92')], 'v3.9'), - (5, [], 'v4.0'), - (5, [], 'v4.1'), - (5, [], 'v4.2'), - (5, [], 'v4.3'), - (5, [], 'v4.4'), - (5, [], 'v4.5'), - (5, [], 'v4.6'), - (5, [], 'v4.7'), - (5, [], 'v4.8'), - (5, [], 'v4.10'), - (5, [], 'v4.11'), - (5, [], 'v4.12'), - (5, [], 'v4.13'), - (5, [], 'v4.14'), - (5, [], 'v4.15'), - (5, [], 'v4.16'), - (5, [], 'v4.17'), - (5, [], 'v4.18'), - (5, [], 'v4.19'), - (5, [], 'v4.20'), - (1, [(1, [], 'v5.0'), (1, [], 'v6.0')], None)], - None)) - """ - __generate_repository(new_user_2, 'publicrepo', 'Public repository pullable by the world.', True, [], (10, [], 'latest')) diff --git a/test/data/test.db b/test/data/test.db index 5946e00d8..4d0428331 100644 Binary files a/test/data/test.db and b/test/data/test.db differ