Commit 8ab98404 authored by Jens Langhammer's avatar Jens Langhammer

Merge branch 'master' into 't1-cache'

# Conflicts:
#   .gitlab-ci.yml
parents 30e47d8c a64d810d
Pipeline #3862 passed with stage
in 1 minute and 56 seconds
[bumpversion]
current_version = 0.5.6
current_version = 0.5.7
tag = True
commit = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
......
......@@ -22,7 +22,7 @@ create-build-image:
before_script:
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.build-base --destination docker.beryju.org/p2/build-base:latest --destination docker.beryju.org/p2/build-base:0.5.6
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.build-base --destination docker.beryju.org/p2/build-base:latest --destination docker.beryju.org/p2/build-base:0.5.7
stage: build-build-image
only:
refs:
......@@ -60,7 +60,7 @@ build-p2-server:
before_script:
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination docker.beryju.org/p2/server:latest --destination docker.beryju.org/p2/server:0.5.6
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination docker.beryju.org/p2/server:latest --destination docker.beryju.org/p2/server:0.5.7
only:
- tags
- /^version/.*$/
......@@ -72,7 +72,7 @@ build-p2-tier0:
before_script:
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR/tier0 --dockerfile $CI_PROJECT_DIR/tier0/Dockerfile --destination docker.beryju.org/p2/tier0:latest --destination docker.beryju.org/p2/tier0:0.5.6
- /kaniko/executor --context $CI_PROJECT_DIR/tier0 --dockerfile $CI_PROJECT_DIR/tier0/Dockerfile --destination docker.beryju.org/p2/tier0:latest --destination docker.beryju.org/p2/tier0:0.5.7
only:
- tags
- /^version/.*$/
......
apiVersion: v1
appVersion: "0.5.6"
appVersion: "0.5.7"
description: A Helm chart for p2.
name: p2
version: 0.5.6
version: 0.5.7
icon: https://p2.beryju.org/images/logo.png
......@@ -2,7 +2,7 @@
# This is a YAML-formatted file.
image:
tag: 0.5.6
tag: 0.5.7
config:
# Optionally specify fixed secret_key, otherwise generated automatically
......
......@@ -8,7 +8,7 @@
# - LE_MAIL: Optional; Let's Encrypt E-Mail. If this is not set, Let's Encrypt is not enabled.
K3S_VERSION="0.5.0"
P2_VERSION="0.5.6"
P2_VERSION="0.5.7"
export INSTALL_K3S_EXEC="--cluster-cidr 10.121.0.0/16 --cluster-domain p2.baked --docker --no-deploy traefik"
if [ "$EUID" -ne 0 ]; then
......
......@@ -4,7 +4,7 @@ metadata:
name: p2
namespace: kube-system
spec:
chart: https://docker.beryju.org/chartrepo/p2/charts/p2-0.5.6.tgz
chart: https://docker.beryju.org/chartrepo/p2/charts/p2-0.5.7.tgz
targetNamespace: p2
valuesContent: |-
deployment:
......
"""p2 version header"""
__version__ = '0.5.6'
__version__ = '0.5.7'
......@@ -99,7 +99,7 @@ class Blob(UUIDModel, TagModel):
@property
def filename(self):
"""Return only the filename part of self.path"""
return self.path.split('/')[-1]
return self.path
def _open_read_handle(self):
if not self._reading_handle:
......
......@@ -111,8 +111,8 @@ CELERY_TASK_SOFT_TIME_LIMIT = 600
CELERY_BEAT_SCHEDULE = {}
CELERY_CREATE_MISSING_QUEUES = True
CELERY_TASK_DEFAULT_QUEUE = 'p2'
CELERY_BROKER_URL = CONFIG.get('message_queue.broker')
CELERY_RESULT_BACKEND = CONFIG.get('message_queue.results')
CELERY_BROKER_URL = CONFIG.y('message_queue.broker')
CELERY_RESULT_BACKEND = CONFIG.y('message_queue.results')
CELERY_IMPORTS = (
'p2.core.tasks',
'p2.log.tasks',
......
"""p2 S3 App Config"""
from xml.etree import ElementTree
from django.apps import AppConfig
from p2.s3.constants import XML_NAMESPACE
class P2S3Config(AppConfig):
"""p2 S3 App Config"""
......@@ -8,3 +12,6 @@ class P2S3Config(AppConfig):
name = 'p2.s3'
label = 'p2_s3'
verbose_name = 'p2 S3'
def ready(self):
ElementTree.register_namespace("", XML_NAMESPACE)
......@@ -4,6 +4,7 @@ from xml.etree import ElementTree
from django.views import View
from guardian.shortcuts import get_objects_for_user
from p2.s3.constants import XML_NAMESPACE
from p2.s3.http import XMLResponse
......@@ -12,22 +13,18 @@ class ListView(View):
def get(self, request):
"""Return list of Buckets"""
root = ElementTree.Element("{http://s3.amazonaws.com/doc/2006-03-01}ListAllMyBucketsResult")
root = ElementTree.Element("{%s}ListAllMyBucketsResult" % XML_NAMESPACE)
owner = ElementTree.Element("Owner")
owner_id = ElementTree.SubElement(owner, 'ID')
owner_id.text = str(request.user.id)
owner_display_name = ElementTree.SubElement(owner, 'DisplayName')
owner_display_name.text = request.user.username
ElementTree.SubElement(owner, 'ID').text = str(request.user.id)
ElementTree.SubElement(owner, 'DisplayName').text = request.user.username
buckets = ElementTree.Element('Buckets')
for volume in get_objects_for_user(self.request.user, 'p2_core.use_volume'):
bucket = ElementTree.Element("Bucket")
bucket_name = ElementTree.SubElement(bucket, "Name")
bucket_name.text = volume.name
bucket_creation_date = ElementTree.SubElement(bucket, "CreationDate")
bucket_creation_date.text = "2006-02-03T16:45:09.000Z"
ElementTree.SubElement(bucket, "Name").text = volume.name
ElementTree.SubElement(bucket, "CreationDate").text = "2006-02-03T16:45:09.000Z"
buckets.append(bucket)
root.append(owner)
......
......@@ -22,7 +22,7 @@ class ServeRuleForm(TagModelForm):
help_texts = {
'tags': mark_safe(_("""
All of the used keys have to match the requests value for this Rule to trigger.
You can use Regular Expressions as values. See <a href=
You can use Regular Expressions as values. See <a target="_blank" href=
"https://git.beryju.org/BeryJu.org/p2/blob/version/%(version)s/p2/serve/constants.py">
here</a> for a list of all possible tags.""" % {'version':__version__})),
'blob_query': mark_safe(_("""
......@@ -33,7 +33,7 @@ class ServeRuleForm(TagModelForm):
<li>{path_relative} will be replaced by the relative Request Path.</li>
<li>{host} will be replaced by the requested Hostname.</li>
<li>{meta[X]} where X is any of the fields
described <a href=
described <a target="_blank" href=
"https://docs.djangoproject.com/en/2.2/ref/request-response/#django.http.HttpRequest.META">
here</a></li></ul>"""))
}
......
......@@ -5,12 +5,30 @@ import uuid
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
temp_rules = {}
def clean_serve_rule(apps, schema_editor):
def before_serverule_update(apps, schema_editor):
"""Remove ServeRules before upgrading, preventing an issue with pk."""
ServeRule = apps.get_model("p2_serve", "ServeRule")
for rule in ServeRule.objects.all():
temp_rules[rule.name] = {
'match': rule.match,
'blob_query': rule.blob_query,
}
ServeRule.objects.all().delete()
def after_serverule_update(apps, schema_editor):
"""Create new rules"""
ServeRule = apps.get_model("p2_serve", "ServeRule")
from p2.serve.constants import TAG_SERVE_MATCH_PATH_RELATIVE
for name, rule in temp_rules.items():
ServeRule.objects.create(
name=name,
blob_query=rule['blob_query'],
tags={
TAG_SERVE_MATCH_PATH_RELATIVE: rule['match']
}
)
class Migration(migrations.Migration):
......@@ -19,7 +37,7 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(clean_serve_rule),
migrations.RunPython(before_serverule_update),
migrations.RemoveField(
model_name='serverule',
name='id',
......@@ -38,4 +56,5 @@ class Migration(migrations.Migration):
name='uuid',
field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False),
),
migrations.RunPython(after_serverule_update),
]
......@@ -23,7 +23,11 @@
<tr>
<td>{{ object.name }}</td>
<td>
<pre>{{ object.match }}</pre>
<ul>
{% for key, value in object.tags.items %}
<li>{{ key }}: {{ value }}</li>
{% endfor %}
</ul>
</td>
<td>
<pre>{{ object.blob_query }}</pre>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment