Commit 20e706bb authored by Luis Araujo's avatar Luis Araujo

Check image release and version values formats on input

This commit defines a regexp pattern in the HTML template to make sure
the image release and version values are in correct format during input.

The commit also adds notes in the respective input boxes giving an example
of what kind of format is expected, and strip any whitespace found in these
values once they are received.
Signed-off-by: Luis Araujo's avatarLuis Araujo <luis.araujo@collabora.co.uk>
parent ccf4e1f6
Pipeline #4723 passed with stage
in 1 minute and 25 seconds
......@@ -75,13 +75,16 @@ def save_job(job, db):
db.session.commit()
def save_manual_job(username, manual_tests_results, db,
image_release, image_version,
img_release, img_version,
image_type, image_deployment):
img_type, img_arch, visibility = image_type.split('-')
# Assume at the beginning this is updating a record.
update = True
# Always make sure there is no space for these fields.
image_release, image_version = img_release.strip(), img_version.strip()
# Search for an existing manual job record for this image type, and use that
# for updating record.
job_db = Job.query.filter_by(image_release = image_release,
......
......@@ -20,11 +20,13 @@
<form method="post">
<div class="form-group">
{{ form.image_release.label }}
{{ form.image_release(class_='form-control') }}
{{ form.image_release(class_='form-control', pattern="^[0-9a-zA-Z\.\-]+$") }}
<small>The image release number (e.g. 19.03 , v2020dev)</small>
</div>
<div class="form-group">
{{ form.image_version.label }}
{{ form.image_version(class_='form-control') }}
{{ form.image_version(class_='form-control', pattern="^[0-9]+\.[0-9]+$") }}
<small>The image build number (e.g. 20180620.0 , 20190720.2)</small>
</div>
<div class="form-group">
{{ form.image_deployment.label }}
......
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