提交 836420f4 编写于 作者: J Jonathan Thomas

Adding more validations during the publish step, to verify...

Adding more validations during the publish step, to verify openshot.org/download has correct URLs, which include the new version, and that all URLs are valid (no 404s).
上级 b4483eef
......@@ -137,7 +137,10 @@ deployer:
artifacts:
expire_in: 4 weeks
paths:
- build\build-server.log
- build/*.log
- build/*.sha256sum
- build/*.verify
- build/*.torrent
script:
- python3 -u installer/deploy.py "$SLACK_TOKEN" "$GITHUB_USER" "$GITHUB_PASS" "False"
when: manual
......@@ -153,7 +156,7 @@ publisher:
artifacts:
expire_in: 4 weeks
paths:
- build\build-server.log
- build/*.log
script:
- python3 -u installer/deploy.py "$SLACK_TOKEN" "$GITHUB_USER" "$GITHUB_PASS" "True"
when: manual
......
......@@ -34,12 +34,14 @@ import re
import urllib3
from github3 import login
from requests.auth import HTTPBasicAuth
from requests import post, get
from requests import post, get, head
from build_server import output, run_command, error, truncate, zulip_upload_log, get_release, upload, \
errors_detected, log, version_info, parse_version_info
PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) # Primary openshot folder
RELEASE_NAME_REGEX = re.compile(r'^OpenShot-v.*?(-.*?)-x86[_64]*')
DOWNLOAD_PAGE_URLS = re.compile(r'"(//github.com/OpenShot/openshot-qt/releases/download/v.*?/OpenShot-.*?)"',
re.MULTILINE)
# Access info class (for version info)
sys.path.append(os.path.join(PATH, 'src', 'classes'))
......@@ -266,6 +268,27 @@ if __name__ == "__main__":
(r.status_code, os.getenv('OPENSHOT_ORG_USER'),
r.json().get('message', 'no error message found')))
else:
# Verify download links on openshot.org are correct (and include the new release version)
r = get("https://www.openshot.org/download/")
if r.ok:
# Find all release download URLs on openshot.org
urls = DOWNLOAD_PAGE_URLS.findall(r.content.decode('UTF-8'))
for url in urls:
# Only GET the header of each URL, to validate it is valid and found
r = head("https:" + url)
if r.ok and r.reason == "Found":
output("Validation of URL successful: %s" % url)
else:
raise Exception("Validation of URL FAILED: %s, %s, %s" % (url, r.status_code, r.reason))
# Validate the current version is found in each URL
if version_info.get('openshot-qt', {}).get('VERSION', 'N/A') not in url:
raise Exception("Validation of URL FAILED. Missing version %s: %s, %s, %s" %
(version_info.get('openshot-qt', {}).get('VERSION', 'N/A'), url,
r.status_code, r.reason))
else:
raise Exception("Failed to GET openshot.org/download for URL validation: %s" % r.status_code)
# Publish the release (make new version visible on openshot.org, and make blog post visible)
auth = HTTPBasicAuth(os.getenv('OPENSHOT_ORG_USER'), os.getenv('OPENSHOT_ORG_PASS'))
r = post("https://www.openshot.org/api/release/publish/", auth=auth, data={"version": github_release.tag_name })
......@@ -274,6 +297,7 @@ if __name__ == "__main__":
(r.status_code, os.getenv('OPENSHOT_ORG_USER'),
r.json().get('message', 'no error message found')))
# Publish GitHub Release objects (in all 3 repos)
for repo_name in repo_names:
# If NO release is found, create a new one
github_release = releases.get(repo_name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册